Documentation ¶
Index ¶
- Constants
- type Server
- func (s *Server) CreateConfig(ctx context.Context, request *api.CreateConfigRequest) (*api.CreateConfigResponse, error)
- func (s *Server) CreateExtension(ctx context.Context, request *api.CreateExtensionRequest) (*api.CreateExtensionResponse, error)
- func (s *Server) CreateNetwork(ctx context.Context, request *api.CreateNetworkRequest) (*api.CreateNetworkResponse, error)
- func (s *Server) CreateResource(ctx context.Context, request *api.CreateResourceRequest) (*api.CreateResourceResponse, error)
- func (s *Server) CreateSecret(ctx context.Context, request *api.CreateSecretRequest) (*api.CreateSecretResponse, error)
- func (s *Server) CreateService(ctx context.Context, request *api.CreateServiceRequest) (*api.CreateServiceResponse, error)
- func (s *Server) GetCluster(ctx context.Context, request *api.GetClusterRequest) (*api.GetClusterResponse, error)
- func (s *Server) GetConfig(ctx context.Context, request *api.GetConfigRequest) (*api.GetConfigResponse, error)
- func (s *Server) GetExtension(ctx context.Context, request *api.GetExtensionRequest) (*api.GetExtensionResponse, error)
- func (s *Server) GetNetwork(ctx context.Context, request *api.GetNetworkRequest) (*api.GetNetworkResponse, error)
- func (s *Server) GetNode(ctx context.Context, request *api.GetNodeRequest) (*api.GetNodeResponse, error)
- func (s *Server) GetResource(ctx context.Context, request *api.GetResourceRequest) (*api.GetResourceResponse, error)
- func (s *Server) GetSecret(ctx context.Context, request *api.GetSecretRequest) (*api.GetSecretResponse, error)
- func (s *Server) GetService(ctx context.Context, request *api.GetServiceRequest) (*api.GetServiceResponse, error)
- func (s *Server) GetTask(ctx context.Context, request *api.GetTaskRequest) (*api.GetTaskResponse, error)
- func (s *Server) ListClusters(ctx context.Context, request *api.ListClustersRequest) (*api.ListClustersResponse, error)
- func (s *Server) ListConfigs(ctx context.Context, request *api.ListConfigsRequest) (*api.ListConfigsResponse, error)
- func (s *Server) ListNetworks(ctx context.Context, request *api.ListNetworksRequest) (*api.ListNetworksResponse, error)
- func (s *Server) ListNodes(ctx context.Context, request *api.ListNodesRequest) (*api.ListNodesResponse, error)
- func (s *Server) ListResources(ctx context.Context, request *api.ListResourcesRequest) (*api.ListResourcesResponse, error)
- func (s *Server) ListSecrets(ctx context.Context, request *api.ListSecretsRequest) (*api.ListSecretsResponse, error)
- func (s *Server) ListServices(ctx context.Context, request *api.ListServicesRequest) (*api.ListServicesResponse, error)
- func (s *Server) ListTasks(ctx context.Context, request *api.ListTasksRequest) (*api.ListTasksResponse, error)
- func (s *Server) RemoveConfig(ctx context.Context, request *api.RemoveConfigRequest) (*api.RemoveConfigResponse, error)
- func (s *Server) RemoveExtension(ctx context.Context, request *api.RemoveExtensionRequest) (*api.RemoveExtensionResponse, error)
- func (s *Server) RemoveNetwork(ctx context.Context, request *api.RemoveNetworkRequest) (*api.RemoveNetworkResponse, error)
- func (s *Server) RemoveNode(ctx context.Context, request *api.RemoveNodeRequest) (*api.RemoveNodeResponse, error)
- func (s *Server) RemoveResource(ctx context.Context, request *api.RemoveResourceRequest) (*api.RemoveResourceResponse, error)
- func (s *Server) RemoveSecret(ctx context.Context, request *api.RemoveSecretRequest) (*api.RemoveSecretResponse, error)
- func (s *Server) RemoveService(ctx context.Context, request *api.RemoveServiceRequest) (*api.RemoveServiceResponse, error)
- func (s *Server) RemoveTask(ctx context.Context, request *api.RemoveTaskRequest) (*api.RemoveTaskResponse, error)
- func (s *Server) UpdateCluster(ctx context.Context, request *api.UpdateClusterRequest) (*api.UpdateClusterResponse, error)
- func (s *Server) UpdateConfig(ctx context.Context, request *api.UpdateConfigRequest) (*api.UpdateConfigResponse, error)
- func (s *Server) UpdateNode(ctx context.Context, request *api.UpdateNodeRequest) (*api.UpdateNodeResponse, error)
- func (s *Server) UpdateResource(ctx context.Context, request *api.UpdateResourceRequest) (*api.UpdateResourceResponse, error)
- func (s *Server) UpdateSecret(ctx context.Context, request *api.UpdateSecretRequest) (*api.UpdateSecretResponse, error)
- func (s *Server) UpdateService(ctx context.Context, request *api.UpdateServiceRequest) (*api.UpdateServiceResponse, error)
Constants ¶
const MaxConfigSize = 500 * 1024 // 500KB
MaxConfigSize is the maximum byte length of the `Config.Spec.Data` field.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the Cluster API gRPC server.
func NewServer ¶
func NewServer(store *store.MemoryStore, raft *raft.Node, securityConfig *ca.SecurityConfig, pg plugingetter.PluginGetter, dr *drivers.DriverProvider) *Server
NewServer creates a Cluster API server.
func (*Server) CreateConfig ¶
func (s *Server) CreateConfig(ctx context.Context, request *api.CreateConfigRequest) (*api.CreateConfigResponse, error)
CreateConfig creates and returns a `CreateConfigResponse` with a `Config` based on the provided `CreateConfigRequest.ConfigSpec`.
- Returns `InvalidArgument` if the `CreateConfigRequest.ConfigSpec` is malformed, or if the config data is too long or contains invalid characters.
- Returns an error if the creation fails.
func (*Server) CreateExtension ¶
func (s *Server) CreateExtension(ctx context.Context, request *api.CreateExtensionRequest) (*api.CreateExtensionResponse, error)
CreateExtension creates an `Extension` based on the provided `CreateExtensionRequest.Extension` and returns a `CreateExtensionResponse`.
- Returns `InvalidArgument` if the `CreateExtensionRequest.Extension` is malformed, or fails validation.
- Returns an error if the creation fails.
func (*Server) CreateNetwork ¶
func (s *Server) CreateNetwork(ctx context.Context, request *api.CreateNetworkRequest) (*api.CreateNetworkResponse, error)
CreateNetwork creates and returns a Network based on the provided NetworkSpec. - Returns `InvalidArgument` if the NetworkSpec is malformed. - Returns an error if the creation fails.
func (*Server) CreateResource ¶
func (s *Server) CreateResource(ctx context.Context, request *api.CreateResourceRequest) (*api.CreateResourceResponse, error)
CreateResource returns a `CreateResourceResponse` after creating a `Resource` based on the provided `CreateResourceRequest.Resource`.
- Returns `InvalidArgument` if the `CreateResourceRequest.Resource` is malformed, or if the config data is too long or contains invalid characters.
- Returns an error if the creation fails.
func (*Server) CreateSecret ¶
func (s *Server) CreateSecret(ctx context.Context, request *api.CreateSecretRequest) (*api.CreateSecretResponse, error)
CreateSecret creates and returns 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 an error if the creation fails.
func (*Server) CreateService ¶
func (s *Server) CreateService(ctx context.Context, request *api.CreateServiceRequest) (*api.CreateServiceResponse, error)
CreateService creates and returns a Service based on the provided ServiceSpec. - Returns `InvalidArgument` if the ServiceSpec is malformed. - Returns `Unimplemented` if the ServiceSpec references unimplemented features. - Returns `AlreadyExists` if the ServiceID conflicts. - Returns an error if the creation fails.
func (*Server) GetCluster ¶
func (s *Server) GetCluster(ctx context.Context, request *api.GetClusterRequest) (*api.GetClusterResponse, error)
GetCluster returns a Cluster given a ClusterID. - Returns `InvalidArgument` if ClusterID is not provided. - Returns `NotFound` if the Cluster is not found.
func (*Server) GetConfig ¶
func (s *Server) GetConfig(ctx context.Context, request *api.GetConfigRequest) (*api.GetConfigResponse, error)
GetConfig returns a `GetConfigResponse` with a `Config` with the same id as `GetConfigRequest.ConfigID` - Returns `NotFound` if the Config with the given id is not found. - Returns `InvalidArgument` if the `GetConfigRequest.ConfigID` is empty. - Returns an error if getting fails.
func (*Server) GetExtension ¶
func (s *Server) GetExtension(ctx context.Context, request *api.GetExtensionRequest) (*api.GetExtensionResponse, error)
GetExtension returns a `GetExtensionResponse` with a `Extension` with the same id as `GetExtensionRequest.extension_id` - Returns `NotFound` if the Extension with the given id is not found. - Returns `InvalidArgument` if the `GetExtensionRequest.extension_id` is empty. - Returns an error if the get fails.
func (*Server) GetNetwork ¶
func (s *Server) GetNetwork(ctx context.Context, request *api.GetNetworkRequest) (*api.GetNetworkResponse, error)
GetNetwork returns a Network given a NetworkID. - Returns `InvalidArgument` if NetworkID is not provided. - Returns `NotFound` if the Network is not found.
func (*Server) GetNode ¶
func (s *Server) GetNode(ctx context.Context, request *api.GetNodeRequest) (*api.GetNodeResponse, error)
GetNode returns a Node given a NodeID. - Returns `InvalidArgument` if NodeID is not provided. - Returns `NotFound` if the Node is not found.
func (*Server) GetResource ¶
func (s *Server) GetResource(ctx context.Context, request *api.GetResourceRequest) (*api.GetResourceResponse, error)
GetResource returns a `GetResourceResponse` with a `Resource` with the same id as `GetResourceRequest.Resource` - Returns `NotFound` if the Resource with the given id is not found. - Returns `InvalidArgument` if the `GetResourceRequest.Resource` is empty. - Returns an error if getting fails.
func (*Server) GetSecret ¶
func (s *Server) GetSecret(ctx context.Context, request *api.GetSecretRequest) (*api.GetSecretResponse, error)
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.
func (*Server) GetService ¶
func (s *Server) GetService(ctx context.Context, request *api.GetServiceRequest) (*api.GetServiceResponse, error)
GetService returns a Service given a ServiceID. - Returns `InvalidArgument` if ServiceID is not provided. - Returns `NotFound` if the Service is not found.
func (*Server) GetTask ¶
func (s *Server) GetTask(ctx context.Context, request *api.GetTaskRequest) (*api.GetTaskResponse, error)
GetTask returns a Task given a TaskID. - Returns `InvalidArgument` if TaskID is not provided. - Returns `NotFound` if the Task is not found.
func (*Server) ListClusters ¶
func (s *Server) ListClusters(ctx context.Context, request *api.ListClustersRequest) (*api.ListClustersResponse, error)
ListClusters returns a list of all clusters.
func (*Server) ListConfigs ¶
func (s *Server) ListConfigs(ctx context.Context, request *api.ListConfigsRequest) (*api.ListConfigsResponse, error)
ListConfigs returns a `ListConfigResponse` with a list all non-internal `Config`s being managed, or all configs matching any name in `ListConfigsRequest.Names`, any name prefix in `ListConfigsRequest.NamePrefixes`, any id in `ListConfigsRequest.ConfigIDs`, or any id prefix in `ListConfigsRequest.IDPrefixes`. - Returns an error if listing fails.
func (*Server) ListNetworks ¶
func (s *Server) ListNetworks(ctx context.Context, request *api.ListNetworksRequest) (*api.ListNetworksResponse, error)
ListNetworks returns a list of all networks.
func (*Server) ListNodes ¶
func (s *Server) ListNodes(ctx context.Context, request *api.ListNodesRequest) (*api.ListNodesResponse, error)
ListNodes returns a list of all nodes.
func (*Server) ListResources ¶
func (s *Server) ListResources(ctx context.Context, request *api.ListResourcesRequest) (*api.ListResourcesResponse, error)
ListResources returns a `ListResourcesResponse` with a list of `Resource`s stored in the raft store, or all resources matching any name in `ListConfigsRequest.Names`, any name prefix in `ListResourcesRequest.NamePrefixes`, any id in `ListResourcesRequest.ResourceIDs`, or any id prefix in `ListResourcesRequest.IDPrefixes`. - Returns an error if listing fails.
func (*Server) ListSecrets ¶
func (s *Server) ListSecrets(ctx context.Context, request *api.ListSecretsRequest) (*api.ListSecretsResponse, error)
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.
func (*Server) ListServices ¶
func (s *Server) ListServices(ctx context.Context, request *api.ListServicesRequest) (*api.ListServicesResponse, error)
ListServices returns a list of all services.
func (*Server) ListTasks ¶
func (s *Server) ListTasks(ctx context.Context, request *api.ListTasksRequest) (*api.ListTasksResponse, error)
ListTasks returns a list of all tasks.
func (*Server) RemoveConfig ¶
func (s *Server) RemoveConfig(ctx context.Context, request *api.RemoveConfigRequest) (*api.RemoveConfigResponse, error)
RemoveConfig removes the config referenced by `RemoveConfigRequest.ID`. - Returns `InvalidArgument` if `RemoveConfigRequest.ID` is empty. - Returns `NotFound` if the a config named `RemoveConfigRequest.ID` is not found. - Returns `ConfigInUse` if the config is currently in use - Returns an error if the deletion fails.
func (*Server) RemoveExtension ¶
func (s *Server) RemoveExtension(ctx context.Context, request *api.RemoveExtensionRequest) (*api.RemoveExtensionResponse, error)
RemoveExtension removes the extension referenced by `RemoveExtensionRequest.ID`. - Returns `InvalidArgument` if `RemoveExtensionRequest.extension_id` is empty. - Returns `NotFound` if the an extension named `RemoveExtensionRequest.extension_id` is not found. - Returns an error if the deletion fails.
func (*Server) RemoveNetwork ¶
func (s *Server) RemoveNetwork(ctx context.Context, request *api.RemoveNetworkRequest) (*api.RemoveNetworkResponse, error)
RemoveNetwork removes a Network referenced by NetworkID. - Returns `InvalidArgument` if NetworkID is not provided. - Returns `NotFound` if the Network is not found. - Returns an error if the deletion fails.
func (*Server) RemoveNode ¶
func (s *Server) RemoveNode(ctx context.Context, request *api.RemoveNodeRequest) (*api.RemoveNodeResponse, error)
RemoveNode removes a Node referenced by NodeID with the given NodeSpec. - Returns NotFound if the Node is not found. - Returns FailedPrecondition if the Node has manager role (and is part of the memberlist) or is not shut down. - Returns InvalidArgument if NodeID or NodeVersion is not valid. - Returns an error if the delete fails.
func (*Server) RemoveResource ¶
func (s *Server) RemoveResource(ctx context.Context, request *api.RemoveResourceRequest) (*api.RemoveResourceResponse, error)
RemoveResource removes the `Resource` referenced by `RemoveResourceRequest.ResourceID`. - Returns `InvalidArgument` if `RemoveResourceRequest.ResourceID` is empty. - Returns `NotFound` if the a resource named `RemoveResourceRequest.ResourceID` is not found. - Returns an error if the deletion fails.
func (*Server) RemoveSecret ¶
func (s *Server) RemoveSecret(ctx context.Context, request *api.RemoveSecretRequest) (*api.RemoveSecretResponse, error)
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 `SecretInUse` if the secret is currently in use - Returns an error if the deletion fails.
func (*Server) RemoveService ¶
func (s *Server) RemoveService(ctx context.Context, request *api.RemoveServiceRequest) (*api.RemoveServiceResponse, error)
RemoveService removes a Service referenced by ServiceID. - Returns `InvalidArgument` if ServiceID is not provided. - Returns `NotFound` if the Service is not found. - Returns an error if the deletion fails.
func (*Server) RemoveTask ¶
func (s *Server) RemoveTask(ctx context.Context, request *api.RemoveTaskRequest) (*api.RemoveTaskResponse, error)
RemoveTask removes a Task referenced by TaskID. - Returns `InvalidArgument` if TaskID is not provided. - Returns `NotFound` if the Task is not found. - Returns an error if the deletion fails.
func (*Server) UpdateCluster ¶
func (s *Server) UpdateCluster(ctx context.Context, request *api.UpdateClusterRequest) (*api.UpdateClusterResponse, error)
UpdateCluster updates a Cluster referenced by ClusterID with the given ClusterSpec. - Returns `NotFound` if the Cluster is not found. - Returns `InvalidArgument` if the ClusterSpec is malformed. - Returns `Unimplemented` if the ClusterSpec references unimplemented features. - Returns an error if the update fails.
func (*Server) UpdateConfig ¶
func (s *Server) UpdateConfig(ctx context.Context, request *api.UpdateConfigRequest) (*api.UpdateConfigResponse, error)
UpdateConfig updates a Config referenced by ConfigID with the given ConfigSpec. - Returns `NotFound` if the Config is not found. - Returns `InvalidArgument` if the ConfigSpec is malformed or anything other than Labels is changed - Returns an error if the update fails.
func (*Server) UpdateNode ¶
func (s *Server) UpdateNode(ctx context.Context, request *api.UpdateNodeRequest) (*api.UpdateNodeResponse, error)
UpdateNode updates a Node referenced by NodeID with the given NodeSpec. - Returns `NotFound` if the Node is not found. - Returns `InvalidArgument` if the NodeSpec is malformed. - Returns an error if the update fails.
func (*Server) UpdateResource ¶
func (s *Server) UpdateResource(ctx context.Context, request *api.UpdateResourceRequest) (*api.UpdateResourceResponse, error)
UpdateResource updates the resource with the given `UpdateResourceRequest.Resource.Id` using the given `UpdateResourceRequest.Resource` and returns a `UpdateResourceResponse`. - Returns `NotFound` if the Resource with the given `UpdateResourceRequest.Resource.Id` is not found. - Returns `InvalidArgument` if the UpdateResourceRequest.Resource.Id` is empty. - Returns an error if updating fails.
func (*Server) UpdateSecret ¶
func (s *Server) UpdateSecret(ctx context.Context, request *api.UpdateSecretRequest) (*api.UpdateSecretResponse, error)
UpdateSecret updates a Secret referenced by SecretID with the given SecretSpec. - Returns `NotFound` if the Secret is not found. - Returns `InvalidArgument` if the SecretSpec is malformed or anything other than Labels is changed - Returns an error if the update fails.
func (*Server) UpdateService ¶
func (s *Server) UpdateService(ctx context.Context, request *api.UpdateServiceRequest) (*api.UpdateServiceResponse, error)
UpdateService updates a Service referenced by ServiceID with the given ServiceSpec. - Returns `NotFound` if the Service is not found. - Returns `InvalidArgument` if the ServiceSpec is malformed. - Returns `Unimplemented` if the ServiceSpec references unimplemented features. - Returns an error if the update fails.