mongodbatlas

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CaCentral1 represents the CA_CENTRAL_1 America region for AWS Configuration
	CaCentral1 = "CA_CENTRAL_1"
	// UsEast1 represents the US_EAST_1 America region for AWS Configuration
	UsEast1 = "US_EAST_1"
	// UsEast2 represents the US_EAST_2 America region for AWS Configuration
	UsEast2 = "US_EAST_2"
	// UsWest1 represents the US_WEST_1 America region for AWS Configuration
	UsWest1 = "US_WEST_1"
	// UsWest2 represents the US_WEST_2 America region for AWS Configuration
	UsWest2 = "US_WEST_2"
	// SaEast1 represents the SA_EAST_1 America region for AWS Configuration
	SaEast1 = "SA_EAST_1"

	// ApNortheast1 represents the AP_NORTHEAST_1 Asia region for AWS Configuration
	ApNortheast1 = "AP_NORTHEAST_1"
	// ApNortheast2 represents the AP_NORTHEAST_2 Asia region for AWS Configuration
	ApNortheast2 = "AP_NORTHEAST_2"
	// ApSouth1 represents the AP_SOUTH_1 Asia region for AWS Configuration
	ApSouth1 = "AP_SOUTH_1"
	// ApSoutheast1 represents the AP_SOUTHEAST_1 Asia region for AWS Configuration
	ApSoutheast1 = "AP_SOUTHEAST_1"
	// ApSoutheast2 represents the AP_SOUTHEAST_2 Asia region for AWS Configuration
	ApSoutheast2 = "AP_SOUTHEAST_2"

	// EuCentral1 represents the EU_CENTRAL_1 Europe region for AWS Configuration
	EuCentral1 = "EU_CENTRAL_1"
	// EuWest1 represents the EU_WEST_1 Europe region for AWS Configuration
	EuWest1 = "EU_WEST_1"
	// EuWest2 represents the EU_WEST_2 Europe region for AWS Configuration
	EuWest2 = "EU_WEST_2"
	// EuWest3 represents the EU_WEST_3 Europe region for AWS Configuration
	EuWest3 = "EU_WEST_3"

	// Azure represents `AZURE` where the Azure account credencials reside
	Azure = "AZURE"
	// AzureChina represents `AZURE_CHINA` AZURE where the Azure account credencials reside
	AzureChina = "AZURE_CHINA"
	// AzureGermany represents `AZURE_GERMANY` AZURE where the Azure account credencials reside
	AzureGermany = "AZURE_GERMANY"
)
View Source
const (
	GROUP_OWNER                  = "GROUP_OWNER"                  //GROUP_OWNER - Project Owner
	GROUP_READ_ONLY              = "GROUP_READ_ONLY"              //GROUP_READ_ONLY - Project Read Only
	GROUP_DATA_ACCESS_ADMIN      = "GROUP_DATA_ACCESS_ADMIN"      //GROUP_DATA_ACCESS_ADMIN - Project Data Access Admin
	GROUP_DATA_ACCESS_READ_WRITE = "GROUP_DATA_ACCESS_READ_WRITE" //GROUP_DATA_ACCESS_READ_WRITE - Project Data Access Read/Write
	GROUP_DATA_ACCESS_READ_ONLY  = "GROUP_DATA_ACCESS_READ_ONLY"  //GROUP_DATA_ACCESS_READ_ONLY - Project Data Access Read Only

)

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.

func DoRequestWithClient

func DoRequestWithClient(
	ctx context.Context,
	client *http.Client,
	req *http.Request) (*http.Response, error)

DoRequestWithClient submits an HTTP request using the specified client.

Types

type APIKey

type APIKey struct {
	ID         string       `json:"id,omitempty"`
	Desc       string       `json:"desc,omitempty"`
	Roles      []APIKeyRole `json:"roles,omitempty"`
	PrivateKey string       `json:"privateKey,omitempty"`
	PublicKey  string       `json:"publicKey,omitempty"`
}

APIKey represents MongoDB API Key.

type APIKeyInput

type APIKeyInput struct {
	Desc  string   `json:"desc,omitempty"`
	Roles []string `json:"roles,omitempty"`
}

APIKeyInput represents MongoDB API key input request for Create.

type APIKeyRole

type APIKeyRole struct {
	GroupID  string `json:"groupId,omitempty"`
	OrgID    string `json:"orgId,omitempty"`
	RoleName string `json:"roleName,omitempty"`
}

APIKeyRole represents a role name of API key

type APIKeysService

APIKeysService is an interface for interfacing with the APIKeys endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/apiKeys/

type APIKeysServiceOp

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

APIKeysServiceOp handles communication with the APIKey related methods of the MongoDB Atlas API

func (*APIKeysServiceOp) Create

func (s *APIKeysServiceOp) Create(ctx context.Context, orgID string, createRequest *APIKeyInput) (*APIKey, *Response, error)

Create an API Key by the {ORG-ID}. See more: https://docs.atlas.mongodb.com/reference/api/apiKeys-orgs-create-one/

func (*APIKeysServiceOp) Delete

func (s *APIKeysServiceOp) Delete(ctx context.Context, orgID string, apiKeyID string) (*Response, error)

Delete the API Key specified to {API-KEY-ID} from the organization associated to {ORG-ID}. See more: https://docs.atlas.mongodb.com/reference/api/apiKey-delete-one-apiKey/

func (*APIKeysServiceOp) Get

func (s *APIKeysServiceOp) Get(ctx context.Context, orgID string, apiKeyID string) (*APIKey, *Response, error)

Get gets the APIKey specified to {API-KEY-ID} from the organization associated to {ORG-ID}. See more: https://docs.atlas.mongodb.com/reference/api/apiKeys-orgs-get-one/

func (*APIKeysServiceOp) List

func (s *APIKeysServiceOp) List(ctx context.Context, orgID string, listOptions *ListOptions) ([]APIKey, *Response, error)

List all API-KEY in the organization associated to {ORG-ID}. See more: https://docs.atlas.mongodb.com/reference/api/apiKeys-orgs-get-all/

func (*APIKeysServiceOp) Update

func (s *APIKeysServiceOp) Update(ctx context.Context, orgID string, apiKeyID string, updateRequest *APIKeyInput) (*APIKey, *Response, error)

Update a API Key in the organization associated to {ORG-ID} See more: https://docs.atlas.mongodb.com/reference/api/apiKeys-orgs-update-one/

type ArgError

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

ArgError is an error that represents an error with an input to godo. It identifies the argument and the cause (if possible).

func NewArgError

func NewArgError(arg, reason string) *ArgError

NewArgError creates an InputError.

func (*ArgError) Error

func (e *ArgError) Error() string

type AssignAPIKey added in v0.0.3

type AssignAPIKey struct {
	Roles []string `json:"roles"`
}

AssignAPIKey contains the roles to be assigned to an Organization API key into a Project

type AutoScaling

type AutoScaling struct {
	DiskGBEnabled *bool `json:"diskGBEnabled,omitempty"`
}

type AwsKms

type AwsKms struct {
	Enabled             *bool  `json:"enabled,omitempty"`             // Specifies whether Encryption at Rest is enabled for an Atlas project, To disable Encryption at Rest, pass only this parameter with a value of false, When you disable Encryption at Rest, Atlas also removes the configuration details.
	AccessKeyID         string `json:"accessKeyID,omitempty"`         // The IAM access key ID with permissions to access the customer master key specified by customerMasterKeyID.
	SecretAccessKey     string `json:"secretAccessKey,omitempty"`     // The IAM secret access key with permissions to access the customer master key specified by customerMasterKeyID.
	CustomerMasterKeyID string `json:"customerMasterKeyID,omitempty"` // The AWS customer master key used to encrypt and decrypt the MongoDB master keys.
	Region              string `json:"region,omitempty"`              // The AWS region in which the AWS customer master key exists: CA_CENTRAL_1, US_EAST_1, US_EAST_2, US_WEST_1, US_WEST_2, SA_EAST_1
}

AwsKms specifies AWS KMS configuration details and whether Encryption at Rest is enabled for an Atlas project.

type AzureKeyVault

type AzureKeyVault struct {
	Enabled           *bool  `json:"enabled,omitempty"`           // Specifies whether Encryption at Rest is enabled for an Atlas project. To disable Encryption at Rest, pass only this parameter with a value of false. When you disable Encryption at Rest, Atlas also removes the configuration details.
	ClientID          string `json:"clientID,omitempty"`          // The client ID, also known as the application ID, for an Azure application associated with the Azure AD tenant.
	AzureEnvironment  string `json:"azureEnvironment,omitempty"`  // The Azure environment where the Azure account credentials reside. Valid values are the following: AZURE, AZURE_CHINA, AZURE_GERMANY
	SubscriptionID    string `json:"subscriptionID,omitempty"`    // The unique identifier associated with an Azure subscription.
	ResourceGroupName string `json:"resourceGroupName,omitempty"` // The name of the Azure Resource group that contains an Azure Key Vault.
	KeyVaultName      string `json:"keyVaultName,omitempty"`      // The name of an Azure Key Vault containing your key.
	KeyIdentifier     string `json:"keyIdentifier,omitempty"`     // The unique identifier of a key in an Azure Key Vault.
	Secret            string `json:"secret,omitempty"`            // The secret associated with the Azure Key Vault specified by azureKeyVault.tenantID.
	TenantID          string `json:"tenantID,omitempty"`          // The unique identifier for an Azure AD tenant within an Azure subscription.
}

AzureKeyVault specifies Azure Key Vault configuration details and whether Encryption at Rest is enabled for an Atlas project.

type BiConnector

type BiConnector struct {
	Enabled        *bool  `json:"enabled,omitempty"`
	ReadPreference string `json:"readPreference,omitempty"`
}

type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string

	//Services used for communicating with the API
	DatabaseUsers                    DatabaseUsersService
	ProjectIPWhitelist               ProjectIPWhitelistService
	Projects                         ProjectsService
	Clusters                         ClustersService
	CloudProviderSnapshots           CloudProviderSnapshotsService
	APIKeys                          APIKeysService
	ProjectAPIKeys                   ProjectAPIKeysService
	CloudProviderSnapshotRestoreJobs CloudProviderSnapshotRestoreJobsService
	Peers                            PeersService
	Containers                       ContainersService
	EncryptionsAtRest                EncryptionsAtRestService
	WhitelistAPIKeys                 WhitelistAPIKeysService
	// contains filtered or unexported fields
}

Client manages communication with MongoDBAtlas v1.0 API

func New

func New(httpClient *http.Client, opts ...ClientOpt) (*Client, error)

New returns a new MongoDBAtlas API client instance.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient returns a new MongoDBAtlas API Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included in as the request body.

func (*Client) OnRequestCompleted

func (c *Client) OnRequestCompleted(rc RequestCompletionCallback)

OnRequestCompleted sets the DO API request completion callback

type ClientOpt

type ClientOpt func(*Client) error

ClientOpt are options for New.

func SetBaseURL

func SetBaseURL(bu string) ClientOpt

SetBaseURL is a client option for setting the base URL.

func SetUserAgent

func SetUserAgent(ua string) ClientOpt

SetUserAgent is a client option for setting the user agent.

type CloudProviderSnapshot

type CloudProviderSnapshot struct {
	ID               string  `json:"id,omitempty"`               // Unique identifier of the snapshot.
	RetentionInDays  int     `json:"retentionInDays,omitempty"`  // The number of days that Atlas should retain the on-demand snapshot. Must be at least 1 .
	CreatedAt        string  `json:"createdAt,omitempty"`        // UTC ISO 8601 formatted point in time when Atlas took the snapshot.
	ExpiresAt        string  `json:"expiresAt,omitempty"`        // UTC ISO 8601 formatted point in time when Atlas will delete the snapshot.
	Description      string  `json:"description,omitempty"`      // Description of the on-demand snapshot.
	Links            []*Link `json:"links,omitempty"`            // One or more links to sub-resources and/or related resources.
	MasterKeyUUID    string  `json:"masterKeyUUID,omitempty"`    // Unique ID of the AWS KMS Customer Master Key used to encrypt the snapshot. Only visible for clusters using Encryption at Rest via Customer KMS.
	MongodVersion    string  `json:"mongodVersion,omitempty"`    // Version of the MongoDB server.
	SnapshotType     string  `json:"snapshotType,omitempty"`     // Specified the type of snapshot. Valid values are onDemand and scheduled.
	Status           string  `json:"status,omitempty"`           // Current status of the snapshot. One of the following values: queued, inProgress, completed, failed
	StorageSizeBytes int     `json:"storageSizeBytes,omitempty"` // Specifies the size of the snapshot in bytes.
	Type             string  `json:"type,omitempty"`             // Specifies the type of cluster: replicaSet or shardedCluster.
}

CloudProviderSnapshot represents a cloud provider snapshot.

type CloudProviderSnapshotRestoreJob

type CloudProviderSnapshotRestoreJob struct {
	ID                string   `json:"id,omitempty"`                // The unique identifier of the restore job.
	SnapshotID        string   `json:"snapshotId,omitempty"`        // Unique identifier of the snapshot to restore.
	DeliveryType      string   `json:"deliveryType,omitempty"`      // Type of restore job to create. Possible values are: automated or download
	DeliveryURL       []string `json:"deliveryUrl,omitempty"`       // One or more URLs for the compressed snapshot files for manual download. Only visible if deliveryType is download.
	TargetClusterName string   `json:"targetClusterName,omitempty"` // Name of the target Atlas cluster to which the restore job restores the snapshot. Only required if deliveryType is automated.
	TargetGroupID     string   `json:"targetGroupId,omitempty"`     // Unique ID of the target Atlas project for the specified targetClusterName. Only required if deliveryType is automated.
	Cancelled         bool     `json:"cancelled,omitempty"`         // Indicates whether the restore job was canceled.
	CreatedAt         string   `json:"createdAt,omitempty"`         // UTC ISO 8601 formatted point in time when Atlas created the restore job.
	Expired           bool     `json:"expired,omitempty"`           // Indicates whether the restore job expired.
	ExpiresAt         string   `json:"expiresAt,omitempty"`         // UTC ISO 8601 formatted point in time when the restore job expires.
	FinishedAt        string   `json:"finishedAt,omitempty"`        // UTC ISO 8601 formatted point in time when the restore job completed.
	Links             []*Link  `json:"links,omitempty"`             // One or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification.
	Timestamp         string   `json:"timestamp,omitempty"`         // Timestamp in ISO 8601 date and time format in UTC when the snapshot associated to snapshotId was taken.
}

CloudProviderSnapshotRestoreJob represents the structure of a cloudProviderSnapshotRestoreJob.

type CloudProviderSnapshotRestoreJobs

type CloudProviderSnapshotRestoreJobs struct {
	Links      []*Link                            `json:"links"`
	Results    []*CloudProviderSnapshotRestoreJob `json:"results"`
	TotalCount int                                `json:"totalCount"`
}

CloudProviderSnapshotRestoreJobs represents an array of cloudProviderSnapshotRestoreJob

type CloudProviderSnapshotRestoreJobsService

CloudProviderSnapshotRestoreJobsService is an interface for interfacing with the CloudProviderSnapshotRestoreJobs endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/cloudProviderSnapshotRestoreJobs/

type CloudProviderSnapshotRestoreJobsServiceOp

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

CloudProviderSnapshotRestoreJobsServiceOp handles communication with the CloudProviderSnapshotRestoreJobs related methos of the MongoDB Atlas API

func (*CloudProviderSnapshotRestoreJobsServiceOp) Create

Create creates a new restore job from a cloud provider snapshot associated to the specified cluster. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot-restore-jobs-create-one/

func (*CloudProviderSnapshotRestoreJobsServiceOp) Delete

Delete cancels the cloud provider snapshot manual download restore job associated to {JOB-ID}. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot-restore-jobs-delete-one/

func (*CloudProviderSnapshotRestoreJobsServiceOp) Get

Get gets one cloud provider snapshot restore jobs for the specified cluster. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot-restore-jobs-get-one/

func (*CloudProviderSnapshotRestoreJobsServiceOp) List

List gets all cloud provider snapshot restore jobs for the specified cluster. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot-restore-jobs-get-all/

type CloudProviderSnapshots

type CloudProviderSnapshots struct {
	Results    []*CloudProviderSnapshot `json:"results,omitempty"`    // Includes one CloudProviderSnapshot object for each item detailed in the results array section.
	Links      []*Link                  `json:"links,omitempty"`      // One or more links to sub-resources and/or related resources.
	TotalCount int                      `json:"totalCount,omitempty"` // Count of the total number of items in the result set. It may be greater than the number of objects in the results array if the entire result set is paginated.
}

CloudProviderSnapshots represents all cloud provider snapshots.

type CloudProviderSnapshotsService

CloudProviderSnapshotsService is an interface for interfacing with the Cloud Provider Snapshots endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot/

type CloudProviderSnapshotsServiceOp

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

CloudProviderSnapshotsServiceOp handles communication with the DatabaseUsers related methos of the MongoDB Atlas API

func (*CloudProviderSnapshotsServiceOp) Create

Create takes one on-demand snapshot. Atlas takes on-demand snapshots immediately, unlike scheduled snapshots which occur at regular intervals. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot-take-one-ondemand/

func (*CloudProviderSnapshotsServiceOp) Delete

Delete deletes the snapshot associated to {SNAPSHOT-ID}. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot-delete-one/

func (*CloudProviderSnapshotsServiceOp) GetAllCloudProviderSnapshots

func (s *CloudProviderSnapshotsServiceOp) GetAllCloudProviderSnapshots(ctx context.Context, requestParameters *SnapshotReqPathParameters) (*CloudProviderSnapshots, *Response, error)

GetAllCloudProviderSnapshots gets all cloud provider snapshots for the specified cluster. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot-get-all/

func (*CloudProviderSnapshotsServiceOp) GetOneCloudProviderSnapshot

func (s *CloudProviderSnapshotsServiceOp) GetOneCloudProviderSnapshot(ctx context.Context, requestParameters *SnapshotReqPathParameters) (*CloudProviderSnapshot, *Response, error)

GetOneCloudProviderSnapshot gets the snapshot associated to {SNAPSHOT-ID}. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot-get-one/

type Cluster

type Cluster struct {
	AutoScaling              AutoScaling              `json:"autoScaling,omitempty"`
	BackupEnabled            *bool                    `json:"backupEnabled,omitempty"`
	BiConnector              BiConnector              `json:"biConnector,omitempty"`
	ClusterType              string                   `json:"clusterType,omitempty"`
	DiskSizeGB               *float64                 `json:"diskSizeGB,omitempty"`
	EncryptionAtRestProvider string                   `json:"encryptionAtRestProvider,omitempty"`
	ID                       string                   `json:"id,omitempty"`
	GroupID                  string                   `json:"groupId,omitempty"`
	MongoDBVersion           string                   `json:"mongoDBVersion,omitempty"`
	MongoDBMajorVersion      string                   `json:"mongoDBMajorVersion,omitempty"`
	MongoURI                 string                   `json:"mongoURI,omitempty"`
	MongoURIUpdated          string                   `json:"mongoURIUpdated,omitempty"`
	MongoURIWithOptions      string                   `json:"mongoURIWithOptions,omitempty"`
	Name                     string                   `json:"name,omitempty"`
	NumShards                *int64                   `json:"numShards,omitempty"`
	Paused                   *bool                    `json:"paused,omitempty"`
	ProviderBackupEnabled    *bool                    `json:"providerBackupEnabled,omitempty"`
	ProviderSettings         *ProviderSettings        `json:"providerSettings,omitempty"`
	ReplicationFactor        *int64                   `json:"replicationFactor,omitempty"`
	ReplicationSpec          map[string]RegionsConfig `json:"replicationSpec,omitempty"`
	ReplicationSpecs         []ReplicationSpec        `json:"replicationSpecs,omitempty"`
	SrvAddress               string                   `json:"srvAddress,omitempty"`
	StateName                string                   `json:"stateName,omitempty"`
}

Cluster represents MongoDB cluster.

type ClustersService

ClustersService is an interface for interfacing with the Clusters endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/clusters/

type ClustersServiceOp

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

ClustersServiceOp handles communication with the Cluster related methods of the MongoDB Atlas API

func (*ClustersServiceOp) Create

func (s *ClustersServiceOp) Create(ctx context.Context, groupID string, createRequest *Cluster) (*Cluster, *Response, error)

Add a cluster to the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/clusters-create-one/

func (*ClustersServiceOp) Delete

func (s *ClustersServiceOp) Delete(ctx context.Context, groupID string, clusterName string) (*Response, error)

Delete the cluster specified to {CLUSTER-NAME} from the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/clusters-delete-one/

func (*ClustersServiceOp) Get

func (s *ClustersServiceOp) Get(ctx context.Context, groupID string, clusterName string) (*Cluster, *Response, error)

Get gets the cluster specified to {ClUSTER-NAME} from the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/clusters-get-one/

func (*ClustersServiceOp) List

func (s *ClustersServiceOp) List(ctx context.Context, groupID string, listOptions *ListOptions) ([]Cluster, *Response, error)

List all clusters in the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/clusters-get-all/

func (*ClustersServiceOp) Update

func (s *ClustersServiceOp) Update(ctx context.Context, groupID string, clusterName string, updateRequest *Cluster) (*Cluster, *Response, error)

Update a cluster in the project associated to {GROUP-ID} See more: https://docs.atlas.mongodb.com/reference/api/clusters-modify-one/

type Container

type Container struct {
	AtlasCIDRBlock      string `json:"atlasCidrBlock,omitempty"`
	AzureSubscriptionID string `json:"azureSubscriptionId,omitempty"`
	GCPProjectID        string `json:"gcpProjectId,omitempty"`
	ID                  string `json:"id,omitempty"`
	NetworkName         string `json:"networkName,omitempty"`
	ProviderName        string `json:"providerName,omitempty"`
	Provisioned         *bool  `json:"provisioned,omitempty"`
	Region              string `json:"region,omitempty"`
	RegionName          string `json:"regionName,omitempty"`
	VNetName            string `json:"vnetName,omitempty"`
	VPCID               string `json:"vpcId,omitempty"`
}

Container represents MongoDB network peering containter.

type ContainersService

ContainersService is an interface for interfacing with the Network Peering Containers endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/vpc/

type ContainersServiceOp

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

ContainersServiceOp handles communication with the Network Peering Container related methods of the MongoDB Atlas API

func (*ContainersServiceOp) Create

func (s *ContainersServiceOp) Create(ctx context.Context, groupID string, createRequest *Container) (*Container, *Response, error)

Add a network peering container to the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/vpc-create-container/

func (*ContainersServiceOp) Delete

func (s *ContainersServiceOp) Delete(ctx context.Context, groupID string, containerID string) (*Response, error)

Delete the network peering container specified to {CONTAINER-ID} from the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/vpc-delete-one-container/

func (*ContainersServiceOp) Get

func (s *ContainersServiceOp) Get(ctx context.Context, groupID string, containerID string) (*Container, *Response, error)

Get gets the network peering container specified to {CONTAINER-ID} from the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/vpc-get-container/

func (*ContainersServiceOp) List

func (s *ContainersServiceOp) List(ctx context.Context, groupID string, listOptions *ListOptions) ([]Container, *Response, error)

List all containers in the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/vpc-get-containers-list/

func (*ContainersServiceOp) Update

func (s *ContainersServiceOp) Update(ctx context.Context, groupID string, containerID string, updateRequest *Container) (*Container, *Response, error)

Update a network peering container in the project associated to {GROUP-ID} See more: https://docs.atlas.mongodb.com/reference/api/vpc-update-container/

type DatabaseUser

type DatabaseUser struct {
	Roles           []Role `json:"roles,omitempty"`
	GroupID         string `json:"groupId,omitempty"`
	Username        string `json:"username,omitempty"`
	Password        string `json:"password,omitempty"`
	DatabaseName    string `json:"databaseName,omitempty"`
	LDAPAuthType    string `json:"ldapAuthType,omitempty"`
	DeleteAfterDate string `json:"deleteAfterDate,omitempty"`
}

DatabaseUser represents MongoDB users in your cluster.

type DatabaseUsersService

DatabaseUsersService is an interface for interfacing with the Database Users endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/database-users/index.html

type DatabaseUsersServiceOp

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

DatabaseUsersServiceOp handles communication with the DatabaseUsers related methos of the MongoDB Atlas API

func (*DatabaseUsersServiceOp) Create

func (s *DatabaseUsersServiceOp) Create(ctx context.Context, groupID string, createRequest *DatabaseUser) (*DatabaseUser, *Response, error)

Create creates a user for the project. See more: https://docs.atlas.mongodb.com/reference/api/database-users-create-a-user/

func (*DatabaseUsersServiceOp) Delete

func (s *DatabaseUsersServiceOp) Delete(ctx context.Context, groupID string, username string) (*Response, error)

Delete deletes a user for the project. See more: https://docs.atlas.mongodb.com/reference/api/database-users-delete-a-user/

func (*DatabaseUsersServiceOp) Get

func (s *DatabaseUsersServiceOp) Get(ctx context.Context, groupID string, username string) (*DatabaseUser, *Response, error)

Get gets a single user in the project. See more: https://docs.atlas.mongodb.com/reference/api/database-users-get-single-user/

func (*DatabaseUsersServiceOp) List

func (s *DatabaseUsersServiceOp) List(ctx context.Context, groupID string, listOptions *ListOptions) ([]DatabaseUser, *Response, error)

List gets all users in the project. See more: https://docs.atlas.mongodb.com/reference/api/database-users-get-all-users/

func (*DatabaseUsersServiceOp) Update

func (s *DatabaseUsersServiceOp) Update(ctx context.Context, groupID string, username string, updateRequest *DatabaseUser) (*DatabaseUser, *Response, error)

Update updates a user for the project. See more: https://docs.atlas.mongodb.com/reference/api/database-users-update-a-user/

type EncryptionAtRest

type EncryptionAtRest struct {
	GroupID        string                            `json:"groupId,omitempty"` // The unique identifier for the project.
	AwsKms         `json:"awsKms,omitempty"`         // AwsKms specifies AWS KMS configuration details and whether Encryption at Rest is enabled for an Atlas project.
	AzureKeyVault  `json:"azureKeyVault,omitempty"`  // AzureKeyVault specifies Azure Key Vault configuration details and whether Encryption at Rest is enabled for an Atlas project.
	GoogleCloudKms `json:"googleCloudKms,omitempty"` // Specifies GCP KMS configuration details and whether Encryption at Rest is enabled for an Atlas project.
}

EncryptionAtRest represents a configuration Encryption at Rest for an Atlas project.

type EncryptionsAtRestService

type EncryptionsAtRestService interface {
	Create(context.Context, *EncryptionAtRest) (*EncryptionAtRest, *Response, error)
	Get(context.Context, string) (*EncryptionAtRest, *Response, error)
	Delete(context.Context, string) (*Response, error)
}

EncryptionsAtRestService is an interface for interfacing with the Encryption at Rest endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/encryption-at-rest/

type EncryptionsAtRestServiceOp

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

EncryptionsAtRestServiceOp handles communication with the DatabaseUsers related methos of the MongoDB Atlas API

func (*EncryptionsAtRestServiceOp) Create

Create takes one on-demand snapshot. Atlas takes on-demand snapshots immediately, unlike scheduled snapshots which occur at regular intervals. See more: https://docs.atlas.mongodb.com/reference/api/enable-configure-encryptionatrest/

func (*EncryptionsAtRestServiceOp) Delete

func (s *EncryptionsAtRestServiceOp) Delete(ctx context.Context, groupID string) (*Response, error)

Delete disable the AWS, Azure and Google Encryption at Rest. See more: https://docs.atlas.mongodb.com/reference/api/enable-configure-encryptionatrest/

func (*EncryptionsAtRestServiceOp) Get

Get retrieves the current configuration for Encryption at Rest for an Atlas project. See more: https://docs.atlas.mongodb.com/reference/api/get-configuration-encryptionatrest/

type ErrorResponse

type ErrorResponse struct {
	// HTTP response that caused this error
	Response *http.Response
	//The error code, which is simply the HTTP status code.
	ErrorCode int `json:"Error"`

	//A short description of the error, which is simply the HTTP status phrase.
	Reason string `json:"reason"`

	//A more detailed description of the error.
	Detail string `json:"detail,omitempty"`
}

ErrorResponse reports the error caused by an API request.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type GoogleCloudKms

type GoogleCloudKms struct {
	Enabled              *bool  `json:"enabled,omitempty"`              // Specifies whether Encryption at Rest is enabled for an Atlas project. To disable Encryption at Rest, pass only this parameter with a value of false. When you disable Encryption at Rest, Atlas also removes the configuration details.
	ServiceAccountKey    string `json:"serviceAccountKey,omitempty"`    // String-formatted JSON object containing GCP KMS credentials from your GCP account.
	KeyVersionResourceID string `json:"keyVersionResourceID,omitempty"` // 	The Key Version Resource ID from your GCP account.
}

GoogleCloudKms specifies GCP KMS configuration details and whether Encryption at Rest is enabled for an Atlas project.

type Link struct {
	Rel  string `json:"rel,omitempty"`
	Href string `json:"href,omitempty"`
}

Link is the link to sub-resources and/or related resources.

type ListOptions

type ListOptions struct {
	// For paginated result sets, page of results to retrieve.
	PageNum int `url:"pageNum,omitempty"`

	// For paginated result sets, the number of results to include per page.
	ItemsPerPage int `url:"itemsPerPage,omitempty"`
}

ListOptions specifies the optional parameters to List methods that support pagination.

type Peer

type Peer struct {
	AccepterRegionName  string `json:"accepterRegionName,omitempty"`
	AWSAccountId        string `json:"awsAccountId,omitempty"`
	ConnectionID        string `json:"connectionId,omitempty"`
	ContainerID         string `json:"containerId,omitempty"`
	ErrorStateName      string `json:"errorStateName,omitempty"`
	ID                  string `json:"id,omitempty"`
	ProviderName        string `json:"providerName,omitempty"`
	RouteTableCIDRBlock string `json:"routeTableCidrBlock,omitempty"`
	StatusName          string `json:"statusName,omitempty"`
	VpcID               string `json:"vpcId,omitempty"`
	AtlasCIDRBlock      string `json:"atlasCidrBlock,omitempty"`
	AzureDirectoryID    string `json:"azureDirectoryId,omitempty"`
	AzureSubscriptionId string `json:"azureSubscriptionId,omitempty"`
	ResourceGroupName   string `json:"resourceGroupName,omitempty"`
	VNetName            string `json:"vnetName,omitempty"`
	ErrorState          string `json:"errorState,omitempty"`
	Status              string `json:"status,omitempty"`
	GCPProjectID        string `json:"gcpProjectId,omitempty"`
	NetworkName         string `json:"networkName,omitempty"`
	ErrorMessage        string `json:"errorMessage,omitempty"`
}

Peer represents MongoDB peer connection.

type PeersService

type PeersService interface {
	List(context.Context, string, *ListOptions) ([]Peer, *Response, error)
	Get(context.Context, string, string) (*Peer, *Response, error)
	Create(context.Context, string, *Peer) (*Peer, *Response, error)
	Update(context.Context, string, string, *Peer) (*Peer, *Response, error)
	Delete(context.Context, string, string) (*Response, error)
}

PeersService is an interface for interfacing with the Peers endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/peers/

type PeersServiceOp

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

PeersServiceOp handles communication with the Network Peering Connection related methods of the MongoDB Atlas API

func (*PeersServiceOp) Create

func (s *PeersServiceOp) Create(ctx context.Context, groupID string, createRequest *Peer) (*Peer, *Response, error)

Add a peer connection to the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/vpc-create-peering-connection/

func (*PeersServiceOp) Delete

func (s *PeersServiceOp) Delete(ctx context.Context, groupID string, peerID string) (*Response, error)

Delete the peer connection specified to {PEER-ID} from the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/vpc-delete-peering-connection/

func (*PeersServiceOp) Get

func (s *PeersServiceOp) Get(ctx context.Context, groupID string, peerID string) (*Peer, *Response, error)

Get gets the netwprk peering connection specified to {PEER-ID} from the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/vpc-get-connection/

func (*PeersServiceOp) List

func (s *PeersServiceOp) List(ctx context.Context, groupID string, listOptions *ListOptions) ([]Peer, *Response, error)

List all peers in the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/vpc-get-connections-list/

func (*PeersServiceOp) Update

func (s *PeersServiceOp) Update(ctx context.Context, groupID string, peerID string, updateRequest *Peer) (*Peer, *Response, error)

Update a peer connection in the project associated to {GROUP-ID} See more: https://docs.atlas.mongodb.com/reference/api/vpc-update-peering-connection/

type Project

type Project struct {
	ID           string  `json:"id,omitempty"`
	OrgID        string  `json:"orgId,omitempty"`
	Name         string  `json:"name,omitempty"`
	ClusterCount int     `json:"clusterCount,omitempty"`
	Created      string  `json:"created,omitempty"`
	Links        []*Link `json:"links,omitempty"`
}

Project represents the structure of a project.

type ProjectAPIKeysOp

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

ProjectAPIKeysOp handles communication with the APIKey related methods of the MongoDB Atlas API

func (*ProjectAPIKeysOp) Assign

func (s *ProjectAPIKeysOp) Assign(ctx context.Context, groupID string, keyID string, assignAPIKeyRequest *AssignAPIKey) (*Response, error)

Assign an API-KEY related to {GROUP-ID} to a the project with {API-KEY-ID}. See more: https://docs.atlas.mongodb.com/reference/api/projectApiKeys/assign-one-org-apiKey-to-one-project/

func (*ProjectAPIKeysOp) Create

func (s *ProjectAPIKeysOp) Create(ctx context.Context, groupID string, createRequest *APIKeyInput) (*APIKey, *Response, error)

Create an API Key by the {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/projectApiKeys/create-one-apiKey-in-one-project/

func (*ProjectAPIKeysOp) List

func (s *ProjectAPIKeysOp) List(ctx context.Context, groupID string, listOptions *ListOptions) ([]APIKey, *Response, error)

List all API-KEY in the organization associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/projectApiKeys/get-all-apiKeys-in-one-project/

func (*ProjectAPIKeysOp) Unassign

func (s *ProjectAPIKeysOp) Unassign(ctx context.Context, groupID string, keyID string) (*Response, error)

Unassign an API-KEY related to {GROUP-ID} to a the project with {API-KEY-ID}. See more: https://docs.atlas.mongodb.com/reference/api/projectApiKeys/delete-one-apiKey-in-one-project/

type ProjectAPIKeysService

type ProjectAPIKeysService interface {
	List(context.Context, string, *ListOptions) ([]APIKey, *Response, error)
	Create(context.Context, string, *APIKeyInput) (*APIKey, *Response, error)
	Assign(context.Context, string, string, *AssignAPIKey) (*Response, error)
	Unassign(context.Context, string, string) (*Response, error)
}

ProjectAPIKeysService is an interface for interfacing with the APIKeys endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/apiKeys/#organization-api-keys-on-projects-endpoints

type ProjectIPWhitelist

type ProjectIPWhitelist struct {
	Comment         string `json:"comment,omitempty"`
	GroupID         string `json:"groupId,omitempty"`
	CIDRBlock       string `json:"cidrBlock,omitempty"`
	IPAddress       string `json:"ipAddress,omitempty"`
	DeleteAfterDate string `json:"deleteAfterDate,omitempty"`
}

ProjectIPWhitelist represents MongoDB project's IP whitelist.

type ProjectIPWhitelistService

ProjectIPWhitelistService is an interface for interfacing with the Project IP Whitelist endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/whitelist/

type ProjectIPWhitelistServiceOp

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

ProjectIPWhitelistServiceOp handles communication with the ProjectIPWhitelist related methods of the MongoDB Atlas API

func (*ProjectIPWhitelistServiceOp) Create

func (s *ProjectIPWhitelistServiceOp) Create(ctx context.Context, groupID string, createRequest []*ProjectIPWhitelist) ([]ProjectIPWhitelist, *Response, error)

Add one or more whitelist entries to the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/database-users-create-a-user/

func (*ProjectIPWhitelistServiceOp) Delete

func (s *ProjectIPWhitelistServiceOp) Delete(ctx context.Context, groupID string, whitelistEntry string) (*Response, error)

Delete the whitelist entry specified to {WHITELIST-ENTRY} from the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/whitelist-delete-one/

func (*ProjectIPWhitelistServiceOp) Get

func (s *ProjectIPWhitelistServiceOp) Get(ctx context.Context, groupID string, whiteListEntry string) (*ProjectIPWhitelist, *Response, error)

Get gets the whitelist entry specified to {WHITELIST-ENTRY} from the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/whitelist-get-one-entry/

func (*ProjectIPWhitelistServiceOp) List

List all whitelist entries in the project associated to {GROUP-ID}. See more: https://docs.atlas.mongodb.com/reference/api/whitelist-get-all/

func (*ProjectIPWhitelistServiceOp) Update

func (s *ProjectIPWhitelistServiceOp) Update(ctx context.Context, groupID string, whitelistEntry string, updateRequest []*ProjectIPWhitelist) ([]ProjectIPWhitelist, *Response, error)

Update one or more whitelist entries in the project associated to {GROUP-ID} See more: https://docs.atlas.mongodb.com/reference/api/whitelist-update-one/

type Projects

type Projects struct {
	Links      []*Link    `json:"links"`
	Results    []*Project `json:"results"`
	TotalCount int        `json:"totalCount"`
}

Projects represents a array of project

type ProjectsService

type ProjectsService interface {
	GetAllProjects(context.Context) (*Projects, *Response, error)
	GetOneProject(context.Context, string) (*Project, *Response, error)
	GetOneProjectByName(context.Context, string) (*Project, *Response, error)
	Create(context.Context, *Project) (*Project, *Response, error)
	Delete(context.Context, string) (*Response, error)
	GetProjectTeamsAssigned(context.Context, string) (*TeamsAssigned, *Response, error)
	AddTeamsToProject(context.Context, string, *Team) (*TeamsAssigned, *Response, error)
}

ProjectsService is an interface for interfacing with the Projects endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/projects/

type ProjectsServiceOp

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

ProjectsServiceOp handles communication with the Projects related methos of the MongoDB Atlas API

func (*ProjectsServiceOp) AddTeamsToProject

func (s *ProjectsServiceOp) AddTeamsToProject(ctx context.Context, projectID string, createRequest *Team) (*TeamsAssigned, *Response, error)

AddTeamsToProject adds teams to a project See more: https://docs.atlas.mongodb.com/reference/api/project-add-team/

func (*ProjectsServiceOp) Create

func (s *ProjectsServiceOp) Create(ctx context.Context, createRequest *Project) (*Project, *Response, error)

Create creates a project. See more: https://docs.atlas.mongodb.com/reference/api/project-create-one/

func (*ProjectsServiceOp) Delete

func (s *ProjectsServiceOp) Delete(ctx context.Context, projectID string) (*Response, error)

Delete deletes a project. See more: https://docs.atlas.mongodb.com/reference/api/project-delete-one/

func (*ProjectsServiceOp) GetAllProjects

func (s *ProjectsServiceOp) GetAllProjects(ctx context.Context) (*Projects, *Response, error)

GetAllProjects gets all project. See more: https://docs.atlas.mongodb.com/reference/api/project-get-all/

func (*ProjectsServiceOp) GetOneProject

func (s *ProjectsServiceOp) GetOneProject(ctx context.Context, projectID string) (*Project, *Response, error)

GetOneProject gets a single project. See more: https://docs.atlas.mongodb.com/reference/api/project-get-one/

func (*ProjectsServiceOp) GetOneProjectByName

func (s *ProjectsServiceOp) GetOneProjectByName(ctx context.Context, projectName string) (*Project, *Response, error)

GetOneProjectByName gets a single project by its name. See more: https://docs.atlas.mongodb.com/reference/api/project-get-one-by-name/

func (*ProjectsServiceOp) GetProjectTeamsAssigned

func (s *ProjectsServiceOp) GetProjectTeamsAssigned(ctx context.Context, projectID string) (*TeamsAssigned, *Response, error)

GetProjectTeamsAssigned gets all the teams assigned to a project. See more: https://docs.atlas.mongodb.com/reference/api/project-get-teams/

type ProviderSettings

type ProviderSettings struct {
	BackingProviderName string `json:"backingProviderName,omitempty"`
	DiskIOPS            *int64 `json:"diskIOPS,omitempty"`
	DiskTypeName        string `json:"diskTypeName,omitempty"`
	EncryptEBSVolume    *bool  `json:"encryptEBSVolume,omitempty"`
	InstanceSizeName    string `json:"instanceSizeName,omitempty"`
	ProviderName        string `json:"providerName,omitempty"`
	RegionName          string `json:"regionName,omitempty"`
	VolumeType          string `json:"volumeType,omitempty"`
}

type RegionsConfig

type RegionsConfig struct {
	AnalyticsNodes *int64 `json:"analyticsNodes,omitempty"`
	ElectableNodes *int64 `json:"electableNodes,omitempty"`
	Priority       *int64 `json:"priority,omitempty"`
	ReadOnlyNodes  *int64 `json:"readOnlyNodes,omitempty"`
}

type ReplicationSpec

type ReplicationSpec struct {
	ID            string                   `json:"id,omitempty"`
	NumShards     *int64                   `json:"numShards,omitempty"`
	ZoneName      string                   `json:"zoneName,omitempty"`
	RegionsConfig map[string]RegionsConfig `json:"regionsConfig,omitempty"`
}

type RequestCompletionCallback

type RequestCompletionCallback func(*http.Request, *http.Response)

RequestCompletionCallback defines the type of the request callback function

type Response

type Response struct {
	*http.Response

	// Links that were returned with the response.
	Links []*Link `json:"links"`
}

Response is a MongoDBAtlas response. This wraps the standard http.Response returned from MongoDBAtlas API.

func (*Response) CurrentPage

func (resp *Response) CurrentPage() (int, error)

CurrentPage gets the current page for list pagination request.

func (*Response) IsLastPage

func (resp *Response) IsLastPage() bool

IsLastPage returns true if the current page is the last page

type Result

type Result struct {
	Links     []*Link  `json:"links"`
	RoleNames []string `json:"roleNames"`
	TeamID    string   `json:"teamId"`
}

Result is part og TeamsAssigned structure

type Role

type Role struct {
	RoleName       string `json:"roleName,omitempty"`
	DatabaseName   string `json:"databaseName,omitempty"`
	CollectionName string `json:"collectionName,omitempty"`
}

Role allows the user to perform particular actions on the specified database. A role on the admin database can include privileges that apply to the other databases as well.

type RoleName

type RoleName struct {
	RoleName string `json:"rolesNames"`
}

RoleName represents the kind of user role in your project

type SnapshotReqPathParameters

type SnapshotReqPathParameters struct {
	GroupID     string `json:"groupId,omitempty"`     // The unique identifier of the project for the Atlas cluster.
	SnapshotID  string `json:"snapshotId,omitempty"`  // The unique identifier of the snapshot you want to retrieve.
	ClusterName string `json:"clusterName,omitempty"` // The name of the Atlas cluster that contains the snapshots you want to retrieve.
	JobID       string `json:"jobId,omitempty"`       //The unique identifier of the restore job to retrieve.
}

SnapshotReqPathParameters represents all the pissible parameters to make the request

type Team

type Team struct {
	TeamID string      `json:"teamId"`
	Roles  []*RoleName `json:"roles"`
}

Team reperesents the kind of role that has the team

type TeamsAssigned

type TeamsAssigned struct {
	Links      []*Link   `json:"links"`
	Results    []*Result `json:"results"`
	TotalCount int       `json:"totalCount"`
}

TeamsAssigned represents the one team assigned to the project.

type WhitelistAPIKey added in v0.0.2

type WhitelistAPIKey struct {
	CidrBlock       string  `json:"cidrBlock,omitempty"`       // CIDR-notated range of whitelisted IP addresses.
	Count           int     `json:"count,omitempty"`           // Total number of requests that have originated from this IP address.
	Created         string  `json:"created,omitempty"`         // Date this IP address was added to the whitelist.
	IPAddress       string  `json:"ipAddress,omitempty"`       // Whitelisted IP address.
	LastUsed        string  `json:"lastUsed,omitempty"`        // Date of the most recent request that originated from this IP address. This field only appears if at least one request has originated from this IP address, and is only updated when a whitelisted resource is accessed.
	LastUsedAddress string  `json:"lastUsedAddress,omitempty"` // IP address from which the last call to the API was issued. This field only appears if at least one request has originated from this IP address.
	Links           []*Link `json:"links,omitempty"`           // An array of documents, representing a link to one or more sub-resources and/or related resources such as list pagination. See Linking for more information.}
}

WhitelistAPIKey represents a Whitelist API key.

type WhitelistAPIKeys added in v0.0.2

type WhitelistAPIKeys struct {
	Results    []*WhitelistAPIKey `json:"results,omitempty"`    // Includes one WhitelistAPIKey object for each item detailed in the results array section.
	Links      []*Link            `json:"links,omitempty"`      // One or more links to sub-resources and/or related resources.
	TotalCount int                `json:"totalCount,omitempty"` // Count of the total number of items in the result set. It may be greater than the number of objects in the results array if the entire result set is paginated.
}

WhitelistAPIKeys represents all Whitelist API keys.

type WhitelistAPIKeysReq added in v0.0.2

type WhitelistAPIKeysReq struct {
	IPAddress string `json:"ipAddress,omitempty"` // IP address to be added to the whitelist for the API key.
	CidrBlock string `json:"cidrBlock,omitempty"` // Whitelist entry in CIDR notation to be added for the API key.
}

WhitelistAPIKeysReq represents the request to the mehtod create

type WhitelistAPIKeysService added in v0.0.2

WhitelistAPIKeysService is an interface for interfacing with the Whitelist API Keys endpoints of the MongoDB Atlas API. See more: https://docs.atlas.mongodb.com/reference/api/apiKeys/#organization-api-key-endpoints

type WhitelistAPIKeysServiceOp added in v0.0.2

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

WhitelistAPIKeysServiceOp handles communication with the Whitelist API keys related methods of the MongoDB Atlas API

func (*WhitelistAPIKeysServiceOp) Create added in v0.0.2

func (s *WhitelistAPIKeysServiceOp) Create(ctx context.Context, orgID string, apiKeyID string, createRequest []*WhitelistAPIKeysReq) (*WhitelistAPIKeys, *Response, error)

Create a submit a POST request containing ipAddress or cidrBlock values which are not already present in the whitelist, Atlas adds those entries to the list of existing entries in the whitelist. See more: https://docs.atlas.mongodb.com/reference/api/apiKeys-org-whitelist-create/

func (*WhitelistAPIKeysServiceOp) Delete added in v0.0.2

func (s *WhitelistAPIKeysServiceOp) Delete(ctx context.Context, orgID string, apiKeyID string, ipAddress string) (*Response, error)

Delete deletes the Whitelist API keys. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot-delete-one/

func (*WhitelistAPIKeysServiceOp) Get added in v0.0.2

func (s *WhitelistAPIKeysServiceOp) Get(ctx context.Context, orgID string, apiKeyID string, ipAddress string) (*WhitelistAPIKey, *Response, error)

Get gets the Whitelist API keys. See more: https://docs.atlas.mongodb.com/reference/api/cloud-provider-snapshot-get-one/

func (*WhitelistAPIKeysServiceOp) List added in v0.0.2

List gets all Whitelist API keys. See more: https://docs.atlas.mongodb.com/reference/api/apiKeys-org-whitelist-get-all/

Jump to

Keyboard shortcuts

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