Documentation ¶
Index ¶
- Constants
- type Args26
- type Auth
- type AutomationConfig
- type AutomationService
- type AutomationServiceOp
- type Client
- type ClientOpt
- type CreateUserResponse
- type HostCount
- type LogRotate
- type Member
- type Net
- type NetSSL
- type Options
- type Organization
- type Organizations
- type OrganizationsService
- type OrganizationsServiceOp
- func (s *OrganizationsServiceOp) Create(ctx context.Context, createRequest *Organization) (*Organization, *atlas.Response, error)
- func (s *OrganizationsServiceOp) Delete(ctx context.Context, orgID string) (*atlas.Response, error)
- func (s *OrganizationsServiceOp) GetAllOrganizations(ctx context.Context) (*Organizations, *atlas.Response, error)
- func (s *OrganizationsServiceOp) GetOneOrganization(ctx context.Context, orgID string) (*Organization, *atlas.Response, error)
- func (s *OrganizationsServiceOp) GetProjects(ctx context.Context, orgID string) (*Projects, *atlas.Response, error)
- type Process
- type Project
- type Projects
- type ProjectsService
- type ProjectsServiceOp
- func (s *ProjectsServiceOp) Create(ctx context.Context, createRequest *Project) (*Project, *atlas.Response, error)
- func (s *ProjectsServiceOp) Delete(ctx context.Context, projectID string) (*atlas.Response, error)
- func (s *ProjectsServiceOp) GetAllProjects(ctx context.Context) (*Projects, *atlas.Response, error)
- func (s *ProjectsServiceOp) GetOneProject(ctx context.Context, projectID string) (*Project, *atlas.Response, error)
- func (s *ProjectsServiceOp) GetOneProjectByName(ctx context.Context, projectName string) (*Project, *atlas.Response, error)
- type ReplicaSet
- type Replication
- type RequestCompletionCallback
- type SSL
- type Sharding
- type Storage
- type SystemLog
- type UnauthUsersService
- type UnauthUsersServiceOp
- type User
- type UserRole
- type WhitelistOpts
Constants ¶
const ( Version = "0.1" // Version for client CloudURL = "https://cloud.mongodb.com" DefaultBaseURL = CloudURL + APIPublicV1Path // DefaultBaseURL API default base URL for cloud manager APIPublicV1Path = "/api/public/v1.0/" // DefaultAPIPath default root path for all API endpoints DefaultUserAgent = "pcgc/" + Version + " (" + runtime.GOOS + "; " + runtime.GOARCH + ")" // DefaultUserAgent To be submitted by the client )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Args26 ¶
type Args26 struct { NET Net `json:"net"` // NET configuration for db connection (ports) Replication *Replication `json:"replication,omitempty"` // Replication configuration for ReplicaSets, omit this field if setting Sharding Sharding *Sharding `json:"sharding,omitempty"` // Replication configuration for sharded clusters, omit this field if setting Replication Storage *Storage `json:"storage,omitempty"` // Storage configuration for dbpath, config servers don't define this SystemLog SystemLog `json:"systemLog"` // SystemLog configuration for the dblog }
Args26 part of the internal Process struct
type Auth ¶
type Auth struct { AutoAuthMechanism string `json:"autoAuthMechanism"` AutoUser string `json:"autoUser,omitempty"` AutoPwd string `json:"autoPwd,omitempty"` DeploymentAuthMechanisms []string `json:"deploymentAuthMechanisms"` Key string `json:"key,omitempty"` Keyfile string `json:"keyfile,omitempty"` KeyfileWindows string `json:"keyfileWindows,omitempty"` UsersDeleted []interface{} `json:"usersDeleted"` UsersWanted []map[string]interface{} `json:"usersWanted"` AuthoritativeSet bool `json:"authoritativeSet"` Disabled bool `json:"disabled"` }
Auth authentication config
type AutomationConfig ¶
type AutomationConfig struct { AgentVersion *map[string]interface{} `json:"agentVersion,omitempty"` Auth Auth `json:"auth"` BackupVersions []*map[string]interface{} `json:"backupVersions,omitempty"` Balancer *map[string]interface{} `json:"balancer,omitempty"` CPSModules []*map[string]interface{} `json:"cpsModules,omitempty"` IndexConfigs []*map[string]interface{} `json:"indexConfigs,omitempty"` Kerberos *map[string]interface{} `json:"kerberos,omitempty"` LDAP *map[string]interface{} `json:"ldap,omitempty"` MongoDBVersions []*map[string]interface{} `json:"mongoDbVersions,omitempty"` MongoSQLDs []*map[string]interface{} `json:"mongosqlds,omitempty"` MonitoringVersions []*map[string]interface{} `json:"monitoringVersions,omitempty"` MongoTs []*map[string]interface{} `json:"mongots,omitempty"` Options *Options `json:"options"` Processes []*Process `json:"processes,omitempty"` ReplicaSets []*ReplicaSet `json:"replicaSets,omitempty"` Roles []*map[string]interface{} `json:"roles,omitempty"` Sharding *[]map[string]interface{} `json:"sharding,omitempty"` SSL *SSL `json:"ssl,omitempty"` UIBaseURL string `json:"uiBaseUrl,omitempty"` Version int `json:"version,omitempty"` }
type AutomationService ¶
type AutomationService interface { Get(context.Context, string) (*AutomationConfig, *atlas.Response, error) Update(context.Context, string, *AutomationConfig) (*atlas.Response, error) }
AutomationService is an interface for interfacing with the Automation Config endpoints of the MongoDB CLoud API. See more: https://docs.cloudmanager.mongodb.com/reference/api/automation-config/
type AutomationServiceOp ¶
type AutomationServiceOp struct {
// contains filtered or unexported fields
}
AutomationServiceOp handles communication with the Automation config related methods of the MongoDB Cloud API
func (*AutomationServiceOp) Get ¶
func (s *AutomationServiceOp) Get(ctx context.Context, groupID string) (*AutomationConfig, *atlas.Response, error)
func (*AutomationServiceOp) Update ¶
func (s *AutomationServiceOp) Update(ctx context.Context, groupID string, updateRequest *AutomationConfig) (*atlas.Response, error)
type Client ¶
type Client struct { BaseURL *url.URL UserAgent string Organizations OrganizationsService Projects ProjectsService AutomationConfig AutomationService UnauthUsers UnauthUsersService // contains filtered or unexported fields }
Client manages communication with MongoDBAtlas v1.0 API
func (*Client) Do ¶
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 ¶
ClientOpt are options for New.
func SetBaseURL ¶
SetBaseURL is a client option for setting the base URL.
func SetUserAgent ¶
SetUserAgent is a client option for setting the user agent.
type CreateUserResponse ¶
CreateUserResponse API response for the CreateFirstUser() call
type HostCount ¶
type HostCount struct { Arbiter int `json:"arbiter"` Config int `json:"config"` Master int `json:"master"` Mongos int `json:"mongos"` Primary int `json:"primary"` Secondary int `json:"secondary"` Slave int `json:"slave"` }
HostCount number of processes per project.
type LogRotate ¶
type LogRotate struct { SizeThresholdMB float64 `json:"sizeThresholdMB,omitempty"` TimeThresholdHrs int `json:"timeThresholdHrs,omitempty"` }
LogRotate part of the internal Process struct
type Member ¶
type Member struct { ID int `json:"_id"` ArbiterOnly bool `json:"arbiterOnly"` BuildIndexes bool `json:"buildIndexes"` Hidden bool `json:"hidden"` Host string `json:"host"` Priority float64 `json:"priority"` SlaveDelay float64 `json:"slaveDelay"` Votes float64 `json:"votes"` }
Member configs
type Organization ¶
type Organization struct { ID string `json:"id,omitempty"` Links []*atlas.Link `json:"links,omitempty"` Name string `json:"name,omitempty"` }
Organization represents the structure of an organization.
type Organizations ¶
type Organizations struct { Links []*atlas.Link `json:"links"` Results []*Organization `json:"results"` TotalCount int `json:"totalCount"` }
Organizations represents a array of organization
type OrganizationsService ¶
type OrganizationsService interface { GetAllOrganizations(context.Context) (*Organizations, *atlas.Response, error) GetOneOrganization(context.Context, string) (*Organization, *atlas.Response, error) GetProjects(context.Context, string) (*Projects, *atlas.Response, error) Create(context.Context, *Organization) (*Organization, *atlas.Response, error) Delete(context.Context, string) (*atlas.Response, error) }
OrganizationsService is an interface for interfacing with the Organizations endpoints of the MongoDB Atlas API. See more: https://docs.cloudmanager.mongodb.com/reference/api/organizations/
type OrganizationsServiceOp ¶
type OrganizationsServiceOp struct {
// contains filtered or unexported fields
}
OrganizationsServiceOp handles communication with the Projects related methods of the MongoDB Atlas API
func (*OrganizationsServiceOp) Create ¶
func (s *OrganizationsServiceOp) Create(ctx context.Context, createRequest *Organization) (*Organization, *atlas.Response, error)
Create creates an organization. See more: https://docs.cloudmanager.mongodb.com/reference/api/organizations/organization-create-one/
func (*OrganizationsServiceOp) Delete ¶
Delete deletes an organization. See more: https://docs.cloudmanager.mongodb.com/reference/api/organizations/organization-delete-one/
func (*OrganizationsServiceOp) GetAllOrganizations ¶
func (s *OrganizationsServiceOp) GetAllOrganizations(ctx context.Context) (*Organizations, *atlas.Response, error)
GetAllOrganizations gets all organizations. See more: https://docs.cloudmanager.mongodb.com/reference/api/organizations/organization-get-all/
func (*OrganizationsServiceOp) GetOneOrganization ¶
func (s *OrganizationsServiceOp) GetOneOrganization(ctx context.Context, orgID string) (*Organization, *atlas.Response, error)
GetOneOrganization gets a single organization. See more: https://docs.cloudmanager.mongodb.com/reference/api/organizations/organization-get-one/
func (*OrganizationsServiceOp) GetProjects ¶
func (s *OrganizationsServiceOp) GetProjects(ctx context.Context, orgID string) (*Projects, *atlas.Response, error)
GetProjects gets all projects for the given organization ID See more: https://docs.cloudmanager.mongodb.com/reference/api/organizations/organization-get-all-projects/
type Process ¶
type Process struct { Args26 Args26 `json:"args2_6"` AuthSchemaVersion int `json:"authSchemaVersion,omitempty"` LastGoalVersionAchieved int `json:"lastGoalVersionAchieved,omitempty"` Name string `json:"name,omitempty"` Cluster string `json:"cluster,omitempty"` FeatureCompatibilityVersion string `json:"featureCompatibilityVersion,omitempty"` Hostname string `json:"hostname,omitempty"` LogRotate *LogRotate `json:"logRotate,omitempty"` Plan []string `json:"plan,omitempty"` ProcessType string `json:"processType,omitempty"` Version string `json:"version,omitempty"` Disabled bool `json:"disabled,omitempty"` ManualMode bool `json:"manualMode,omitempty"` }
Process represents a single process in a deployment
type Project ¶
type Project struct { ActiveAgentCount int `json:"activeAgentCount,omitempty"` HostCounts *HostCount `json:"hostCounts,omitempty"` ID string `json:"id,omitempty"` LastActiveAgent string `json:"lastActiveAgent,omitempty"` Links []*atlas.Link `json:"links,omitempty"` Name string `json:"name,omitempty"` OrgID string `json:"orgId,omitempty"` PublicAPIEnabled bool `json:"publicApiEnabled,omitempty"` ReplicaSetCount int `json:"replicaSetCount,omitempty"` ShardCount int `json:"shardCount,omitempty"` Tags []*string `json:"tags,omitempty"` }
Project represents the structure of a project.
type Projects ¶
type Projects struct { Links []*atlas.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, *atlas.Response, error) GetOneProject(context.Context, string) (*Project, *atlas.Response, error) GetOneProjectByName(context.Context, string) (*Project, *atlas.Response, error) Create(context.Context, *Project) (*Project, *atlas.Response, error) Delete(context.Context, string) (*atlas.Response, error) }
ProjectsService is an interface for interfacing with the Projects endpoints of the MongoDB Cloud Manager API. See more: https://docs.cloudmanager.mongodb.com/reference/api/groups/
type ProjectsServiceOp ¶
type ProjectsServiceOp struct {
// contains filtered or unexported fields
}
ProjectsServiceOp handles communication with the Projects related methods of the MongoDB Cloud Manager API
func (*ProjectsServiceOp) Create ¶
func (s *ProjectsServiceOp) Create(ctx context.Context, createRequest *Project) (*Project, *atlas.Response, error)
Create creates a project. See more: https://docs.cloudmanager.mongodb.com/reference/api/groups/create-one-group/
func (*ProjectsServiceOp) Delete ¶
Delete deletes a project. See more: https://docs.cloudmanager.mongodb.com/reference/api/groups/delete-one-group/
func (*ProjectsServiceOp) GetAllProjects ¶
GetAllProjects gets all projects. See more: https://docs.cloudmanager.mongodb.com/reference/api/groups/get-all-groups-for-current-user/
func (*ProjectsServiceOp) GetOneProject ¶
func (s *ProjectsServiceOp) GetOneProject(ctx context.Context, projectID string) (*Project, *atlas.Response, error)
GetOneProject gets a single project. See more: https://docs.cloudmanager.mongodb.com/reference/api/groups/get-one-group-by-id/
func (*ProjectsServiceOp) GetOneProjectByName ¶
func (s *ProjectsServiceOp) GetOneProjectByName(ctx context.Context, projectName string) (*Project, *atlas.Response, error)
GetOneProjectByName gets a single project by its name. See more: https://docs.cloudmanager.mongodb.com/reference/api/groups/get-one-group-by-name/
type ReplicaSet ¶
type ReplicaSet struct { ID string `json:"_id"` ProtocolVersion string `json:"protocolVersion,omitempty"` Members []Member `json:"members"` }
ReplicaSet configs
type Replication ¶
type Replication struct {
ReplSetName string `json:"replSetName,omitempty"`
}
Replication is part of the internal Process struct
type RequestCompletionCallback ¶
RequestCompletionCallback defines the type of the request callback function
type SSL ¶
type SSL struct { AutoPEMKeyFilePath string `json:"autoPEMKeyFilePath,omitempty"` CAFilePath string `json:"CAFilePath,omitempty"` ClientCertificateMode string `json:"clientCertificateMode,omitempty"` }
SSL ssl config properties
type Sharding ¶
type Sharding struct {
ClusterRole string `json:"clusterRole"`
}
Sharding is part of the internal Process struct
type Storage ¶
type Storage struct {
DBPath string `json:"dbPath,omitempty"`
}
Storage part of the internal Process struct
type SystemLog ¶
type SystemLog struct { Destination string `json:"destination,omitempty"` Path string `json:"path,omitempty"` }
SystemLog part of the internal Process struct
type UnauthUsersService ¶
type UnauthUsersService interface {
CreateFirstUser(context.Context, *User, *WhitelistOpts) (*CreateUserResponse, *atlas.Response, error)
}
UnauthUsersService is an interface for interfacing with unauthenticated APIs
type UnauthUsersServiceOp ¶
type UnauthUsersServiceOp struct {
// contains filtered or unexported fields
}
UnauthUsersServiceOp handles communication with the unauthenticated API
func (*UnauthUsersServiceOp) CreateFirstUser ¶
func (s *UnauthUsersServiceOp) CreateFirstUser(ctx context.Context, user *User, opts *WhitelistOpts) (*CreateUserResponse, *atlas.Response, error)
CreateFirstUser creates the first user for a new installation See more: https://docs.opsmanager.mongodb.com/master/reference/api/user-create-first/
type User ¶
type User struct { Username string `json:"username"` Password string `json:"password,omitempty"` FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` EmailAddress string `json:"emailAddress,omitempty"` ID string `json:"id,omitempty"` Links []*atlas.Link `json:"links,omitempty"` Roles []*UserRole `json:"roles,omitempty"` }
User wrapper for a user response, augmented with a few extra fields
type UserRole ¶
type UserRole struct { RoleName string `json:"roleName"` GroupID string `json:"groupId,omitempty"` OrgID string `json:"orgId,omitempty"` }
UserRole denotes a single user role
type WhitelistOpts ¶
type WhitelistOpts struct {
Whitelist []string `url:"whitelist"`
}