atlas

package
v2.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Error codes that Atlas may return that we are concerned about
	GroupExistsAPIErrorCode = "GROUP_ALREADY_EXISTS"

	// The error that Atlas API returns if the GET request is sent to read the project that either doesn't exist
	// or the user doesn't have permissions for
	NotInGroup = "NOT_IN_GROUP"

	// Error indicates that the project is being removed while it still has clusters
	CannotCloseGroupActiveAtlasDeployment = "CANNOT_CLOSE_GROUP_ACTIVE_ATLAS_CLUSTERS"

	// Error indicates that the database user doesn't exist
	UsernameNotFound = "USERNAME_NOT_FOUND"

	// Error indicates that the database user doesn't exist
	UserNotfound = "USER_NOT_FOUND"

	// Error indicates that the cluster doesn't exist
	ClusterNotFound = "CLUSTER_NOT_FOUND"

	// ServerlessClusterNotFound indicates that the serverless cluster doesn't exist
	ServerlessInstanceNotFound = "SERVERLESS_INSTANCE_NOT_FOUND"

	// ServerlessClusterFromClusterAPI indicates that we are trying to access
	// a serverless instance from the cluster API, which is not allowed
	ServerlessInstanceFromClusterAPI = "CANNOT_USE_SERVERLESS_INSTANCE_IN_CLUSTER_API"

	ClusterInstanceFromServerlessAPI = "CANNOT_USE_CLUSTER_IN_SERVERLESS_INSTANCE_API"

	// Resource not found
	ResourceNotFound = "RESOURCE_NOT_FOUND"

	// Instance for the passed {groupId, tenantName} pair does not exist
	DataFederationTenantNotFound = "DATA_FEDERATION_TENANT_NOT_FOUND_FOR_NAME"

	// Backup Compliance Policy rejected, as there are existing backup policies which do not meet the requirements
	BackupComplianceNotMet = "BACKUP_POLICIES_NOT_MEETING_BACKUP_COMPLIANCE_POLICY_REQUIREMENTS"

	ProviderUnsupported = "PROVIDER_UNSUPPORTED"

	// Cannot use the Flex API to interact with non-Flex clusters
	NonFlexInFlexAPI = "CANNOT_USE_NON_FLEX_CLUSTER_IN_FLEX_API"

	FeatureUnsupported = "FEATURE_UNSUPPORTED"
)

Variables

This section is empty.

Functions

func NewClient

func NewClient(domain, publicKey, privateKey string) (*admin.APIClient, error)

Types

type APIKeys added in v2.8.1

type APIKeys struct {
	PublicKey  string
	PrivateKey string
}

APIKeys is the type that holds Public/Private API keys to authenticate against the Atlas API.

type ClientSet

type ClientSet struct {
	SdkClient20231115008 *adminv20231115008.APIClient
	SdkClient20241113001 *adminv20241113001.APIClient
}

type ConnectionConfig added in v2.8.1

type ConnectionConfig struct {
	OrgID       string
	Credentials *Credentials
}

ConnectionConfig is the type that contains connection configuration to Atlas, including credentials.

type Credentials added in v2.8.1

type Credentials struct {
	APIKeys *APIKeys
}

Credentials is the type that holds credentials to authenticate against the Atlas API. Currently, only API keys are support but more credential types could be added, see https://www.mongodb.com/docs/atlas/configure-api-access/.

type ProductionProvider

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

func NewProductionProvider

func NewProductionProvider(atlasDomain string, dryRun bool) *ProductionProvider

func (*ProductionProvider) Client

func (*ProductionProvider) IsCloudGov

func (p *ProductionProvider) IsCloudGov() bool

func (*ProductionProvider) IsResourceSupported

func (p *ProductionProvider) IsResourceSupported(resource api.AtlasCustomResource) bool

func (*ProductionProvider) SdkClientSet

func (p *ProductionProvider) SdkClientSet(ctx context.Context, creds *Credentials, log *zap.SugaredLogger) (*ClientSet, error)

type Provider

type Provider interface {
	Client(ctx context.Context, creds *Credentials, log *zap.SugaredLogger) (*mongodbatlas.Client, error)
	SdkClientSet(ctx context.Context, creds *Credentials, log *zap.SugaredLogger) (*ClientSet, error)
	IsCloudGov() bool
	IsResourceSupported(resource api.AtlasCustomResource) bool
}

Jump to

Keyboard shortcuts

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