Skip to content

Commit

Permalink
Merge pull request #1511 from cyli/secret-protos
Browse files Browse the repository at this point in the history
Secret-specific protos
  • Loading branch information
diogomonica authored Sep 23, 2016
2 parents 8b9cdbb + ac092de commit 63600e0
Show file tree
Hide file tree
Showing 15 changed files with 5,717 additions and 2,157 deletions.
5,360 changes: 3,716 additions & 1,644 deletions api/control.pb.go

Large diffs are not rendered by default.

94 changes: 94 additions & 0 deletions api/control.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,44 @@ service Control {
rpc UpdateCluster(UpdateClusterRequest) returns (UpdateClusterResponse) {
option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
};

// --- secret APIs ---

// GetSecret returns a `GetSecretResponse` with a `Secret` with the same
// id as `GetSecretRequest.SecretID`
// - Returns `NotFound` if the Secret with the given id is not found.
// - Returns `InvalidArgument` if the `GetSecretRequest.SecretID` is empty.
// - Returns an error if getting fails.
rpc GetSecret(GetSecretRequest) returns (GetSecretResponse) {
option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
}

// ListSecrets returns a `ListSecretResponse` with a list all non-internal `Secret`s being
// managed, or all secrets matching any name in `ListSecretsRequest.Names`, any
// name prefix in `ListSecretsRequest.NamePrefixes`, any id in
// `ListSecretsRequest.SecretIDs`, or any id prefix in `ListSecretsRequest.IDPrefixes`.
// - Returns an error if listing fails.
rpc ListSecrets(ListSecretsRequest) returns (ListSecretsResponse) {
option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
}
// CreateSecret creates and return a `CreateSecretResponse` with a `Secret` based
// on the provided `CreateSecretRequest.SecretSpec`.
// - Returns `InvalidArgument` if the `CreateSecretRequest.SecretSpec` is malformed,
// or if the secret data is too long or contains invalid characters.
// - Returns `ResourceExhausted` if there are already the maximum number of allowed
// secrets in the system.
// - Returns an error if the creation fails.
rpc CreateSecret(CreateSecretRequest) returns (CreateSecretResponse) {
option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
}

// RemoveSecret removes the secret referenced by `RemoveSecretRequest.ID`.
// - Returns `InvalidArgument` if `RemoveSecretRequest.ID` is empty.
// - Returns `NotFound` if the a secret named `RemoveSecretRequest.ID` is not found.
// - Returns an error if the deletion fails.
rpc RemoveSecret(RemoveSecretRequest) returns (RemoveSecretResponse) {
option (docker.protobuf.plugin.tls_authorization) = { roles: "swarm-manager" };
}
}

message GetNodeRequest {
Expand Down Expand Up @@ -293,3 +331,59 @@ message UpdateClusterRequest {
message UpdateClusterResponse {
Cluster cluster = 1;
}

// GetSecretRequest is the request to get a `Secret` object given a secret id.
message GetSecretRequest {
string secret_id = 1 [(gogoproto.customname) = "SecretID"];
}

// GetSecretResponse contains the Secret corresponding to the id in
// `GetSecretRequest`, but the `Secret.Spec.Data` field in each `Secret`
// object should be nil instead of actually containing the secret bytes.
message GetSecretResponse {
Secret secret = 1;
}

// ListSecretRequest is the request to list all non-internal secrets in the secret store,
// or all secrets filtered by (name or name prefix or id prefix) and labels.
message ListSecretsRequest {
message Filters {
repeated string names = 1;
repeated string id_prefixes = 2 [(gogoproto.customname) = "IDPrefixes"];
map<string, string> labels = 3;
repeated string name_prefixes = 4;
}

Filters filters = 1;
}

// ListSecretResponse contains a list of all the secrets that match the name or
// name prefix filters provided in `ListSecretRequest`. The `Secret.Spec.Data`
// field in each `Secret` object should be nil instead of actually containing
// the secret bytes.
message ListSecretsResponse {
repeated Secret secrets = 1;
}

// CreateSecretRequest specifies a new secret (it will not update an existing
// secret) to create.
message CreateSecretRequest {
SecretSpec spec = 1;
}

// CreateSecretResponse contains the newly created `Secret`` corresponding to the
// name in `CreateSecretRequest`. The `Secret.Spec.Data` field should be nil instead
// of actually containing the secret bytes.
message CreateSecretResponse {
Secret secret = 1;
}

// RemoveSecretRequest contains the ID of the secret that should be removed. This
// removes all versions of the secret.
message RemoveSecretRequest {
string secret_id = 1 [(gogoproto.customname) = "SecretID"];
}

// RemoveSecretResponse is an empty object indicating the successful removal of
// a secret.
message RemoveSecretResponse {}
237 changes: 183 additions & 54 deletions api/dispatcher.pb.go

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions api/dispatcher.proto
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,14 @@ message AssignmentsMessage {
// assignment set. It is not used in the first assignments message of
// a stream.
repeated string remove_tasks = 5;

// UpdateSecrets is a set of new or updated secrets for this node.
// In the first assignments message, it contains all of the secrets
// the node needs for itself and its assigned tasks.
repeated Secret update_secrets = 6;

// RemoveSecrets is a set of previously-assigned secret names to remove
// from memory. It is not used in the first assignments message of
// a stream.
repeated string remove_secrets = 7;
}
Loading

0 comments on commit 63600e0

Please sign in to comment.