Documentation ¶
Index ¶
- Constants
- func CloudSQLConditionType(state string) corev1alpha1.ConditionType
- func CloudSQLStatusMessage(instanceName string, cloudSQLInstance *sqladmin.DatabaseInstance) string
- func GetGoogleClient(clientset kubernetes.Interface, namespace string, ...) (*http.Client, error)
- func IsErrorAlreadyExists(err error) bool
- func IsErrorBadRequest(err error) bool
- func IsErrorNotFound(err error) bool
- func IsOperationComplete(op *sqladmin.Operation) bool
- func IsOperationSuccessful(op *sqladmin.Operation) bool
- func ProviderCredentials(client kubernetes.Interface, p *gcpv1alpha1.Provider, scopes ...string) (*google.Credentials, error)
- func TestPermissions(creds *google.Credentials, permissions []string) error
- func WaitUntilOperationCompletes(operationID string, provider *gcpv1alpha1.Provider, cloudSQLClient CloudSQLAPI, ...) (*sqladmin.Operation, error)
- type CloudSQLAPI
- type CloudSQLAPIFactory
- type CloudSQLClient
- func (c *CloudSQLClient) CreateInstance(project string, databaseinstance *sqladmin.DatabaseInstance) (*sqladmin.Operation, error)
- func (c *CloudSQLClient) DeleteInstance(project string, instance string) (*sqladmin.Operation, error)
- func (c *CloudSQLClient) GetInstance(project string, instance string) (*sqladmin.DatabaseInstance, error)
- func (c *CloudSQLClient) GetOperation(project string, operationID string) (*sqladmin.Operation, error)
- func (c *CloudSQLClient) ListUsers(project string, instance string) (*sqladmin.UsersListResponse, error)
- func (c *CloudSQLClient) UpdateUser(project string, instance string, name string, user *sqladmin.User) (*sqladmin.Operation, error)
- type CloudSQLClientFactory
- type ProjectInfo
Constants ¶
const DefaultScope = cloudresourcemanager.CloudPlatformScope
DefaultScope is the default scope to use for a GCP client
Variables ¶
This section is empty.
Functions ¶
func CloudSQLConditionType ¶
func CloudSQLConditionType(state string) corev1alpha1.ConditionType
CloudSQLConditionType converts the given CloudSQL state string into a corresponding condition type
func CloudSQLStatusMessage ¶
func CloudSQLStatusMessage(instanceName string, cloudSQLInstance *sqladmin.DatabaseInstance) string
CloudSQLStatusMessage returns a status message based on the state of the given instance
func GetGoogleClient ¶
func GetGoogleClient(clientset kubernetes.Interface, namespace string, secretKey v1.SecretKeySelector, scopes ...string) (*http.Client, error)
GetGoogleClient returns a client object that can be used to interact with the Google API
func IsErrorAlreadyExists ¶
IsErrorAlreadyExists gets a value indicating whether the given error represents a "conflict" response from the Google API
func IsErrorBadRequest ¶
IsErrorBadRequest gets a value indicating whether the given error represents a "bad request" response from the Google API
func IsErrorNotFound ¶
IsErrorNotFound gets a value indicating whether the given error represents a "not found" response from the Google API
func IsOperationComplete ¶
IsOperationComplete returns true if the supplied operation is complete.
func IsOperationSuccessful ¶
IsOperationSuccessful returns true if the supplied operation was successful.
func ProviderCredentials ¶
func ProviderCredentials(client kubernetes.Interface, p *gcpv1alpha1.Provider, scopes ...string) (*google.Credentials, error)
ProviderCredentials return google credentials based on the provider's credentials secret data
func TestPermissions ¶
func TestPermissions(creds *google.Credentials, permissions []string) error
TestPermissions tests service account permission using provided credentials and assert that it has all the provided permissions. - return nil - if all permissions are found - return an error - if one or more expected permissions are not found
func WaitUntilOperationCompletes ¶
func WaitUntilOperationCompletes(operationID string, provider *gcpv1alpha1.Provider, cloudSQLClient CloudSQLAPI, waitTime time.Duration) (*sqladmin.Operation, error)
WaitUntilOperationCompletes waits until the supplied operation is complete, returning an error if it does not complete within the supplied duration.
Types ¶
type CloudSQLAPI ¶
type CloudSQLAPI interface { GetInstance(project string, instance string) (*sqladmin.DatabaseInstance, error) CreateInstance(project string, databaseinstance *sqladmin.DatabaseInstance) (*sqladmin.Operation, error) DeleteInstance(project string, instance string) (*sqladmin.Operation, error) ListUsers(project string, instance string) (*sqladmin.UsersListResponse, error) UpdateUser(project string, instance string, name string, user *sqladmin.User) (*sqladmin.Operation, error) GetOperation(project string, operationID string) (*sqladmin.Operation, error) }
CloudSQLAPI provides an interface for operations on CloudSQL instances
type CloudSQLAPIFactory ¶
type CloudSQLAPIFactory interface {
CreateAPIInstance(kubernetes.Interface, string, v1.SecretKeySelector) (CloudSQLAPI, error)
}
CloudSQLAPIFactory defines an interface for creating instances of the CloudSQLAPI interface.
type CloudSQLClient ¶
CloudSQLClient implements the CloudSQLAPI interface for real CloudSQL instances
func NewCloudSQLClient ¶
func NewCloudSQLClient(clientset kubernetes.Interface, namespace string, secretKey v1.SecretKeySelector) (*CloudSQLClient, error)
NewCloudSQLClient creates a new instance of a CloudSQLClient
func (*CloudSQLClient) CreateInstance ¶
func (c *CloudSQLClient) CreateInstance(project string, databaseinstance *sqladmin.DatabaseInstance) (*sqladmin.Operation, error)
CreateInstance creates the given CloudSQL instance
func (*CloudSQLClient) DeleteInstance ¶
func (c *CloudSQLClient) DeleteInstance(project string, instance string) (*sqladmin.Operation, error)
DeleteInstance deletes the given CloudSQL instance
func (*CloudSQLClient) GetInstance ¶
func (c *CloudSQLClient) GetInstance(project string, instance string) (*sqladmin.DatabaseInstance, error)
GetInstance retrieves details for the requested CloudSQL instance
func (*CloudSQLClient) GetOperation ¶
func (c *CloudSQLClient) GetOperation(project string, operationID string) (*sqladmin.Operation, error)
GetOperation retrieves the latest status for the given operation
func (*CloudSQLClient) ListUsers ¶
func (c *CloudSQLClient) ListUsers(project string, instance string) (*sqladmin.UsersListResponse, error)
ListUsers lists all the users for the given CloudSQL instance
type CloudSQLClientFactory ¶
type CloudSQLClientFactory struct { }
CloudSQLClientFactory will create a real CloudSQL client that talks to GCP
func (*CloudSQLClientFactory) CreateAPIInstance ¶
func (c *CloudSQLClientFactory) CreateAPIInstance(clientset kubernetes.Interface, namespace string, secretKey v1.SecretKeySelector) (CloudSQLAPI, error)
CreateAPIInstance instantiates a real CloudSQL client that talks to GCP
type ProjectInfo ¶
type ProjectInfo struct { // Name: The user-assigned display name of the Project. Name string // ID: The unique, user-assigned ID of the Project. ID string // Number: The number uniquely identifying the project. Number int64 // CreateTime: Project Creation time. CreateTime string // Labels: The labels associated with this Project. Labels map[string]string }
ProjectInfo represent GCP Project information
func Project ¶
func Project(creds *google.Credentials) (*ProjectInfo, error)
Project returns project information