Documentation ¶
Index ¶
- Constants
- func DefaultListOptions(pageNum int) *mongodbatlas.ListOptions
- func NewClient(domain, publicKey, privateKey string) (*admin.APIClient, error)
- func TraversePages(reader PageReader, predicate PageItemPredicate) error
- type PageItemPredicate
- type PageReader
- type Paginated
- type ProductionProvider
- func (p *ProductionProvider) Client(ctx context.Context, secretRef *client.ObjectKey, log *zap.SugaredLogger) (*mongodbatlas.Client, string, error)
- func (p *ProductionProvider) IsCloudGov() bool
- func (p *ProductionProvider) IsResourceSupported(resource api.AtlasCustomResource) bool
- func (p *ProductionProvider) SdkClient(ctx context.Context, secretRef *client.ObjectKey, log *zap.SugaredLogger) (*admin.APIClient, string, error)
- type Provider
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" // 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" )
Variables ¶
This section is empty.
Functions ¶
func DefaultListOptions ¶
func DefaultListOptions(pageNum int) *mongodbatlas.ListOptions
func TraversePages ¶
func TraversePages(reader PageReader, predicate PageItemPredicate) error
TraversePages reads page after page using 'reader' and applies the 'predicate' for each item on the page. Stops traversal when the 'predicate' returns true.
Types ¶
type PageItemPredicate ¶
type PageItemPredicate func(entity interface{}) bool
PageItemPredicate is the function that processes single item on the page and returns true if no further processing needs to be done (usually it's the search logic)
type PageReader ¶
PageReader is the function that reads a single page by its number
type Paginated ¶
type Paginated interface { // HasNext returns if there are more pages HasNext() bool // Results returns the list of entities on a single page Results() []interface{} }
Paginated is the general interface for a single page returned by Atlas api.
func NewAtlasPaginated ¶
func NewAtlasPaginated(response *mongodbatlas.Response, entities interface{}) Paginated
type ProductionProvider ¶ added in v2.1.0
type ProductionProvider struct {
// contains filtered or unexported fields
}
func NewProductionProvider ¶ added in v2.1.0
func (*ProductionProvider) Client ¶ added in v2.1.0
func (p *ProductionProvider) Client(ctx context.Context, secretRef *client.ObjectKey, log *zap.SugaredLogger) (*mongodbatlas.Client, string, error)
func (*ProductionProvider) IsCloudGov ¶ added in v2.1.0
func (p *ProductionProvider) IsCloudGov() bool
func (*ProductionProvider) IsResourceSupported ¶ added in v2.1.0
func (p *ProductionProvider) IsResourceSupported(resource api.AtlasCustomResource) bool
type Provider ¶ added in v2.1.0
type Provider interface { Client(ctx context.Context, secretRef *client.ObjectKey, log *zap.SugaredLogger) (*mongodbatlas.Client, string, error) SdkClient(ctx context.Context, secretRef *client.ObjectKey, log *zap.SugaredLogger) (*admin.APIClient, string, error) IsCloudGov() bool IsResourceSupported(resource api.AtlasCustomResource) bool }
Click to show internal directories.
Click to hide internal directories.