provider

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2025 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AWS_PROVIDER = "AWS"
)

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, opts *ProviderCheckOpts)

Check performs access checks for all providers in the given options. It logs the results and execution statistics.

Types

type AwsClient

type AwsClient struct {
	// contains filtered or unexported fields
}

AwsClient represents an AWS client with configuration and SDK factory. It provides methods to interact with AWS services.

func NewAwsClient

func NewAwsClient(id string, region string, cfg aws.Config, sdk AwsSdkClientFactory) AwsClient

func NewLazyAwsClient

func NewLazyAwsClient(ctx context.Context, id string, region string) (AwsClient, error)

func (*AwsClient) BucketExists

func (c *AwsClient) BucketExists(ctx context.Context, name string) (bool, error)

BucketExists checks if an S3 bucket with the specified name exists. It returns true if the bucket exists, false otherwise, and an error if the operation fails.

func (AwsClient) CheckAccess

func (c AwsClient) CheckAccess(ctx context.Context) ProviderCheckResult

func (AwsClient) CheckConfig

func (c AwsClient) CheckConfig() error

func (AwsClient) CreateBucket

func (c AwsClient) CreateBucket(ctx context.Context, name string, force bool) error

CreateBucket creates an S3 bucket with the specified name. If the bucket already exists and `force` is false, the operation is skipped.

func (*AwsClient) CreateDynamodbTable

func (c *AwsClient) CreateDynamodbTable(ctx context.Context, name string, force bool) error

CreateDynamodbTable creates a DynamoDB table with the specified name. If the table already exists and `force` is false, the operation is skipped.

func (AwsClient) CreateStateBackend

func (c AwsClient) CreateStateBackend(ctx context.Context) error

func (AwsClient) CurrentIdentity

func (c AwsClient) CurrentIdentity(ctx context.Context) (CloudProviderIdentity, error)

func (*AwsClient) DescribeEksCluster

func (c *AwsClient) DescribeEksCluster(ctx context.Context) (*eks.DescribeClusterOutput, error)

DescribeEksCluster describes the EKS cluster associated with the client. It returns the cluster details or an error if the operation fails.

func (*AwsClient) DestroyBucket

func (c *AwsClient) DestroyBucket(ctx context.Context, name string) error

DestroyBucket deletes an S3 bucket with the specified name. The bucket must be empty before it can be deleted.

func (*AwsClient) DestroyDynamodbTable

func (c *AwsClient) DestroyDynamodbTable(ctx context.Context, name string) error

DestroyDynamodbTable deletes a DynamoDB table with the specified name.

func (AwsClient) DestroyStateBackend

func (c AwsClient) DestroyStateBackend(ctx context.Context) error

func (*AwsClient) DynamodbTableExists

func (c *AwsClient) DynamodbTableExists(ctx context.Context, name string, d time.Duration) bool

DynamodbTableExists checks if a DynamoDB table with the specified name exists within the given duration.

func (*AwsClient) EksKubeconfigInfo

func (c *AwsClient) EksKubeconfigInfo(ctx context.Context) (KubeconfigInfo, EksToken, error)

EksKubeconfigInfo retrieves the kubeconfig information for an EKS cluster. It returns the kubeconfig details, an EKS token, and an error if any occurs.

func (AwsClient) KubeconfigInfo

func (c AwsClient) KubeconfigInfo(ctx context.Context) (KubeconfigInfo, error)

func (AwsClient) PrepareAccount

func (c AwsClient) PrepareAccount(ctx context.Context) error

func (AwsClient) PrintClusterInfo

func (c AwsClient) PrintClusterInfo(ctx context.Context) error

func (AwsClient) PrintConfig

func (c AwsClient) PrintConfig()

func (AwsClient) ProviderName

func (c AwsClient) ProviderName() string

ProviderName returns the name of the cloud provider ("AWS").

func (AwsClient) StateBackendInfo

func (c AwsClient) StateBackendInfo(stage string) CloudProviderStateBackend

type AwsProviderCheckResult

type AwsProviderCheckResult struct {
	Identity CloudProviderIdentity
	Error    error
}

func (AwsProviderCheckResult) ToTable

type AwsSdkClientFactory

type AwsSdkClientFactory interface {
	Sts() StsClient
	Iam() IamClient
	Dynamodb() DynamodbClient
	S3() S3Client
	S3Region(region string) S3Client
	Eks() EksClient
	EksTokenGenerator() (token.Generator, error)
}

AwsSdkClientFactory defines the interface for creating AWS SDK clients.

type CloudProviderClient

type CloudProviderClient interface {
	Provider
	// CheckConfig validates the cloud provider configuration.
	CheckConfig() error
	// CurrentIdentity retrieves the current identity of the cloud provider account.
	CurrentIdentity(ctx context.Context) (CloudProviderIdentity, error)
	// StateBackendInfo retrieves information about the state backend for the specified stage.
	StateBackendInfo(stage string) CloudProviderStateBackend
	// CreateStateBackend creates the state backend for the cloud provider.
	CreateStateBackend(ctx context.Context) error
	// DestroyStateBackend destroys the state backend for the cloud provider.
	DestroyStateBackend(ctx context.Context) error
	// KubeconfigInfo retrieves the kubeconfig information for the cloud provider.
	KubeconfigInfo(ctx context.Context) (KubeconfigInfo, error)
	// PrintConfig prints the cloud provider configuration.
	PrintConfig()
	// PrintClusterInfo prints information about the cloud provider's cluster.
	PrintClusterInfo(ctx context.Context) error
	// PrepareAccount prepares the cloud provider account for use.
	PrepareAccount(ctx context.Context) error
}

CloudProviderClient defines the interface for cloud provider clients.

func NewCloudProviderClient

func NewCloudProviderClient(ctx context.Context, cfg schema.QuartzConfig) (CloudProviderClient, error)

NewCloudProviderClient creates a new cloud provider client using the provided Quartz configuration.

func NewCloudProviderClientWithOpts

func NewCloudProviderClientWithOpts(ctx context.Context, o CloudProviderClientOpts) (CloudProviderClient, error)

NewCloudProviderClientWithOpts creates a new cloud provider client using the specified options.

type CloudProviderClientOpts

type CloudProviderClientOpts struct {
	Provider string // The name of the cloud provider (e.g., "aws", "local").
	Name     string // The name of the cloud provider client.
	Region   string // The region for the cloud provider.
	// contains filtered or unexported fields
}

CloudProviderClientOpts contains options for creating a cloud provider client.

type CloudProviderIdentity

type CloudProviderIdentity struct {
	AccountId   string // The account ID of the cloud provider.
	AccountName string // The account name of the cloud provider.
	UserId      string // The user ID of the cloud provider account.
	UserName    string // The user name of the cloud provider account.
}

CloudProviderIdentity represents the identity of a cloud provider account.

type CloudProviderStateBackend

type CloudProviderStateBackend struct {
	Name              string   // The name of the state backend.
	InitBackendConfig []string // The initialization configuration for the state backend.
}

CloudProviderStateBackend represents the state backend configuration for a cloud provider.

type CloudflareAccessCheckResult

type CloudflareAccessCheckResult struct {
	Status   bool                    // Indicates whether the access check was successful.
	Error    error                   // Contains any error encountered during the check.
	Response CloudflareZonesResponse // The response from the Cloudflare API.
}

CloudflareAccessCheckResult represents the result of a Cloudflare access check.

func (CloudflareAccessCheckResult) ToTable

ToTable converts the CloudflareAccessCheckResult into table headers and rows for display.

type CloudflareClient

type CloudflareClient struct {
	// contains filtered or unexported fields
}

CloudflareClient represents a client for interacting with the Cloudflare API.

func NewCloudflareClient

func NewCloudflareClient(httpClient util.HttpClientFactory, providerName string, accountId string, apiToken string, domain string) (CloudflareClient, error)

NewCloudflareClient creates a new CloudflareClient instance. Returns an error if required parameters (accountId, apiToken, or domain) are missing.

func (CloudflareClient) CheckAccess

CheckAccess checks access to the Cloudflare API for the specified domain and account. It verifies the required permissions and returns the result as a CloudflareAccessCheckResult.

func (CloudflareClient) ProviderName

func (c CloudflareClient) ProviderName() string

ProviderName returns the name of the Cloudflare provider.

type CloudflareZonesResponse

type CloudflareZonesResponse struct {
	Success  bool                            // Indicates whether the API call was successful.
	Errors   []string                        // Contains any errors returned by the API.
	Messages []string                        // Contains any messages returned by the API.
	Result   []CloudflareZonesResponseResult // The list of zones returned by the API.
}

CloudflareZonesResponse represents the response from the Cloudflare API for zones.

type CloudflareZonesResponseResult

type CloudflareZonesResponseResult struct {
	Id          string   // The ID of the zone.
	Name        string   // The name of the zone.
	Permissions []string // The permissions associated with the zone.
}

CloudflareZonesResponseResult represents a single zone in the Cloudflare API response.

type DnsProviderClient

type DnsProviderClient interface {
	Provider
}

DnsProviderClient defines the interface for DNS provider clients.

func NewDnsProviderClient

func NewDnsProviderClient(ctx context.Context, cfg schema.QuartzConfig, secrets schema.QuartzSecrets) (DnsProviderClient, error)

NewDnsProviderClient creates a new DNS provider client based on the provided configuration and secrets. If the test mode is enabled, it returns a TestDnsProviderClient. Otherwise, it initializes the appropriate DNS provider client.

type DynamodbClient

type DynamodbClient interface {
	dynamodb.DescribeTableAPIClient
	CreateTable(ctx context.Context, params *dynamodb.CreateTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.CreateTableOutput, error)
	DeleteTable(ctx context.Context, params *dynamodb.DeleteTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DeleteTableOutput, error)
}

DynamodbClient defines the interface for interacting with AWS DynamoDB.

type EksClient

type EksClient interface {
	DescribeCluster(ctx context.Context, params *eks.DescribeClusterInput, optFns ...func(*eks.Options)) (*eks.DescribeClusterOutput, error)
}

EksClient defines the interface for interacting with AWS EKS.

type EksToken

type EksToken struct {
	Token      token.Token // The EKS authentication token.
	JsonString string      // The JSON representation of the token.
}

EksToken represents an EKS authentication token and its JSON representation.

type EmptyProvider

type EmptyProvider struct {
	Name  string // The name of the provider.
	Error error  // The error associated with the provider, if any.
}

EmptyProvider represents a placeholder provider with no functionality.

func NewEmptyProvider

func NewEmptyProvider(name string, err error) EmptyProvider

NewEmptyProvider creates a new instance of EmptyProvider with the specified name and error.

func (EmptyProvider) CheckAccess

func (c EmptyProvider) CheckAccess(ctx context.Context) ProviderCheckResult

CheckAccess performs an access check for the EmptyProvider. It always returns an EmptyProviderCheckResult with the associated error.

func (EmptyProvider) ProviderName

func (c EmptyProvider) ProviderName() string

ProviderName returns the name of the EmptyProvider.

type EmptyProviderCheckResult

type EmptyProviderCheckResult struct {
	Error error // The error associated with the check result, if any.
}

EmptyProviderCheckResult represents the result of a check for an EmptyProvider.

func (EmptyProviderCheckResult) ToTable

ToTable converts the EmptyProviderCheckResult into table headers and rows for display.

type GithubCheckAccessResult

type GithubCheckAccessResult struct {
	Organization string // The organization name.
	Repository   string // The repository name.
	Error        error  // Any error encountered during the access check.

	Name     string // The full name of the repository.
	Pull     bool   // Indicates if the user has pull access.
	Push     bool   // Indicates if the user has push access.
	Triage   bool   // Indicates if the user has triage access.
	Maintain bool   // Indicates if the user has maintain access.
	Admin    bool   // Indicates if the user has admin access.
	Packages bool   // Indicates if the user has access to packages.
}

GithubCheckAccessResult represents the result of a GitHub repository access check.

type GithubClient

type GithubClient struct {
	// contains filtered or unexported fields
}

GithubClient represents a client for interacting with the GitHub API.

func NewGithubClient

func NewGithubClient(httpClient util.HttpClientFactory, providerName string, cfg schema.QuartzConfig, creds schema.GithubCredentials) (GithubClient, error)

NewGithubClient creates a new GitHub client with the specified configuration and credentials. Returns an error if the credentials are missing.

func (GithubClient) CheckAccess

func (c GithubClient) CheckAccess(ctx context.Context) ProviderCheckResult

CheckAccess performs an access check for the GitHub provider. It returns a GithubProviderCheckResult containing the results of the check.

func (GithubClient) CheckGithubRepoAccess

func (c GithubClient) CheckGithubRepoAccess(ctx context.Context) ([]GithubCheckAccessResult, error)

CheckGithubRepoAccess checks access to the configured GitHub repositories. It returns a list of GithubCheckAccessResult and an error if any issues are encountered.

func (GithubClient) ProviderName

func (c GithubClient) ProviderName() string

ProviderName returns the name of the GitHub provider.

func (GithubClient) Repositories

func (c GithubClient) Repositories() []schema.RepositoryConfig

Repositories retrieves the list of repositories configured in the Quartz configuration.

type GithubProviderCheckResult

type GithubProviderCheckResult struct {
	Status  bool                      // Indicates if the check was successful.
	Results []GithubCheckAccessResult // The results of the access checks.
	Error   error                     // Any error encountered during the check.
}

GithubProviderCheckResult represents the result of a GitHub provider check.

func (GithubProviderCheckResult) ToTable

ToTable converts the GithubProviderCheckResult into table headers and rows for display.

type GithubTokenSource

type GithubTokenSource struct {
	AccessToken string // The GitHub access token.
}

GithubTokenSource represents a source for GitHub access tokens.

type IamClient

type IamClient interface {
	ListAccountAliases(ctx context.Context, params *iam.ListAccountAliasesInput, optFns ...func(*iam.Options)) (*iam.ListAccountAliasesOutput, error)
	CreateServiceLinkedRole(ctx context.Context, params *iam.CreateServiceLinkedRoleInput, optFns ...func(*iam.Options)) (*iam.CreateServiceLinkedRoleOutput, error)
}

IamClient defines the interface for interacting with AWS IAM.

type IronbankCheckAccessResult

type IronbankCheckAccessResult struct {
	StatusCode int    // The HTTP status code returned by the Ironbank API.
	Username   string // The username used for the access check.
	Error      error  // Any error encountered during the access check.
}

IronbankCheckAccessResult represents the result of an Ironbank access check.

func (IronbankCheckAccessResult) ToTable

ToTable converts the IronbankCheckAccessResult into table headers and rows for display.

type IronbankClient

type IronbankClient struct {
	// contains filtered or unexported fields
}

IronbankClient represents a client for interacting with the Ironbank API.

func NewIronbankClient

func NewIronbankClient(httpClient util.HttpClientFactory, providerName string, username string, password string) (*IronbankClient, error)

NewIronbankClient creates a new IronbankClient instance with the specified credentials. Returns an error if the username or password is missing.

func (*IronbankClient) CheckAccess

func (c *IronbankClient) CheckAccess(ctx context.Context) ProviderCheckResult

CheckAccess performs an access check against the Ironbank API. It returns an IronbankCheckAccessResult containing the result of the check.

func (*IronbankClient) ProviderName

func (c *IronbankClient) ProviderName() string

ProviderName returns the name of the Ironbank provider.

type KubeconfigInfo

type KubeconfigInfo struct {
	Cluster              string
	Context              string
	User                 string
	Endpoint             string
	CertificateAuthority string
	Token                string
	Expiration           time.Time
}

KubeconfigInfo contains information about the Kubernetes configuration.

func (KubeconfigInfo) Kubeconfig

Kubeconfig converts the KubeconfigInfo to a Kubeconfig structure.

func (KubeconfigInfo) ToKubeconfigYamlBytes

func (kc KubeconfigInfo) ToKubeconfigYamlBytes(cfg quartzSchema.QuartzConfig) []byte

ToKubeconfigYamlBytes converts the KubeconfigInfo to YAML bytes.

type KubernetesApi

type KubernetesApi interface {
	// ClientSet returns a Kubernetes clientset for interacting with core Kubernetes resources.
	ClientSet() (kubernetes.Interface, error)
	// DynamicClient returns a dynamic Kubernetes client for interacting with unstructured resources.
	DynamicClient() (dynamic.Interface, error)
	// DiscoveryClient returns a discovery client for querying API server metadata.
	DiscoveryClient() (discovery.DiscoveryInterface, error)
}

KubernetesApi defines the interface for interacting with Kubernetes APIs.

func NewKubernetesApi

func NewKubernetesApi(ctx context.Context, cfg quartzSchema.QuartzConfig, i *KubeconfigInfo) (KubernetesApi, error)

NewKubernetesApi creates a new KubernetesApi instance using the provided configuration and kubeconfig information. If test mode is enabled, it returns a mock implementation.

type KubernetesApiImpl

type KubernetesApiImpl struct {
	// contains filtered or unexported fields
}

KubernetesApiImpl is an implementation of KubernetesApi using a REST configuration.

func (KubernetesApiImpl) ClientSet

func (api KubernetesApiImpl) ClientSet() (kubernetes.Interface, error)

ClientSet returns a Kubernetes clientset for interacting with core Kubernetes resources.

func (KubernetesApiImpl) DiscoveryClient

func (api KubernetesApiImpl) DiscoveryClient() (discovery.DiscoveryInterface, error)

DiscoveryClient returns a discovery client for querying API server metadata.

func (KubernetesApiImpl) DynamicClient

func (api KubernetesApiImpl) DynamicClient() (dynamic.Interface, error)

DynamicClient returns a dynamic Kubernetes client for interacting with unstructured resources.

type KubernetesApiMock

type KubernetesApiMock struct {
	// contains filtered or unexported fields
}

KubernetesApiMock is a mock implementation of the IKubernetesApi interface for testing purposes.

func NewKubernetesApiMock

func NewKubernetesApiMock() *KubernetesApiMock

NewKubernetesApiMock creates a new instance of KubernetesApiMock with default API resources.

func (*KubernetesApiMock) AddResources

func (api *KubernetesApiMock) AddResources(res ...*metav1.APIResourceList) *KubernetesApiMock

AddResources adds API resources to the mock discovery client.

func (KubernetesApiMock) ClientSet

func (api KubernetesApiMock) ClientSet() (kubernetes.Interface, error)

ClientSet returns a fake Kubernetes clientset populated with the mock client objects.

func (KubernetesApiMock) DiscoveryClient

func (api KubernetesApiMock) DiscoveryClient() (discovery.DiscoveryInterface, error)

DiscoveryClient returns a fake discovery client populated with the mock API resources.

func (KubernetesApiMock) DynamicClient

func (api KubernetesApiMock) DynamicClient() (dynamic.Interface, error)

DynamicClient returns a fake dynamic client populated with the mock dynamic objects.

func (*KubernetesApiMock) WithClientObjects

func (api *KubernetesApiMock) WithClientObjects(objects ...runtime.Object) *KubernetesApiMock

WithClientObjects adds client objects to the mock clientset.

func (*KubernetesApiMock) WithDynamicObjects

func (api *KubernetesApiMock) WithDynamicObjects(objects ...runtime.Object) *KubernetesApiMock

WithDynamicObjects adds dynamic objects to the mock dynamic client.

func (*KubernetesApiMock) WithError

func (api *KubernetesApiMock) WithError(err error) *KubernetesApiMock

WithError sets the error to be returned by the mock API.

type KubernetesAppConnectionInfo

type KubernetesAppConnectionInfo struct {
	Name           string
	PublicEndpoint string
	AdminUsername  string
	AdminPassword  string
	Error          error
}

KubernetesAppConnectionInfo contains information about an application's connection in Kubernetes.

type KubernetesClient

type KubernetesClient struct {
	// contains filtered or unexported fields
}

KubernetesClient is the implementation of the Kubernetes provider client.

func NewKubernetesClient

func NewKubernetesClient(api KubernetesApi, kubeconfig KubeconfigInfo, cfg quartzSchema.QuartzConfig) (KubernetesClient, error)

NewKubernetesClient creates a new KubernetesClient instance.

func (KubernetesClient) CheckAccess

CheckAccess checks access to the Kubernetes cluster.

func (KubernetesClient) EnsureKubeconfig

func (c KubernetesClient) EnsureKubeconfig(path string) error

EnsureKubeconfig ensures that the kubeconfig file exists at the specified path.

func (KubernetesClient) Export

Export exports Kubernetes resources based on the provided configuration.

func (KubernetesClient) ForEachDynamicResources

func (c KubernetesClient) ForEachDynamicResources(ctx context.Context, kind schema.GroupVersionResource, ns string, onEachItem func(unstructured.Unstructured)) error

ForEachDynamicResources iterates over all dynamic resources of a specific kind and namespace.

func (KubernetesClient) GetAppConnectionInfo

GetAppConnectionInfo retrieves connection information for an application.

func (KubernetesClient) GetConfigMapValue

func (c KubernetesClient) GetConfigMapValue(ctx context.Context, ns string, name string) (map[string]string, error)

GetConfigMapValue retrieves the key-value pairs from a ConfigMap.

func (KubernetesClient) GetDynamicResource

func (c KubernetesClient) GetDynamicResource(ctx context.Context, kind schema.GroupVersionResource, ns string, name string) (map[string]interface{}, error)

GetDynamicResource retrieves a dynamic resource from the cluster.

func (KubernetesClient) GetSecret

func (c KubernetesClient) GetSecret(ctx context.Context, ns string, name string) (*corev1.Secret, error)

GetSecret retrieves a Secret from the cluster.

func (KubernetesClient) GetSecretValue

func (c KubernetesClient) GetSecretValue(ctx context.Context, ns string, name string) (map[string]string, error)

GetSecretValue retrieves the key-value pairs from a Secret.

func (KubernetesClient) LookupKind

LookupKind looks up the GroupVersionResource for a given kind.

func (KubernetesClient) PrintClusterAppInfo

func (c KubernetesClient) PrintClusterAppInfo(ctx context.Context, apps map[string]quartzSchema.ApplicationLookupConfig)

PrintClusterAppInfo prints detailed information about the specified applications in the cluster.

func (KubernetesClient) PrintClusterInfo

func (c KubernetesClient) PrintClusterInfo(ctx context.Context)

PrintClusterInfo prints information about the cluster and its applications.

func (KubernetesClient) ProviderName

func (c KubernetesClient) ProviderName() string

ProviderName returns the name of the provider.

func (KubernetesClient) RefreshExternalSecrets

func (c KubernetesClient) RefreshExternalSecrets(ctx context.Context) ([]KubernetesResource, error)

RefreshExternalSecrets triggers a refresh of external secrets in the cluster.

func (KubernetesClient) Restart

Restart restarts resources of a specific kind in the cluster.

func (KubernetesClient) Update

Update updates a dynamic resource in the cluster.

func (KubernetesClient) WaitConditionState

func (c KubernetesClient) WaitConditionState(ctx context.Context, kind schema.GroupVersionResource, ns string, name string, state string, timeoutSeconds int) error

WaitConditionState waits for a resource to reach a specific condition state.

func (KubernetesClient) WriteKubeconfig

func (c KubernetesClient) WriteKubeconfig(w io.Writer) error

WriteKubeconfig writes the kubeconfig to the provided writer.

func (KubernetesClient) WriteKubeconfigFile

func (c KubernetesClient) WriteKubeconfigFile(path string) error

WriteKubeconfigFile writes the kubeconfig to the specified file path.

type KubernetesLookupCache

type KubernetesLookupCache struct {
	// contains filtered or unexported fields
}

KubernetesLookupCache is a cache for Kubernetes resource kinds.

type KubernetesProviderCheckResult

type KubernetesProviderCheckResult struct {
	Status bool
	Error  error
	// contains filtered or unexported fields
}

func (KubernetesProviderCheckResult) ToTable

ToTable converts the KubernetesProviderCheckResult into table headers and rows for display.

type KubernetesProviderClient

type KubernetesProviderClient interface {
	Provider
	LookupKind(ctx context.Context, kind string) (schema.GroupVersionResource, error)
	WaitConditionState(ctx context.Context, kind schema.GroupVersionResource, ns string, name string, state string, timeoutSeconds int) error
	PrintClusterInfo(ctx context.Context)
	WriteKubeconfigFile(path string) error
	RefreshExternalSecrets(ctx context.Context) ([]KubernetesResource, error)
	Export(ctx context.Context, cfg quartzSchema.ExportConfig) (map[string][]byte, error)
	GetConfigMapValue(ctx context.Context, ns string, name string) (map[string]string, error)
	GetSecretValue(ctx context.Context, ns string, name string) (map[string]string, error)
	Restart(ctx context.Context, kind schema.GroupVersionResource, ns string, name string) error
}

KubernetesProviderClient defines the interface for Kubernetes provider clients.

type KubernetesResource

type KubernetesResource struct {
	Name      string
	Namespace string
	Kind      schema.GroupVersionResource
	Item      unstructured.Unstructured
}

KubernetesResource represents a Kubernetes resource.

type LazyAwsSdkClient

type LazyAwsSdkClient struct {
	// contains filtered or unexported fields
}

LazyAwsSdkClient is a lazy-loading implementation of AWS SDK clients. It initializes clients only when they are accessed.

func (*LazyAwsSdkClient) Dynamodb

func (c *LazyAwsSdkClient) Dynamodb() DynamodbClient

Dynamodb returns a lazily initialized DynamoDB client.

func (*LazyAwsSdkClient) Eks

func (c *LazyAwsSdkClient) Eks() EksClient

Eks returns a lazily initialized EKS client.

func (*LazyAwsSdkClient) EksTokenGenerator

func (c *LazyAwsSdkClient) EksTokenGenerator() (token.Generator, error)

EksTokenGenerator returns a new EKS token generator.

func (*LazyAwsSdkClient) Iam

func (c *LazyAwsSdkClient) Iam() IamClient

Iam returns a lazily initialized IAM client.

func (*LazyAwsSdkClient) S3

func (c *LazyAwsSdkClient) S3() S3Client

S3 returns a lazily initialized S3 client.

func (*LazyAwsSdkClient) S3Region

func (c *LazyAwsSdkClient) S3Region(region string) S3Client

S3Region returns an S3 client configured for the specified region.

func (*LazyAwsSdkClient) Sts

func (c *LazyAwsSdkClient) Sts() StsClient

Sts returns a lazily initialized STS client.

type LocalClient

type LocalClient struct {
	Name string // The name of the local cluster.
}

LocalClient represents a local provider client.

func (LocalClient) CheckAccess

func (c LocalClient) CheckAccess(ctx context.Context) ProviderCheckResult

CheckAccess performs an access check for the local provider. Always returns an EmptyProviderCheckResult as no access check is required.

func (LocalClient) CheckConfig

func (c LocalClient) CheckConfig() error

CheckConfig validates the configuration for the local provider. Always returns nil as no validation is required for the local provider.

func (LocalClient) CreateStateBackend

func (c LocalClient) CreateStateBackend(_ context.Context) error

CreateStateBackend skips the creation of a state backend for the local provider. Logs a message indicating that the operation is skipped.

func (LocalClient) CurrentIdentity

func (c LocalClient) CurrentIdentity(ctx context.Context) (CloudProviderIdentity, error)

CurrentIdentity returns the identity of the local provider. Always returns a static identity for the local provider.

func (LocalClient) DestroyStateBackend

func (c LocalClient) DestroyStateBackend(_ context.Context) error

DestroyStateBackend skips the destruction of a state backend for the local provider. Logs a message indicating that the operation is skipped.

func (LocalClient) KubeconfigInfo

func (c LocalClient) KubeconfigInfo(ctx context.Context) (KubeconfigInfo, error)

KubeconfigInfo returns an error as kubeconfig information is not supported for the local provider.

func (LocalClient) PrepareAccount

func (c LocalClient) PrepareAccount(ctx context.Context) error

PrepareAccount performs no operation for the local provider. Always returns nil as no account preparation is required.

func (LocalClient) PrintClusterInfo

func (c LocalClient) PrintClusterInfo(ctx context.Context) error

PrintClusterInfo performs no operation for the local provider. Always returns nil as no cluster information is available.

func (LocalClient) PrintConfig

func (c LocalClient) PrintConfig()

PrintConfig prints the configuration of the local provider. Displays the name of the local cluster in a table format.

func (LocalClient) ProviderName

func (c LocalClient) ProviderName() string

ProviderName returns the name of the provider.

func (LocalClient) StateBackendInfo

func (c LocalClient) StateBackendInfo(_ string) CloudProviderStateBackend

StateBackendInfo returns the state backend information for the local provider. Always returns a static state backend configuration.

type Provider

type Provider interface {
	// ProviderName returns the name of the provider.
	ProviderName() string
	// CheckAccess performs an access check for the provider.
	CheckAccess(context.Context) ProviderCheckResult
}

Provider defines the interface for all providers.

func NewImageRegistryProviderClient

func NewImageRegistryProviderClient(ctx context.Context, cfg schema.QuartzConfig, secrets schema.QuartzSecrets) (Provider, error)

NewImageRegistryProviderClient creates a new image registry provider client based on the configuration and secrets. If image repository mirroring is disabled, it initializes an Ironbank client. Otherwise, it initializes a GitHub client.

func NewSourceControlProviderClient

func NewSourceControlProviderClient(ctx context.Context, cfg schema.QuartzConfig, secrets schema.QuartzSecrets) (Provider, error)

NewSourceControlProviderClient creates a new source control provider client.

type ProviderCheckOpts

type ProviderCheckOpts struct {
	// contains filtered or unexported fields
}

ProviderCheckOpts contains options for performing provider checks.

func NewProviderCheckOpts

func NewProviderCheckOpts(ctx context.Context, f ProviderFactory) ProviderCheckOpts

NewProviderCheckOpts creates a new ProviderCheckOpts instance. It initializes the list of providers to check by iterating over the provided factory.

type ProviderCheckResult

type ProviderCheckResult interface {
	// ToTable converts the check result into table headers and rows.
	ToTable() ([]string, []ProviderCheckResultRow)
}

IProviderCheckResult defines the interface for provider check results.

type ProviderCheckResultRow

type ProviderCheckResultRow struct {
	Status bool     // Status indicates whether the check was successful.
	Data   []string // Data contains the row's data fields.
	Error  error    // Error contains any error associated with the row.
}

ProviderCheckResultRow represents a single row in the provider check result table.

type ProviderFactory

type ProviderFactory struct {
	// contains filtered or unexported fields
}

ProviderFactory is responsible for creating and managing provider clients.

func NewProviderFactory

func NewProviderFactory(cfg schema.QuartzConfig, secrets schema.QuartzSecrets, opts ...ProviderFactoryOption) *ProviderFactory

NewProviderFactory creates a new ProviderFactory with the given configuration and secrets.

func (*ProviderFactory) Cloud

Cloud returns the cloud provider client, initializing it if necessary.

func (*ProviderFactory) Dns

Dns returns the DNS provider client, initializing it if necessary.

func (*ProviderFactory) ImageRegistry

func (f *ProviderFactory) ImageRegistry(ctx context.Context) (Provider, error)

ImageRegistry returns the image registry provider client, initializing it if necessary.

func (*ProviderFactory) Kubernetes

Kubernetes returns the Kubernetes provider client, initializing it if necessary.

func (*ProviderFactory) SourceControl

func (f *ProviderFactory) SourceControl(ctx context.Context) (Provider, error)

SourceControl returns the source control provider client, initializing it if necessary.

type ProviderFactoryOption

type ProviderFactoryOption func(*ProviderFactory)

func WithCloudProvider

func WithCloudProvider(p CloudProviderClient) ProviderFactoryOption

WithCloudProvider sets the cloud provider client and returns the updated factory.

func WithConfig

WithConfig sets the Quartz configuration and returns the updated factory.

func WithDnsProvider

func WithDnsProvider(p DnsProviderClient) ProviderFactoryOption

WithDnsProvider sets the DNS provider client and returns the updated factory.

func WithImageRegistryProvider

func WithImageRegistryProvider(p Provider) ProviderFactoryOption

WithImageRegistryProvider sets the image registry provider client and returns the updated factory.

func WithKubernetesProvider

func WithKubernetesProvider(p KubernetesProviderClient) ProviderFactoryOption

WithKubernetesProvider sets the Kubernetes provider client and returns the updated factory.

func WithSecrets

WithSecrets sets the Quartz secrets and returns the updated factory.

func WithSourceControlProvider

func WithSourceControlProvider(p Provider) ProviderFactoryOption

WithSourceControlProvider sets the source control provider client and returns the updated factory.

type S3Client

type S3Client interface {
	HeadBucket(ctx context.Context, params *s3.HeadBucketInput, optFns ...func(*s3.Options)) (*s3.HeadBucketOutput, error)
	CreateBucket(ctx context.Context, params *s3.CreateBucketInput, optFns ...func(*s3.Options)) (*s3.CreateBucketOutput, error)
	DeleteBucket(ctx context.Context, params *s3.DeleteBucketInput, optFns ...func(*s3.Options)) (*s3.DeleteBucketOutput, error)
	ListObjectVersions(ctx context.Context, params *s3.ListObjectVersionsInput, optFns ...func(*s3.Options)) (*s3.ListObjectVersionsOutput, error)
	DeleteObjects(ctx context.Context, params *s3.DeleteObjectsInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectsOutput, error)
}

S3Client defines the interface for interacting with AWS S3.

type StsClient

type StsClient interface {
	GetCallerIdentity(ctx context.Context, params *sts.GetCallerIdentityInput, optFns ...func(*sts.Options)) (*sts.GetCallerIdentityOutput, error)
}

StsClient defines the interface for interacting with AWS STS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL