Documentation ¶
Index ¶
- Constants
- func Migrate(db *gorm.DB, logger logrus.FieldLogger) error
- func NewNetworkService(region string, secret *secret.SecretItemResponse, logger logrus.FieldLogger) (network.Service, error)
- type ClientFactory
- type GKEClusterModel
- func (m *GKEClusterModel) AfterDelete(tx *gorm.DB) error
- func (m *GKEClusterModel) AfterUpdate(scope *gorm.Scope) error
- func (m *GKEClusterModel) BeforeCreate() error
- func (m *GKEClusterModel) BeforeDelete(tx *gorm.DB) error
- func (m GKEClusterModel) String() string
- func (GKEClusterModel) TableName() string
- type GKENodePoolModel
- type ObjectStore
- func (s *ObjectStore) CheckBucket(bucketName string) error
- func (s *ObjectStore) CreateBucket(bucketName string) error
- func (s *ObjectStore) DeleteBucket(bucketName string) error
- func (s *ObjectStore) ListBuckets() ([]*objectstore.BucketInfo, error)
- func (s *ObjectStore) ListManagedBuckets() ([]*objectstore.BucketInfo, error)
- type ObjectStoreBucketModel
- type Secret
- type SecretStore
Constants ¶
const (
ClusterDistributionGKE = "gke"
)
const Provider = google.Provider
Variables ¶
This section is empty.
Functions ¶
func Migrate ¶
func Migrate(db *gorm.DB, logger logrus.FieldLogger) error
Migrate executes the table migrations for the provider.
func NewNetworkService ¶
func NewNetworkService(region string, secret *secret.SecretItemResponse, logger logrus.FieldLogger) (network.Service, error)
NewNetworkService returns a new Google network Service
Types ¶
type ClientFactory ¶
type ClientFactory struct {
// contains filtered or unexported fields
}
ClientFactory creates a new HTTP client for Google API communication.
func NewClientFactory ¶
func NewClientFactory(secretStore SecretStore) ClientFactory
NewClientFactory creates a new ClientFactory.
func (ClientFactory) CreateClient ¶
CreateClient creates a new HTTP client for Google API communication.
func (ClientFactory) CreateClientWithScopes ¶
func (c ClientFactory) CreateClientWithScopes(ctx context.Context, secretID string, scopes ...string) (*http.Client, error)
CreateClientWithScopes creates a new HTTP client for Google API communication.
type GKEClusterModel ¶
type GKEClusterModel struct { ID uint `gorm:"primary_key"` Cluster clustermodel.ClusterModel `gorm:"foreignkey:ClusterID"` ClusterID uint `gorm:"unique_index:idx_gke_cluster_id"` MasterVersion string NodeVersion string Region string NodePools []*GKENodePoolModel `gorm:"foreignkey:ClusterID;association_foreignkey:ClusterID"` ProjectId string Vpc string `gorm:"size:64"` Subnet string `gorm:"size:64"` }
GKEClusterModel is the schema for the DB.
func (*GKEClusterModel) AfterDelete ¶
func (m *GKEClusterModel) AfterDelete(tx *gorm.DB) error
AfterDelete deletes Cluster that belongs to GKEClusterModel
func (*GKEClusterModel) AfterUpdate ¶
func (m *GKEClusterModel) AfterUpdate(scope *gorm.Scope) error
AfterUpdate removes node pool(s) marked for deletion.
func (*GKEClusterModel) BeforeCreate ¶
func (m *GKEClusterModel) BeforeCreate() error
BeforeCreate sets some initial values for the cluster.
func (*GKEClusterModel) BeforeDelete ¶
func (m *GKEClusterModel) BeforeDelete(tx *gorm.DB) error
BeforeDelete deletes all nodepools that belongs to GKEClusterModel
func (GKEClusterModel) String ¶
func (m GKEClusterModel) String() string
func (GKEClusterModel) TableName ¶
func (GKEClusterModel) TableName() string
TableName changes the default table name.
type GKENodePoolModel ¶
type GKENodePoolModel struct { ID uint `gorm:"primary_key"` CreatedAt time.Time CreatedBy uint ClusterID uint `gorm:"unique_index:idx_gke_np_cluster_id_name"` Name string `gorm:"unique_index:idx_gke_np_cluster_id_name"` Autoscaling bool `gorm:"default:false"` Preemptible bool `gorm:"default:false"` NodeMinCount int NodeMaxCount int NodeCount int NodeInstanceType string Labels map[string]string `gorm:"-"` Delete bool `gorm:"-"` }
GKENodePoolModel is the schema for the DB.
func (*GKENodePoolModel) BeforeDelete ¶
func (m *GKENodePoolModel) BeforeDelete(tx *gorm.DB) error
BeforeDelete deletes all nodepoollabels that belongs to GKENodePoolModel
func (GKENodePoolModel) String ¶
func (m GKENodePoolModel) String() string
func (GKENodePoolModel) TableName ¶
func (GKENodePoolModel) TableName() string
TableName changes the default table name.
type ObjectStore ¶
type ObjectStore struct {
// contains filtered or unexported fields
}
ObjectStore stores all required parameters for bucket creation.
func NewObjectStore ¶
func NewObjectStore( org *auth.Organization, secret *secret.SecretItemResponse, location string, db *gorm.DB, logger logrus.FieldLogger, force bool, ) (*ObjectStore, error)
NewObjectStore returns a new object store instance.
func (*ObjectStore) CheckBucket ¶
func (s *ObjectStore) CheckBucket(bucketName string) error
CheckBucket checks the status of the given Google bucket.
func (*ObjectStore) CreateBucket ¶
func (s *ObjectStore) CreateBucket(bucketName string) error
CreateBucket creates a Google Bucket with the provided name and location.
func (*ObjectStore) DeleteBucket ¶
func (s *ObjectStore) DeleteBucket(bucketName string) error
DeleteBucket deletes the GS bucket identified by the specified name provided the storage container is of 'managed' type.
func (*ObjectStore) ListBuckets ¶
func (s *ObjectStore) ListBuckets() ([]*objectstore.BucketInfo, error)
ListBuckets returns a list of GS buckets that can be accessed with the credentials referenced by the secret field. GS buckets that were created by a user in the current org are marked as 'managed`
func (*ObjectStore) ListManagedBuckets ¶
func (s *ObjectStore) ListManagedBuckets() ([]*objectstore.BucketInfo, error)
type ObjectStoreBucketModel ¶
type ObjectStoreBucketModel struct { ID uint `gorm:"primary_key"` Organization auth.Organization `gorm:"foreignkey:OrganizationID"` OrganizationID uint `gorm:"index;not null"` Name string `gorm:"unique_index:idx_google_bucket_name"` Location string SecretRef string Status string StatusMsg string `sql:"type:text;"` }
ObjectStoreBucketModel is the schema for the DB.
func (ObjectStoreBucketModel) TableName ¶
func (ObjectStoreBucketModel) TableName() string
TableName changes the default table name.
type Secret ¶
type Secret struct { Type string `json:"type"` ProjectId string `json:"project_id"` PrivateKeyId string `json:"private_key_id"` PrivateKey string `json:"private_key"` ClientEmail string `json:"client_email"` ClientId string `json:"client_id"` AuthUri string `json:"auth_uri"` TokenUri string `json:"token_uri"` AuthProviderX50CertUrl string `json:"auth_provider_x509_cert_url"` ClientX509CertUrl string `json:"client_x509_cert_url"` }
Secret describes a Google service account.
type SecretStore ¶
type SecretStore interface { // GetSecret returns a secret. GetSecret(ctx context.Context, secretID string) (Secret, error) // GetRawSecret returns the raw values of a secret. GetRawSecret(ctx context.Context, secretID string) (map[string]string, error) }
SecretStore stores Google type secrets.