Documentation
¶
Overview ¶
Package opsmngr provides a client for using the MongoDB Ops Manager and Cloud Manager API.
Usage
import "go.mongodb.org/ops-manager/opsmngr"
Construct a new Ops Manager client, then use the various services on the client to access different parts of the Ops Manager API. For example:
client := opsmngr.NewClient(nil)
The services of a client divide the API into logical chunks and correspond to the structure of the Ops Manager API documentation at https://docs.opsmanager.mongodb.com/v4.2/reference/api/.
NOTE: Using the https://godoc.org/context package, one can easily pass cancellation signals and deadlines to various services of the client for handling a request. In case there is no context available, then context.Background() can be used as a starting point.
Authentication ¶
The ops-manager library does not directly handle authentication. Instead, when creating a new client, pass an http.Client that can handle Digest Access authentication for you. The easiest way to do this is using the https://github.com/mongodb-forks/digest library, but you can always use any other library that provides an `http.Client`. If you have a private and public API token pair, you can use it with the digest library using:
import ( "context" "log" "github.com/mongodb-forks/digest" "go.mongodb.org/ops-manager/opsmngr" ) func main() { t := digest.NewTransport("your public key", "your private key") tc, err := t.Client() if err != nil { log.Fatalf(err.Error()) } client := opsmngr.NewClient(tc) orgs, _, err := client.Organizations.List(context.Background(), nil) }
Note that when using an authenticated Client, all calls made by the client will include the specified tokens. Therefore, authenticated clients should almost never be shared between different users.
To get your API Keys please refer to our docs for:
- Ops Manager: https://docs.opsmanager.mongodb.com/current/tutorial/configure-public-api-access/,
- Cloud Manager: https://docs.cloudmanager.mongodb.com/tutorial/manage-programmatic-api-keys/.
Index ¶
- Constants
- type Agent
- type AgentAPIKey
- type AgentAPIKeysRequest
- type AgentConfig
- type Agents
- type AgentsService
- type AgentsServiceOp
- func (s *AgentsServiceOp) CreateAgentAPIKey(ctx context.Context, projectID string, agent *AgentAPIKeysRequest) (*AgentAPIKey, *atlas.Response, error)
- func (s *AgentsServiceOp) DeleteAgentAPIKey(ctx context.Context, groupID, agentAPIKey string) (*atlas.Response, error)
- func (s *AgentsServiceOp) ListAgentAPIKeys(ctx context.Context, groupID string) ([]*AgentAPIKey, *atlas.Response, error)
- func (s *AgentsServiceOp) ListAgentLinks(ctx context.Context, groupID string) (*Agents, *atlas.Response, error)
- func (s *AgentsServiceOp) ListAgentsByType(ctx context.Context, groupID, agentType string) (*Agents, *atlas.Response, error)
- type AllClustersCluster
- type AllClustersProject
- type AllClustersProjects
- type Args26
- type AuditLog
- type Auth
- type AutomationConfig
- type AutomationConfigAgent
- type AutomationService
- type AutomationServiceOp
- func (s *AutomationServiceOp) GetBackupAgentConfig(ctx context.Context, groupID string) (*AgentConfig, *atlas.Response, error)
- func (s *AutomationServiceOp) GetConfig(ctx context.Context, groupID string) (*AutomationConfig, *atlas.Response, error)
- func (s *AutomationServiceOp) GetMonitoringAgentConfig(ctx context.Context, groupID string) (*AgentConfig, *atlas.Response, error)
- func (s *AutomationServiceOp) GetStatus(ctx context.Context, groupID string) (*AutomationStatus, *atlas.Response, error)
- func (s *AutomationServiceOp) UpdateAgentVersion(ctx context.Context, groupID string) (*AutomationConfigAgent, *atlas.Response, error)
- func (s *AutomationServiceOp) UpdateConfig(ctx context.Context, groupID string, updateRequest *AutomationConfig) (*atlas.Response, error)
- type AutomationStatus
- type CheckpointsService
- type CheckpointsServiceOp
- type ChildJob
- type Client
- func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*atlas.Response, error)
- func (c *Client) NewGZipRequest(ctx context.Context, method, urlStr string) (*http.Request, error)
- func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) OnRequestCompleted(rc atlas.RequestCompletionCallback)
- type ClientOpt
- type Cluster
- type Clusters
- type ClustersService
- type ClustersServiceOp
- func (s *ClustersServiceOp) Get(ctx context.Context, groupID, clusterID string) (*Cluster, *atlas.Response, error)
- func (s *ClustersServiceOp) List(ctx context.Context, groupID string, listOptions *atlas.ListOptions) (*Clusters, *atlas.Response, error)
- func (s *ClustersServiceOp) ListAll(ctx context.Context) (*AllClustersProjects, *atlas.Response, error)
- type CreateUserResponse
- type DeploymentsService
- type DeploymentsServiceOp
- func (s *DeploymentsServiceOp) GetDatabase(ctx context.Context, groupID, hostID, name string) (*atlas.ProcessDatabase, *atlas.Response, error)
- func (s *DeploymentsServiceOp) GetHost(ctx context.Context, groupID, hostID string) (*Host, *atlas.Response, error)
- func (s *DeploymentsServiceOp) GetHostByHostname(ctx context.Context, groupID, hostname string, port int) (*Host, *atlas.Response, error)
- func (s *DeploymentsServiceOp) GetPartition(ctx context.Context, groupID, hostID, name string) (*atlas.ProcessDisk, *atlas.Response, error)
- func (s *DeploymentsServiceOp) ListDatabases(ctx context.Context, groupID, hostID string, opts *atlas.ListOptions) (*atlas.ProcessDatabasesResponse, *atlas.Response, error)
- func (s *DeploymentsServiceOp) ListHosts(ctx context.Context, groupID string, opts *HostListOptions) (*Hosts, *atlas.Response, error)
- func (s *DeploymentsServiceOp) ListPartitions(ctx context.Context, groupID, hostID string, opts *atlas.ListOptions) (*atlas.ProcessDisksResponse, *atlas.Response, error)
- func (s *DeploymentsServiceOp) StartMonitoring(ctx context.Context, groupID string, host *Host) (*Host, *atlas.Response, error)
- func (s *DeploymentsServiceOp) StopMonitoring(ctx context.Context, groupID, hostID string) (*atlas.Response, error)
- func (s *DeploymentsServiceOp) UpdateMonitoring(ctx context.Context, groupID, hostID string, host *Host) (*Host, *atlas.Response, error)
- type DiagnosticsListOpts
- type DiagnosticsService
- type DiagnosticsServiceOp
- type GlobalAPIKeyWhitelistsService
- type GlobalAPIKeyWhitelistsServiceOp
- func (s *GlobalAPIKeyWhitelistsServiceOp) Create(ctx context.Context, createRequest []*WhitelistAPIKeysReq) (*GlobalWhitelistAPIKeys, *atlas.Response, error)
- func (s *GlobalAPIKeyWhitelistsServiceOp) Delete(ctx context.Context, id string) (*atlas.Response, error)
- func (s *GlobalAPIKeyWhitelistsServiceOp) Get(ctx context.Context, id string) (*GlobalWhitelistAPIKey, *atlas.Response, error)
- func (s *GlobalAPIKeyWhitelistsServiceOp) List(ctx context.Context, listOptions *atlas.ListOptions) (*GlobalWhitelistAPIKeys, *atlas.Response, error)
- type GlobalAPIKeysService
- type GlobalAPIKeysServiceOp
- func (s *GlobalAPIKeysServiceOp) Create(ctx context.Context, createRequest *atlas.APIKeyInput) (*atlas.APIKey, *atlas.Response, error)
- func (s *GlobalAPIKeysServiceOp) Delete(ctx context.Context, apiKeyID string) (*atlas.Response, error)
- func (s *GlobalAPIKeysServiceOp) Get(ctx context.Context, apiKeyID string) (*atlas.APIKey, *atlas.Response, error)
- func (s *GlobalAPIKeysServiceOp) List(ctx context.Context, listOptions *atlas.ListOptions) ([]atlas.APIKey, *atlas.Response, error)
- func (s *GlobalAPIKeysServiceOp) Update(ctx context.Context, apiKeyID string, updateRequest *atlas.APIKeyInput) (*atlas.APIKey, *atlas.Response, error)
- type GlobalAlert
- type GlobalAlerts
- type GlobalAlertsService
- type GlobalAlertsServiceOp
- func (s *GlobalAlertsServiceOp) Acknowledge(ctx context.Context, alertID string, body *atlas.AcknowledgeRequest) (*GlobalAlert, *atlas.Response, error)
- func (s *GlobalAlertsServiceOp) Get(ctx context.Context, alertID string) (*GlobalAlert, *atlas.Response, error)
- func (s *GlobalAlertsServiceOp) List(ctx context.Context, opts *atlas.AlertsListOptions) (*GlobalAlerts, *atlas.Response, error)
- type GlobalWhitelistAPIKey
- type GlobalWhitelistAPIKeys
- type Host
- type HostCount
- type HostListOptions
- type Hosts
- type IndexConfig
- type LDAPGroupMapping
- type LogCollectionJob
- type LogCollectionJobs
- type LogCollectionService
- type LogCollectionServiceOp
- func (s *LogCollectionServiceOp) Create(ctx context.Context, groupID string, log *LogCollectionJob) (*LogCollectionJob, *atlas.Response, error)
- func (s *LogCollectionServiceOp) Delete(ctx context.Context, groupID, jobID string) (*atlas.Response, error)
- func (s *LogCollectionServiceOp) Extend(ctx context.Context, groupID, jobID string, log *LogCollectionJob) (*atlas.Response, error)
- func (s *LogCollectionServiceOp) Get(ctx context.Context, groupID, jobID string, opts *LogListOptions) (*LogCollectionJob, *atlas.Response, error)
- func (s *LogCollectionServiceOp) List(ctx context.Context, groupID string, opts *LogListOptions) (*LogCollectionJobs, *atlas.Response, error)
- func (s *LogCollectionServiceOp) Retry(ctx context.Context, groupID, jobID string) (*atlas.Response, error)
- type LogListOptions
- type LogRotate
- type LogsService
- type LogsServiceOp
- type MeasurementsService
- type MeasurementsServiceOp
- func (s *MeasurementsServiceOp) Database(ctx context.Context, groupID, hostID, databaseName string, ...) (*atlas.ProcessDatabaseMeasurements, *atlas.Response, error)
- func (s *MeasurementsServiceOp) Disk(ctx context.Context, groupID, hostID, diskName string, ...) (*atlas.ProcessDiskMeasurements, *atlas.Response, error)
- func (s *MeasurementsServiceOp) Host(ctx context.Context, projectID, hostID string, ...) (*atlas.ProcessMeasurements, *atlas.Response, error)
- type Member
- type MongoDBUser
- type Net
- type OrganizationsService
- type OrganizationsServiceOp
- func (s *OrganizationsServiceOp) Create(ctx context.Context, createRequest *atlas.Organization) (*atlas.Organization, *atlas.Response, error)
- func (s *OrganizationsServiceOp) Delete(ctx context.Context, orgID string) (*atlas.Response, error)
- func (s *OrganizationsServiceOp) Get(ctx context.Context, orgID string) (*atlas.Organization, *atlas.Response, error)
- func (s *OrganizationsServiceOp) List(ctx context.Context, opts *atlas.ListOptions) (*atlas.Organizations, *atlas.Response, error)
- func (s *OrganizationsServiceOp) Projects(ctx context.Context, orgID string, opts *atlas.ListOptions) (*Projects, *atlas.Response, error)
- type Process
- type ProcessStatus
- 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) Get(ctx context.Context, groupID string) (*Project, *atlas.Response, error)
- func (s *ProjectsServiceOp) GetByName(ctx context.Context, groupName string) (*Project, *atlas.Response, error)
- func (s *ProjectsServiceOp) List(ctx context.Context, opts *atlas.ListOptions) (*Projects, *atlas.Response, error)
- type ReplicaSet
- type Replication
- type Role
- type SSL
- type ScramShaCreds
- type Shard
- type Sharding
- type ShardingConfig
- type Storage
- type SystemLog
- type TLS
- type UnauthUsersService
- type UnauthUsersServiceOp
- type User
- type UserRole
- type WhitelistAPIKeysReq
- type WhitelistOpts
Constants ¶
const (
// APIPublicV1Path specifies the v1 api path
APIPublicV1Path = "api/public/v1.0/"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct { TypeName string `json:"typeName"` Hostname string `json:"hostname"` ConfCount int64 `json:"confCount"` LastConf string `json:"lastConf"` StateName string `json:"stateName"` PingCount int64 `json:"pingCount"` IsManaged bool `json:"isManaged"` LastPing string `json:"lastPing"` Tag *string `json:"tag"` }
Agent represents an Ops Manager agent
type AgentAPIKey ¶
type AgentAPIKeysRequest ¶
type AgentAPIKeysRequest struct {
Desc string `json:"desc"`
}
type AgentConfig ¶ added in v0.6.0
type AgentConfig struct { LogPath string `json:"logPath,omitempty"` LogPathWindows string `json:"logPathWindows,omitempty"` LogRotate *LogRotate `json:"logRotate,omitempty"` ConfigOverrides *map[string]string `json:"configOverrides,omitempty"` HasPassword *bool `json:"hasPassword,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` SSLPEMKeyFile string `json:"sslPEMKeyFile,omitempty"` SSLPEMKeyFileWindows string `json:"sslPEMKeyFileWindows,omitempty"` SSLPEMKeyPwd string `json:"sslPEMKeyPwd,omitempty"` KerberosPrincipal string `json:"kerberosPrincipal,omitempty"` KerberosKeytab string `json:"kerberosKeytab,omitempty"` KerberosWindowsUsername string `json:"kerberosWindowsUsername,omitempty"` KerberosWindowsPassword string `json:"kerberosWindowsPassword,omitempty"` HasSslPEMKeyPwd *bool `json:"hasSslPEMKeyPwd,omitempty"` LDAPGroupDN string `json:"ldapGroupDN,omitempty"` URLs *map[string]interface{} `json:"urls,omitempty"` }
type Agents ¶
type Agents struct { Links []*atlas.Link `json:"links"` Results []*Agent `json:"results"` TotalCount int `json:"totalCount"` }
Agents is a paginated collection of Agent
type AgentsService ¶
type AgentsService interface { ListAgentLinks(context.Context, string) (*Agents, *atlas.Response, error) ListAgentsByType(context.Context, string, string) (*Agents, *atlas.Response, error) CreateAgentAPIKey(context.Context, string, *AgentAPIKeysRequest) (*AgentAPIKey, *atlas.Response, error) ListAgentAPIKeys(context.Context, string) ([]*AgentAPIKey, *atlas.Response, error) DeleteAgentAPIKey(context.Context, string, string) (*atlas.Response, error) }
AgentsService provides access to the agent related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/agents/
type AgentsServiceOp ¶
type AgentsServiceOp service
AgentsServiceOp provides an implementation of the AgentsService interface
func (*AgentsServiceOp) CreateAgentAPIKey ¶ added in v0.5.0
func (s *AgentsServiceOp) CreateAgentAPIKey(ctx context.Context, projectID string, agent *AgentAPIKeysRequest) (*AgentAPIKey, *atlas.Response, error)
Create creates a new agent API key.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/agentapikeys/create-one-agent-api-key/
func (*AgentsServiceOp) DeleteAgentAPIKey ¶ added in v0.5.0
func (s *AgentsServiceOp) DeleteAgentAPIKey(ctx context.Context, groupID, agentAPIKey string) (*atlas.Response, error)
DeleteAgentAPIKey removes an agent API key from a project.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/agentapikeys/delete-one-agent-api-key/
func (*AgentsServiceOp) ListAgentAPIKeys ¶ added in v0.5.0
func (s *AgentsServiceOp) ListAgentAPIKeys(ctx context.Context, groupID string) ([]*AgentAPIKey, *atlas.Response, error)
ListAgentAPIKeys lists agent API keys.
func (*AgentsServiceOp) ListAgentLinks ¶ added in v0.5.0
func (s *AgentsServiceOp) ListAgentLinks(ctx context.Context, groupID string) (*Agents, *atlas.Response, error)
ListAgentLinks gets links to monitoring, backup, and automation agent resources for a project.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/agents-get-all/
func (*AgentsServiceOp) ListAgentsByType ¶ added in v0.5.0
func (s *AgentsServiceOp) ListAgentsByType(ctx context.Context, groupID, agentType string) (*Agents, *atlas.Response, error)
List gets agents of a specified type (i.e. Monitoring, Backup, or Automation) for a project.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/agents-get-by-type/
type AllClustersCluster ¶
type AllClustersCluster struct { ClusterID string `json:"clusterId"` Name string `json:"name"` Type string `json:"type"` Availability string `json:"availability"` Versions []string `json:"versions"` BackupEnabled bool `json:"backupEnabled"` AuthEnabled bool `json:"authEnabled"` SSLEnabled bool `json:"sslEnabled"` AlertCount int64 `json:"alertCount"` DataSizeBytes int64 `json:"dataSizeBytes"` NodeCount int64 `json:"nodeCount"` }
AllClustersCluster represents MongoDB cluster.
type AllClustersProject ¶
type AllClustersProjects ¶
type AllClustersProjects struct { Links []*atlas.Link `json:"links"` Results []*AllClustersProject `json:"results"` TotalCount int `json:"totalCount"` }
type Args26 ¶
type Args26 struct { AuditLog *AuditLog `json:"auditLog,omitempty"` // AuditLog configuration for audit logs BasisTech *map[string]interface{} `json:"basisTech,omitempty"` NET Net `json:"net"` // NET configuration for db connection (ports) OperationProfiling *map[string]interface{} `json:"operationProfiling,omitempty"` ProcessManagement *map[string]interface{} `json:"processManagement,omitempty"` Replication *Replication `json:"replication,omitempty"` // Replication configuration for ReplicaSets, omit this field if setting Sharding Security *map[string]interface{} `json:"security,omitempty"` 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 SNMP *map[string]interface{} `json:"snmp,omitempty"` SystemLog SystemLog `json:"systemLog"` // SystemLog configuration for the dblog }
Args26 part of the internal Process struct
type AuditLog ¶ added in v0.7.0
type AuditLog struct { Destination string `json:"destination,omitempty"` Path string `json:"path,omitempty"` Format string `json:"format,omitempty"` Filter string `json:"filter,omitempty"` }
AuditLog part of the internal Process struct
type Auth ¶
type Auth struct { AuthoritativeSet bool `json:"authoritativeSet"` // AuthoritativeSet indicates if the MongoDBUsers should be synced with the current list of Users AutoAuthMechanism string `json:"autoAuthMechanism"` // AutoAuthMechanism is the currently active agent authentication mechanism. This is a read only field AutoAuthMechanisms []string `json:"autoAuthMechanisms,omitempty"` // AutoAuthMechanisms is a list of auth mechanisms the Automation Agent is able to use AutoAuthRestrictions []interface{} `json:"autoAuthRestrictions"` AutoKerberosKeytabPath string `json:"autoKerberosKeytabPath,omitempty"` AutoLdapGroupDN string `json:"autoLdapGroupDN,omitempty"` AutoPwd string `json:"autoPwd,omitempty"` // AutoPwd is a required field when going from `Disabled=false` to `Disabled=true` AutoUser string `json:"autoUser,omitempty"` // AutoUser is the MongoDB Automation Agent user, when x509 is enabled, it should be set to the subject of the AA's certificate DeploymentAuthMechanisms []string `json:"deploymentAuthMechanisms,omitempty"` // DeploymentAuthMechanisms is a list of possible auth mechanisms that can be used within deployments Disabled bool `json:"disabled"` Key string `json:"key,omitempty"` // Key is the contents of the KeyFile, the automation agent will ensure this a KeyFile with these contents exists at the `KeyFile` path KeyFile string `json:"keyfile,omitempty"` // KeyFile is the path to a keyfile with read & write permissions. It is a required field if `Disabled=false` KeyFileWindows string `json:"keyfileWindows,omitempty"` // KeyFileWindows is required if `Disabled=false` even if the value is not used UsersDelete []*MongoDBUser `json:"usersDeleted"` Users []*MongoDBUser `json:"usersWanted"` // Users is a list which contains the desired users at the project level. }
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"` Balancer *map[string]interface{} `json:"balancer"` CPSModules []*map[string]interface{} `json:"cpsModules"` IndexConfigs []*IndexConfig `json:"indexConfigs"` 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"` OnlineArchiveModules []*map[string]interface{} `json:"onlineArchiveModules,omitempty"` MongoTS []*map[string]interface{} `json:"mongots,omitempty"` Options *map[string]interface{} `json:"options"` Processes []*Process `json:"processes"` ReplicaSets []*ReplicaSet `json:"replicaSets"` Roles []*map[string]interface{} `json:"roles"` Sharding []*ShardingConfig `json:"sharding"` SSL *SSL `json:"ssl,omitempty"` TLS *SSL `json:"tls,omitempty"` UIBaseURL *string `json:"uiBaseUrl"` Version int `json:"version,omitempty"` }
AutomationConfig represents an Ops Manager project automation config.
See more: https://docs.opsmanager.mongodb.com/current/reference/cluster-configuration/
type AutomationConfigAgent ¶
type AutomationService ¶ added in v0.5.0
type AutomationService interface { GetConfig(context.Context, string) (*AutomationConfig, *atlas.Response, error) UpdateConfig(context.Context, string, *AutomationConfig) (*atlas.Response, error) UpdateAgentVersion(context.Context, string) (*AutomationConfigAgent, *atlas.Response, error) GetBackupAgentConfig(context.Context, string) (*AgentConfig, *atlas.Response, error) GetMonitoringAgentConfig(context.Context, string) (*AgentConfig, *atlas.Response, error) GetStatus(context.Context, string) (*AutomationStatus, *atlas.Response, error) }
AutomationService provides access to the automation related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/nav/automation/
type AutomationServiceOp ¶ added in v0.5.0
type AutomationServiceOp service
AutomationServiceOp provides an implementation of the AutomationService interface
func (*AutomationServiceOp) GetBackupAgentConfig ¶ added in v0.6.0
func (s *AutomationServiceOp) GetBackupAgentConfig(ctx context.Context, groupID string) (*AgentConfig, *atlas.Response, error)
GetBackupAgentConfig retrieves the current backup agent configuration for a project.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/automation-config/#get-backup-attributes
func (*AutomationServiceOp) GetConfig ¶ added in v0.5.0
func (s *AutomationServiceOp) GetConfig(ctx context.Context, groupID string) (*AutomationConfig, *atlas.Response, error)
GetConfig retrieves the current automation configuration for a project.
func (*AutomationServiceOp) GetMonitoringAgentConfig ¶ added in v0.6.0
func (s *AutomationServiceOp) GetMonitoringAgentConfig(ctx context.Context, groupID string) (*AgentConfig, *atlas.Response, error)
GetMonitoringAgentConfig retrieves the current monitoring agent configuration for a project.
func (*AutomationServiceOp) GetStatus ¶ added in v0.5.0
func (s *AutomationServiceOp) GetStatus(ctx context.Context, groupID string) (*AutomationStatus, *atlas.Response, error)
GetStatus lets you see whether each MongoDB process is up-to-date with the current automation configuration. The endpoint returns the goalVersion field to report the current version of the automation configuration and the lastGoalVersionAchieved fields to report the versions of the configuration running on each server.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/automation-status/
func (*AutomationServiceOp) UpdateAgentVersion ¶ added in v0.5.0
func (s *AutomationServiceOp) UpdateAgentVersion(ctx context.Context, groupID string) (*AutomationConfigAgent, *atlas.Response, error)
UpdateAgentVersion updates the MongoDB Agent and tools to the latest versions available at the time of the request.
func (*AutomationServiceOp) UpdateConfig ¶ added in v0.5.0
func (s *AutomationServiceOp) UpdateConfig(ctx context.Context, groupID string, updateRequest *AutomationConfig) (*atlas.Response, error)
UpdateConfig updates a project’s automation configuration. When you submit updates, Ops Manager makes internal modifications to the data and then saves your new configuration version.
type AutomationStatus ¶
type AutomationStatus struct { Processes []ProcessStatus `json:"processes"` GoalVersion int `json:"goalVersion"` }
type CheckpointsService ¶
type CheckpointsService interface { List(context.Context, string, string, *atlas.ListOptions) (*atlas.Checkpoints, *atlas.Response, error) Get(context.Context, string, string, string) (*atlas.Checkpoint, *atlas.Response, error) }
CheckpointsService provides access to the backup related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/checkpoints/
type CheckpointsServiceOp ¶
type CheckpointsServiceOp service
CheckpointsServiceOp provides an implementation of the CheckpointsService interface
func (*CheckpointsServiceOp) Get ¶
func (s *CheckpointsServiceOp) Get(ctx context.Context, groupID, clusterID, checkpointID string) (*atlas.Checkpoint, *atlas.Response, error)
Get gets a checkpoint.
See https://docs.opsmanager.mongodb.com/current/reference/api/checkpoints/#get-one-checkpoint
func (*CheckpointsServiceOp) List ¶
func (s *CheckpointsServiceOp) List(ctx context.Context, groupID, clusterName string, listOptions *atlas.ListOptions) (*atlas.Checkpoints, *atlas.Response, error)
List lists checkpoints.
See https://docs.opsmanager.mongodb.com/current/reference/api/checkpoints/#get-all-checkpoints
type ChildJob ¶
type ChildJob struct { AutomationAgentID string `json:"automationAgentId,omitempty"` ErrorMessage string `json:"errorMessage,omitempty"` FinishDate string `json:"finishDate"` HostName string `json:"hostName"` LogCollectionType string `json:"logCollectionType"` Path string `json:"path"` StartDate string `json:"startDate"` Status string `json:"status"` UncompressedDiskSpaceBytes int64 `json:"uncompressedDiskSpaceBytes"` }
ChildJob represents a ChildJob in the MongoDB Ops Manager API.
type Client ¶
type Client struct { BaseURL *url.URL UserAgent string Organizations OrganizationsService Projects ProjectsService Automation AutomationService UnauthUsers UnauthUsersService AlertConfigurations atlas.AlertConfigurationsService Alerts atlas.AlertsService ContinuousSnapshots atlas.ContinuousSnapshotsService ContinuousRestoreJobs atlas.ContinuousRestoreJobsService Events atlas.EventsService OrganizationAPIKeys atlas.APIKeysService ProjectAPIKeys atlas.ProjectAPIKeysService WhitelistAPIKeys atlas.WhitelistAPIKeysService Agents AgentsService Checkpoints CheckpointsService GlobalAlerts GlobalAlertsService Deployments DeploymentsService Measurements MeasurementsService Clusters ClustersService Logs LogsService LogCollections LogCollectionService Diagnostics DiagnosticsService GlobalAPIKeys GlobalAPIKeysService GlobalAPIKeysWhitelist GlobalAPIKeyWhitelistsService // contains filtered or unexported fields }
Client manages communication with Ops Manager API
func NewClient ¶
NewClient returns a new Ops Manager API client. If a nil httpClient is provided, a http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the https://github.com/mongodb-forks/digest).
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. The provided ctx must be non-nil, if it is nil an error is returned. If it is canceled or times out, ctx.Err() will be returned.
func (*Client) NewGZipRequest ¶
NewRequest creates an API gzip request. A relative URL can be provided in urlStr, in which case it is resolved relative 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 as the request body.
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, in which case it is resolved relative 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 as the request body.
func (*Client) OnRequestCompleted ¶
func (c *Client) OnRequestCompleted(rc atlas.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 Cluster ¶
type Cluster struct { ClusterName string `json:"clusterName,omitempty"` GroupID string `json:"groupId,omitempty"` ID string `json:"id,omitempty"` LastHeartbeat string `json:"lastHeartbeat,omitempty"` Links []*atlas.Link `json:"links,omitempty"` ReplicaSetName string `json:"replicaSetName,omitempty"` ShardName string `json:"shardName,omitempty"` TypeName string `json:"typeName,omitempty"` }
Cluster represents a cluster in Ops Manager.
type Clusters ¶
type Clusters struct { Links []*atlas.Link `json:"links"` Results []*Cluster `json:"results"` TotalCount int `json:"totalCount"` }
Clusters is a list of clusters.
type ClustersService ¶
type ClustersService interface { List(context.Context, string, *atlas.ListOptions) (*Clusters, *atlas.Response, error) Get(context.Context, string, string) (*Cluster, *atlas.Response, error) ListAll(ctx context.Context) (*AllClustersProjects, *atlas.Response, error) }
ClustersService provides access to the cluster related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/clusters/
type ClustersServiceOp ¶
type ClustersServiceOp service
ClustersServiceOp provides an implementation of the ClustersService interface
func (*ClustersServiceOp) Get ¶
func (s *ClustersServiceOp) Get(ctx context.Context, groupID, clusterID string) (*Cluster, *atlas.Response, error)
Get get a single cluster by ID.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/clusters/#get-a-cluster
func (*ClustersServiceOp) List ¶
func (s *ClustersServiceOp) List(ctx context.Context, groupID string, listOptions *atlas.ListOptions) (*Clusters, *atlas.Response, error)
List all clusters for a project
See more: https://docs.opsmanager.mongodb.com/current/reference/api/clusters/#get-all-clusters
func (*ClustersServiceOp) ListAll ¶ added in v0.5.0
func (s *ClustersServiceOp) ListAll(ctx context.Context) (*AllClustersProjects, *atlas.Response, error)
ListAll list all clusters available to the user.
type CreateUserResponse ¶
type CreateUserResponse struct { APIKey string `json:"apiKey,omitempty"` ProgrammaticAPIKey atlas.APIKey `json:"programmaticApiKey,omitempty"` User *User `json:"user"` }
CreateUserResponse API response for the CreateFirstUser() call
type DeploymentsService ¶ added in v0.5.0
type DeploymentsService interface { ListHosts(context.Context, string, *HostListOptions) (*Hosts, *atlas.Response, error) GetHost(context.Context, string, string) (*Host, *atlas.Response, error) GetHostByHostname(context.Context, string, string, int) (*Host, *atlas.Response, error) StartMonitoring(context.Context, string, *Host) (*Host, *atlas.Response, error) UpdateMonitoring(context.Context, string, string, *Host) (*Host, *atlas.Response, error) StopMonitoring(context.Context, string, string) (*atlas.Response, error) ListPartitions(context.Context, string, string, *atlas.ListOptions) (*atlas.ProcessDisksResponse, *atlas.Response, error) GetPartition(context.Context, string, string, string) (*atlas.ProcessDisk, *atlas.Response, error) ListDatabases(context.Context, string, string, *atlas.ListOptions) (*atlas.ProcessDatabasesResponse, *atlas.Response, error) GetDatabase(context.Context, string, string, string) (*atlas.ProcessDatabase, *atlas.Response, error) }
DeploymentsService provides access to the deployment related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/nav/deployments/
type DeploymentsServiceOp ¶ added in v0.5.0
type DeploymentsServiceOp service
DeploymentsServiceOp provides an implementation of the DeploymentsService interface
func (*DeploymentsServiceOp) GetDatabase ¶ added in v0.5.0
func (s *DeploymentsServiceOp) GetDatabase(ctx context.Context, groupID, hostID, name string) (*atlas.ProcessDatabase, *atlas.Response, error)
GetDatabase retrieve a single database by name.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/disk-get-one/
func (*DeploymentsServiceOp) GetHost ¶ added in v0.5.0
func (s *DeploymentsServiceOp) GetHost(ctx context.Context, groupID, hostID string) (*Host, *atlas.Response, error)
Get gets the MongoDB process with the specified host ID.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/hosts/get-one-host-by-id/
func (*DeploymentsServiceOp) GetHostByHostname ¶ added in v0.5.0
func (s *DeploymentsServiceOp) GetHostByHostname(ctx context.Context, groupID, hostname string, port int) (*Host, *atlas.Response, error)
GetByHostname gets a single MongoDB process by its hostname and port combination.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/hosts/get-one-host-by-hostname-port/
func (*DeploymentsServiceOp) GetPartition ¶ added in v0.5.0
func (s *DeploymentsServiceOp) GetPartition(ctx context.Context, groupID, hostID, name string) (*atlas.ProcessDisk, *atlas.Response, error)
GetPartition retrieves a disk partition.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/disk-get-one/
func (*DeploymentsServiceOp) ListDatabases ¶ added in v0.5.0
func (s *DeploymentsServiceOp) ListDatabases(ctx context.Context, groupID, hostID string, opts *atlas.ListOptions) (*atlas.ProcessDatabasesResponse, *atlas.Response, error)
ListDatabases retrieve all databases running on the specified host.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/databases-get-all-on-host/
func (*DeploymentsServiceOp) ListHosts ¶ added in v0.5.0
func (s *DeploymentsServiceOp) ListHosts(ctx context.Context, groupID string, opts *HostListOptions) (*Hosts, *atlas.Response, error)
List lists all MongoDB hosts in a project.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/hosts/get-all-hosts-in-group/
func (*DeploymentsServiceOp) ListPartitions ¶ added in v0.5.0
func (s *DeploymentsServiceOp) ListPartitions(ctx context.Context, groupID, hostID string, opts *atlas.ListOptions) (*atlas.ProcessDisksResponse, *atlas.Response, error)
ListPartitions retrieves all disk partitions on the specified host.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/disks-get-all/
func (*DeploymentsServiceOp) StartMonitoring ¶ added in v0.5.0
func (s *DeploymentsServiceOp) StartMonitoring(ctx context.Context, groupID string, host *Host) (*Host, *atlas.Response, error)
StartMonitoring starts monitoring a new MongoDB process.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/hosts/create-one-host/
func (*DeploymentsServiceOp) StopMonitoring ¶ added in v0.5.0
func (s *DeploymentsServiceOp) StopMonitoring(ctx context.Context, groupID, hostID string) (*atlas.Response, error)
StopMonitoring stops the Monitoring from monitoring the MongoDB process on the hostname and port you specify.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/hosts/delete-one-host/
func (*DeploymentsServiceOp) UpdateMonitoring ¶ added in v0.5.0
func (s *DeploymentsServiceOp) UpdateMonitoring(ctx context.Context, groupID, hostID string, host *Host) (*Host, *atlas.Response, error)
UpdateMonitoring updates the configuration of a monitored MongoDB process.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/hosts/update-one-host/
type DiagnosticsListOpts ¶ added in v0.5.0
type DiagnosticsService ¶ added in v0.5.0
type DiagnosticsService interface {
Get(context.Context, string, *DiagnosticsListOpts, io.Writer) (*atlas.Response, error)
}
DiagnosticsService is an interface for interfacing with Diagnostic Archives in MongoDB Ops Manager APIs
https://docs.opsmanager.mongodb.com/current/reference/api/diagnostic-archives/
type DiagnosticsServiceOp ¶ added in v0.5.0
type DiagnosticsServiceOp struct {
Client atlas.GZipRequestDoer
}
type GlobalAPIKeyWhitelistsService ¶ added in v0.9.0
type GlobalAPIKeyWhitelistsService interface { List(context.Context, *atlas.ListOptions) (*GlobalWhitelistAPIKeys, *atlas.Response, error) Get(context.Context, string) (*GlobalWhitelistAPIKey, *atlas.Response, error) Create(context.Context, []*WhitelistAPIKeysReq) (*GlobalWhitelistAPIKeys, *atlas.Response, error) Delete(context.Context, string) (*atlas.Response, error) }
GlobalAPIKeyWhitelistsService provides access to the global alerts related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/global-api-key-whitelists/
type GlobalAPIKeyWhitelistsServiceOp ¶ added in v0.9.0
type GlobalAPIKeyWhitelistsServiceOp service
GlobalAPIKeyWhitelistsServiceOp provides an implementation of the GlobalAPIKeyWhitelistsService interface
func (*GlobalAPIKeyWhitelistsServiceOp) Create ¶ added in v0.9.0
func (s *GlobalAPIKeyWhitelistsServiceOp) Create(ctx context.Context, createRequest []*WhitelistAPIKeysReq) (*GlobalWhitelistAPIKeys, *atlas.Response, error)
Create one global whitelist entry.
func (*GlobalAPIKeyWhitelistsServiceOp) Delete ¶ added in v0.9.0
func (s *GlobalAPIKeyWhitelistsServiceOp) Delete(ctx context.Context, id string) (*atlas.Response, error)
Delete the global whitelist entry specified by id.
func (*GlobalAPIKeyWhitelistsServiceOp) Get ¶ added in v0.9.0
func (s *GlobalAPIKeyWhitelistsServiceOp) Get(ctx context.Context, id string) (*GlobalWhitelistAPIKey, *atlas.Response, error)
Get one global whitelist entry.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/api-keys/global/get-one-global-whitelist/
func (*GlobalAPIKeyWhitelistsServiceOp) List ¶ added in v0.9.0
func (s *GlobalAPIKeyWhitelistsServiceOp) List(ctx context.Context, listOptions *atlas.ListOptions) (*GlobalWhitelistAPIKeys, *atlas.Response, error)
List all global whitelist entries.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/api-keys/global/get-all-global-whitelist/
type GlobalAPIKeysService ¶ added in v0.9.0
type GlobalAPIKeysService interface { List(context.Context, *atlas.ListOptions) ([]atlas.APIKey, *atlas.Response, error) Get(context.Context, string) (*atlas.APIKey, *atlas.Response, error) Create(context.Context, *atlas.APIKeyInput) (*atlas.APIKey, *atlas.Response, error) Update(context.Context, string, *atlas.APIKeyInput) (*atlas.APIKey, *atlas.Response, error) Delete(context.Context, string) (*atlas.Response, error) }
GlobalAPIKeysService provides access to the global alerts related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/global-api-keys/
type GlobalAPIKeysServiceOp ¶ added in v0.9.0
type GlobalAPIKeysServiceOp service
GlobalAPIKeysServiceOp provides an implementation of the GlobalAPIKeysService interface
func (*GlobalAPIKeysServiceOp) Create ¶ added in v0.9.0
func (s *GlobalAPIKeysServiceOp) Create(ctx context.Context, createRequest *atlas.APIKeyInput) (*atlas.APIKey, *atlas.Response, error)
Create an API Key.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/api-keys/global/create-one-global-api-key/
func (*GlobalAPIKeysServiceOp) Delete ¶ added in v0.9.0
func (s *GlobalAPIKeysServiceOp) Delete(ctx context.Context, apiKeyID string) (*atlas.Response, error)
Delete the API Key with ID apiKeyID.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/api-keys/global/delete-one-global-api-key/
func (*GlobalAPIKeysServiceOp) Get ¶ added in v0.9.0
func (s *GlobalAPIKeysServiceOp) Get(ctx context.Context, apiKeyID string) (*atlas.APIKey, *atlas.Response, error)
Get gets one API Key with ID apiKeyID.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/api-keys/global/get-one-global-api-key/
func (*GlobalAPIKeysServiceOp) List ¶ added in v0.9.0
func (s *GlobalAPIKeysServiceOp) List(ctx context.Context, listOptions *atlas.ListOptions) ([]atlas.APIKey, *atlas.Response, error)
List gets all Global API Keys.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/api-keys/global/get-all-global-api-keys/
func (*GlobalAPIKeysServiceOp) Update ¶ added in v0.9.0
func (s *GlobalAPIKeysServiceOp) Update(ctx context.Context, apiKeyID string, updateRequest *atlas.APIKeyInput) (*atlas.APIKey, *atlas.Response, error)
Update one API Key with ID apiKeyID.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/api-keys/global/update-one-global-api-key/
type GlobalAlert ¶
type GlobalAlerts ¶
type GlobalAlerts struct { Links []*atlas.Link `json:"links"` Results []*GlobalAlert `json:"results"` TotalCount int `json:"totalCount"` }
type GlobalAlertsService ¶
type GlobalAlertsService interface { Get(context.Context, string) (*GlobalAlert, *atlas.Response, error) List(context.Context, *atlas.AlertsListOptions) (*GlobalAlerts, *atlas.Response, error) Acknowledge(context.Context, string, *atlas.AcknowledgeRequest) (*GlobalAlert, *atlas.Response, error) }
GlobalAlertsService provides access to the global alerts related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/global-alerts/
type GlobalAlertsServiceOp ¶
type GlobalAlertsServiceOp service
func (*GlobalAlertsServiceOp) Acknowledge ¶
func (s *GlobalAlertsServiceOp) Acknowledge(ctx context.Context, alertID string, body *atlas.AcknowledgeRequest) (*GlobalAlert, *atlas.Response, error)
Acknowledge acknowledges a global alert. See more: https://docs.opsmanager.mongodb.com/current/reference/api/global-alerts/
func (*GlobalAlertsServiceOp) Get ¶
func (s *GlobalAlertsServiceOp) Get(ctx context.Context, alertID string) (*GlobalAlert, *atlas.Response, error)
Get gets a global alert.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/global-alerts/
func (*GlobalAlertsServiceOp) List ¶
func (s *GlobalAlertsServiceOp) List(ctx context.Context, opts *atlas.AlertsListOptions) (*GlobalAlerts, *atlas.Response, error)
List gets all global alerts.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/global-alerts/
type GlobalWhitelistAPIKey ¶ added in v0.9.0
type GlobalWhitelistAPIKey struct { ID string `json:"id,omitempty"` CidrBlock string `json:"cidrBlock,omitempty"` Created string `json:"created,omitempty"` Description string `json:"description,omitempty"` Type string `json:"type,omitempty"` Updated string `json:"updated,omitempty"` }
GlobalWhitelistAPIKey represents a Whitelist API key.
type GlobalWhitelistAPIKeys ¶ added in v0.9.0
type GlobalWhitelistAPIKeys struct { Results []*GlobalWhitelistAPIKey `json:"results,omitempty"` // Includes one GlobalWhitelistAPIKey object for each item detailed in the results array section. Links []*atlas.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. }
GlobalWhitelistAPIKeys represents all Whitelist API keys.
type Host ¶
type Host struct { Aliases []string `json:"aliases,omitempty"` AuthMechanismName string `json:"authMechanismName,omitempty"` ClusterID string `json:"clusterId,omitempty"` Created string `json:"created,omitempty"` GroupID string `json:"groupId,omitempty"` Hostname string `json:"hostname"` ID string `json:"id,omitempty"` IPAddress string `json:"ipAddress,omitempty"` LastPing string `json:"lastPing,omitempty"` LastRestart string `json:"lastRestart,omitempty"` ReplicaSetName string `json:"replicaSetName,omitempty"` ReplicaStateName string `json:"replicaStateName,omitempty"` ShardName string `json:"shardName,omitempty"` TypeName string `json:"typeName,omitempty"` Version string `json:"version,omitempty"` Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Deactivated bool `json:"deactivated,omitempty"` HasStartupWarnings bool `json:"hasStartupWarnings,omitempty"` Hidden bool `json:"hidden,omitempty"` HiddenSecondary bool `json:"hiddenSecondary,omitempty"` HostEnabled bool `json:"hostEnabled,omitempty"` JournalingEnabled bool `json:"journalingEnabled,omitempty"` LowUlimit bool `json:"lowUlimit,omitempty"` MuninEnabled bool `json:"muninEnabled,omitempty"` LogsEnabled *bool `json:"logsEnabled,omitempty"` AlertsEnabled *bool `json:"alertsEnabled,omitempty"` ProfilerEnabled *bool `json:"profilerEnabled,omitempty"` SSLEnabled *bool `json:"sslEnabled,omitempty"` LastDataSizeBytes float64 `json:"lastDataSizeBytes,omitempty"` LastIndexSizeBytes float64 `json:"lastIndexSizeBytes,omitempty"` MuninPort *int32 `json:"muninPort,omitempty"` Port int32 `json:"port"` SlaveDelaySec int64 `json:"slaveDelaySec,omitempty"` UptimeMsec int64 `json:"uptimeMsec,omitempty"` Links []*atlas.Link `json:"links,omitempty"` }
Host represents a MongoDB host process in Ops Manager
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 HostListOptions ¶
type HostListOptions struct { atlas.ListOptions ClusterID string `url:"clusterId,omitempty"` }
type IndexConfig ¶
type IndexConfig struct { DBName string `json:"dbName"` // Database that is indexed CollectionName string `json:"collectionName"` // Collection that is indexed RSName string `json:"rsName"` // The replica set that the index is built on Key [][]string `json:"key"` // Keys array of keys to index and their type, sorting of keys is important for an index Options *atlas.IndexOptions `json:"options,omitempty"` // Options MongoDB index options Collation *atlas.CollationOptions `json:"collation,omitempty"` // Collation Mongo collation index options }
IndexConfig represents a new index requests for a given database and collection.
type LDAPGroupMapping ¶ added in v0.8.0
type LDAPGroupMapping struct { RoleName string `json:"roleName"` LDAPGroups []string `json:"ldapGroups"` }
LDAPGroupMapping for LDAP-backed Ops Manager, the mappings of LDAP groups to Ops Manager project roles. Only present for LDAP-backed Ops Manager.
type LogCollectionJob ¶
type LogCollectionJob struct { ID string `json:"id,omitempty"` GroupID string `json:"groupId,omitempty"` UserID string `json:"userId,omitempty"` CreationDate string `json:"creationDate,omitempty"` ExpirationDate string `json:"expirationDate,omitempty"` Status string `json:"status,omitempty"` ResourceType string `json:"resourceType,omitempty"` ResourceName string `json:"resourceName,omitempty"` RootResourceName string `json:"rootResourceName,omitempty"` RootResourceType string `json:"rootResourceType,omitempty"` URL string `json:"downloadUrl,omitempty"` Redacted *bool `json:"redacted,omitempty"` LogTypes []string `json:"logTypes,omitempty"` SizeRequestedPerFileBytes int64 `json:"sizeRequestedPerFileBytes,omitempty"` UncompressedDiskSpaceBytes int64 `json:"uncompressedSizeTotalBytes,omitempty"` ChildJobs []*ChildJob `json:"childJobs,omitempty"` // ChildJobs included if verbose is true }
LogCollectionJob represents a Log Collection Job in the MongoDB Ops Manager API.
type LogCollectionJobs ¶
type LogCollectionJobs struct { Links []*atlas.Link `json:"links"` Results []*LogCollectionJob `json:"results"` TotalCount int `json:"totalCount"` }
LogCollectionJobs represents a array of LogCollectionJobs
type LogCollectionService ¶
type LogCollectionService interface { List(context.Context, string, *LogListOptions) (*LogCollectionJobs, *atlas.Response, error) Get(context.Context, string, string, *LogListOptions) (*LogCollectionJob, *atlas.Response, error) Retry(context.Context, string, string) (*atlas.Response, error) Create(context.Context, string, *LogCollectionJob) (*LogCollectionJob, *atlas.Response, error) Extend(context.Context, string, string, *LogCollectionJob) (*atlas.Response, error) Delete(context.Context, string, string) (*atlas.Response, error) }
LogCollectionService is an interface for interfacing with the Log Collection Jobs endpoints of the MongoDB Ops Manager API. See more: https://docs.opsmanager.mongodb.com/current/reference/api/log-collection/
type LogCollectionServiceOp ¶
type LogCollectionServiceOp service
LogCollectionServiceOp handles communication with the Log Collection Jobs related methods of the MongoDB Ops Manager API
func (*LogCollectionServiceOp) Create ¶
func (s *LogCollectionServiceOp) Create(ctx context.Context, groupID string, log *LogCollectionJob) (*LogCollectionJob, *atlas.Response, error)
Create creates a log collection job.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/log-collections/log-collections-submit/
func (*LogCollectionServiceOp) Delete ¶
func (s *LogCollectionServiceOp) Delete(ctx context.Context, groupID, jobID string) (*atlas.Response, error)
Delete removes a log collection job.
func (*LogCollectionServiceOp) Extend ¶
func (s *LogCollectionServiceOp) Extend(ctx context.Context, groupID, jobID string, log *LogCollectionJob) (*atlas.Response, error)
Extend extends the expiration data of a log collection job.
func (*LogCollectionServiceOp) Get ¶
func (s *LogCollectionServiceOp) Get(ctx context.Context, groupID, jobID string, opts *LogListOptions) (*LogCollectionJob, *atlas.Response, error)
Get gets a log collection job.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/log-collections/log-collections-get-one/
func (*LogCollectionServiceOp) List ¶
func (s *LogCollectionServiceOp) List(ctx context.Context, groupID string, opts *LogListOptions) (*LogCollectionJobs, *atlas.Response, error)
List gets all collection log jobs.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/log-collections/log-collections-get-all/
func (*LogCollectionServiceOp) Retry ¶
func (s *LogCollectionServiceOp) Retry(ctx context.Context, groupID, jobID string) (*atlas.Response, error)
Retry retries a single failed log collection job.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/log-collections/log-collections-retry/
type LogListOptions ¶
type LogListOptions struct { atlas.ListOptions Verbose bool `url:"verbose,omitempty"` }
LogListOptions specifies the optional parameters to List methods that support pagination.
type LogRotate ¶
type LogRotate struct { SizeThresholdMB float64 `json:"sizeThresholdMB,omitempty"` TimeThresholdHrs int `json:"timeThresholdHrs,omitempty"` }
LogRotate part of the internal Process struct
type LogsService ¶
type LogsService interface {
Download(context.Context, string, string, io.Writer) (*atlas.Response, error)
}
LogsService is an interface for interfacing with the Log Collection Jobs endpoints of the MongoDB Ops Manager API. See more: https://docs.opsmanager.mongodb.com/current/reference/api/log-collection/
type LogsServiceOp ¶
type LogsServiceOp struct {
Client atlas.GZipRequestDoer
}
LogCollectionServiceOp handles communication with the Log Collection Jobs download method of the MongoDB Ops Manager API
type MeasurementsService ¶ added in v0.5.0
type MeasurementsService interface { Host(context.Context, string, string, *atlas.ProcessMeasurementListOptions) (*atlas.ProcessMeasurements, *atlas.Response, error) Disk(context.Context, string, string, string, *atlas.ProcessMeasurementListOptions) (*atlas.ProcessDiskMeasurements, *atlas.Response, error) Database(context.Context, string, string, string, *atlas.ProcessMeasurementListOptions) (*atlas.ProcessDatabaseMeasurements, *atlas.Response, error) }
MeasurementsService provides access to the measurement related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/measurements/
type MeasurementsServiceOp ¶ added in v0.5.0
type MeasurementsServiceOp service
MeasurementsServiceOp provides an implementation of the MeasurementsService interface
func (*MeasurementsServiceOp) Database ¶ added in v0.5.0
func (s *MeasurementsServiceOp) Database(ctx context.Context, groupID, hostID, databaseName string, opts *atlas.ProcessMeasurementListOptions) (*atlas.ProcessDatabaseMeasurements, *atlas.Response, error)
Database measurements provide statistics on database performance and storage. The Monitoring collects database measurements through the dbStats command.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/measures/get-database-measurements/
func (*MeasurementsServiceOp) Disk ¶ added in v0.5.0
func (s *MeasurementsServiceOp) Disk(ctx context.Context, groupID, hostID, diskName string, opts *atlas.ProcessMeasurementListOptions) (*atlas.ProcessDiskMeasurements, *atlas.Response, error)
Disk measurements provide data on IOPS, disk use, and disk latency on the disk partitions for hosts running MongoDB that the Automations collect. You must run Ops Manager Automation to retrieve disk measurements.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/measures/get-disk-measurements/
func (*MeasurementsServiceOp) Host ¶ added in v0.5.0
func (s *MeasurementsServiceOp) Host(ctx context.Context, projectID, hostID string, listOptions *atlas.ProcessMeasurementListOptions) (*atlas.ProcessMeasurements, *atlas.Response, error)
Host measurements provide data on the state of the MongoDB process. The Monitoring collects host measurements through the MongoDB serverStatus and dbStats commands.
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"` Tags *map[string]interface{} `json:"tags"` Votes float64 `json:"votes"` }
Member configs
type MongoDBUser ¶
type MongoDBUser struct { AuthenticationRestrictions []string `json:"authenticationRestrictions"` Database string `json:"db"` InitPassword string `json:"initPwd,omitempty"` // The cleartext password to be assigned to the user Mechanisms []string `json:"mechanisms"` Password string `json:"pwd,omitempty"` Roles []*Role `json:"roles"` ScramSha256Creds *ScramShaCreds `json:"scramSha256Creds,omitempty"` ScramSha1Creds *ScramShaCreds `json:"scramSha1Creds,omitempty"` Username string `json:"user"` }
type Net ¶
type Net struct { BindIP *string `json:"bindIp,omitempty"` BindIPAll *bool `json:"bindIpAll,omitempty"` Compression *map[string]interface{} `json:"compression,omitempty"` HTTP *map[string]interface{} `json:"journal,omitempty"` IPV6 *bool `json:"ipv6,omitempty"` ListenBacklog string `json:"listenBacklog,omitempty"` MaxIncomingConnections *int `json:"maxIncomingConnections,omitempty"` Port int `json:"port,omitempty"` ServiceExecutor string `json:"serviceExecutor,omitempty"` SSL *TLS `json:"ssl,omitempty"` TLS *TLS `json:"tls,omitempty"` TransportLayer string `json:"transportLayer,omitempty"` }
Net part of the internal Process struct
type OrganizationsService ¶
type OrganizationsService interface { List(context.Context, *atlas.ListOptions) (*atlas.Organizations, *atlas.Response, error) Get(context.Context, string) (*atlas.Organization, *atlas.Response, error) Projects(context.Context, string, *atlas.ListOptions) (*Projects, *atlas.Response, error) Create(context.Context, *atlas.Organization) (*atlas.Organization, *atlas.Response, error) Delete(context.Context, string) (*atlas.Response, error) }
OrganizationsService provides access to the organization related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/organizations/
type OrganizationsServiceOp ¶
type OrganizationsServiceOp service
OrganizationsServiceOp provides an implementation of the OrganizationsService interface
func (*OrganizationsServiceOp) Create ¶
func (s *OrganizationsServiceOp) Create(ctx context.Context, createRequest *atlas.Organization) (*atlas.Organization, *atlas.Response, error)
Create creates an organization.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/organizations/organization-create-one/
func (*OrganizationsServiceOp) Delete ¶
Delete deletes an organization.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/organizations/organization-delete-one/
func (*OrganizationsServiceOp) Get ¶ added in v0.5.0
func (s *OrganizationsServiceOp) Get(ctx context.Context, orgID string) (*atlas.Organization, *atlas.Response, error)
Get gets a single organization.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/organizations/organization-get-one/
func (*OrganizationsServiceOp) List ¶ added in v0.5.0
func (s *OrganizationsServiceOp) List(ctx context.Context, opts *atlas.ListOptions) (*atlas.Organizations, *atlas.Response, error)
List gets all organizations.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/organizations/organization-get-all/
type Process ¶
type Process struct { Args26 Args26 `json:"args2_6"` AuthSchemaVersion int `json:"authSchemaVersion,omitempty"` Cluster string `json:"cluster,omitempty"` Disabled bool `json:"disabled"` FeatureCompatibilityVersion string `json:"featureCompatibilityVersion,omitempty"` Horizons *map[string]string `json:"horizons,omitempty"` Hostname string `json:"hostname,omitempty"` LastGoalVersionAchieved int `json:"lastGoalVersionAchieved,omitempty"` LogRotate *LogRotate `json:"logRotate,omitempty"` ManualMode bool `json:"manualMode"` Name string `json:"name,omitempty"` NumCores int `json:"numCores"` Plan []string `json:"plan,omitempty"` ProcessType string `json:"processType,omitempty"` Version string `json:"version,omitempty"` }
Process represents a single process in a deployment
type ProcessStatus ¶
type Project ¶
type Project struct { ActiveAgentCount int `json:"activeAgentCount,omitempty"` AgentAPIKey string `json:"agentApiKey,omitempty"` HostCounts *HostCount `json:"hostCounts,omitempty"` ID string `json:"id,omitempty"` LastActiveAgent string `json:"lastActiveAgent,omitempty"` LDAPGroupMappings []*LDAPGroupMapping `json:"ldapGroupMappings,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 { List(context.Context, *atlas.ListOptions) (*Projects, *atlas.Response, error) Get(context.Context, string) (*Project, *atlas.Response, error) GetByName(context.Context, string) (*Project, *atlas.Response, error) Create(context.Context, *Project) (*Project, *atlas.Response, error) Delete(context.Context, string) (*atlas.Response, error) }
ProjectsService provides access to the project related functions in the Ops Manager API.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/groups/
type ProjectsServiceOp ¶
type ProjectsServiceOp service
ProjectsServiceOp provides an implementation of the ProjectsService interface
func (*ProjectsServiceOp) Create ¶
func (s *ProjectsServiceOp) Create(ctx context.Context, createRequest *Project) (*Project, *atlas.Response, error)
Create creates a project.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/groups/create-one-group/
func (*ProjectsServiceOp) Delete ¶
Delete deletes a project.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/groups/delete-one-group/
func (*ProjectsServiceOp) Get ¶ added in v0.5.0
func (s *ProjectsServiceOp) Get(ctx context.Context, groupID string) (*Project, *atlas.Response, error)
Get gets a single project.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/groups/get-one-group-by-id/
func (*ProjectsServiceOp) GetByName ¶ added in v0.5.0
func (s *ProjectsServiceOp) GetByName(ctx context.Context, groupName string) (*Project, *atlas.Response, error)
GetByName gets a single project by its name.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/groups/get-one-group-by-name/
func (*ProjectsServiceOp) List ¶ added in v0.5.0
func (s *ProjectsServiceOp) List(ctx context.Context, opts *atlas.ListOptions) (*Projects, *atlas.Response, error)
List gets all projects.
See more: https://docs.opsmanager.mongodb.com/current/reference/api/groups/get-all-groups-for-current-user/
type ReplicaSet ¶
type ReplicaSet struct { ID string `json:"_id"` ProtocolVersion string `json:"protocolVersion,omitempty"` Members []Member `json:"members"` Settings *map[string]interface{} `json:"settings,omitempty"` WriteConcernMajorityJournalDefault string `json:"writeConcernMajorityJournalDefault,omitempty"` }
ReplicaSet configs
type Replication ¶
type Replication struct { EnableMajorityReadConcern *bool `json:"enableMajorityReadConcern,omitempty"` OplogSizeMB *int `json:"oplogSizeMB,omitempty"` ReplSetName string `json:"replSetName,omitempty"` }
Replication is part of the internal Process struct
type SSL ¶
type SSL struct { AutoPEMKeyFilePath string `json:"autoPEMKeyFilePath,omitempty"` CAFilePath string `json:"CAFilePath,omitempty"` ClientCertificateMode string `json:"clientCertificateMode,omitempty"` }
SSL config properties
type ScramShaCreds ¶
type Sharding ¶
type Sharding struct { ArchiveMovedChunks *bool `json:"archiveMovedChunks,omitempty"` AutoSplit *bool `json:"autoSplit,omitempty"` ChunkSize *int `json:"chunkSize,omitempty"` ClusterRole string `json:"clusterRole,omitempty"` }
Sharding is part of the internal Process struct
type ShardingConfig ¶ added in v0.7.0
type ShardingConfig struct { Collections []*map[string]interface{} `json:"collections"` ConfigServerReplica string `json:"configServerReplica"` Draining []string `json:"draining"` ManagedSharding bool `json:"managedSharding"` Name string `json:"name"` Shards []*Shard `json:"shards"` Tags []string `json:"tags"` }
type Storage ¶
type Storage struct { DBPath string `json:"dbPath,omitempty"` DirectoryPerDB *bool `json:"directoryPerDB,omitempty"` Engine string `json:"engine,omitempty"` IndexBuildRetry *bool `json:"indexBuildRetry,omitempty"` InMemory *map[string]interface{} `json:"inMemory,omitempty"` Journal *map[string]interface{} `json:"journal,omitempty"` NSSize *int `json:"nsSize,omitempty"` PreAllocDataFiles *bool `json:"preallocDataFiles,omitempty"` Quota *map[string]interface{} `json:"quota,omitempty"` RepairPath string `json:"repairPath,omitempty"` SmallFiles *bool `json:"smallFiles,omitempty"` SyncPeriodSecs *float64 `json:"syncPeriodSecs,omitempty"` WiredTiger *map[string]interface{} `json:"wiredTiger,omitempty"` }
Storage part of the internal Process struct
type SystemLog ¶
type SystemLog struct { Destination string `json:"destination,omitempty"` Path string `json:"path,omitempty"` LogAppend bool `json:"logAppend,omitempty"` Verbosity int `json:"verbosity,omitempty"` Quiet bool `json:"quiet,omitempty"` SyslogFacility string `json:"syslogFacility,omitempty"` LogRotate string `json:"logRotate,omitempty"` TimeStampFormat string `json:"timeStampFormat,omitempty"` }
SystemLog part of the internal Process struct
type TLS ¶ added in v0.7.0
type TLS struct { CAFile string `json:"CAFile,omitempty"` CertificateKeyFile string `json:"certificateKeyFile,omitempty"` CertificateKeyFilePassword string `json:"certificateKeyFilePassword,omitempty"` CertificateSelector string `json:"certificateSelector,omitempty"` ClusterCertificateSelector string `json:"clusterCertificateSelector,omitempty"` ClusterFile string `json:"clusterFile,omitempty"` ClusterPassword string `json:"clusterPassword,omitempty"` CRLFile string `json:"CRLFile,omitempty"` DisabledProtocols string `json:"disabledProtocols,omitempty"` FIPSMode string `json:"FIPSMode,omitempty"` Mode string `json:"mode,omitempty"` PEMKeyFile string `json:"PEMKeyFile,omitempty"` }
TLS defines TLS parameters for Net
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 service
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 WhitelistAPIKeysReq ¶ added in v0.9.0
type WhitelistOpts ¶
type WhitelistOpts struct {
Whitelist []string `url:"whitelist"`
}
Source Files
¶
- agents.go
- agents_api_keys.go
- automation.go
- automation_agent_update.go
- automation_config.go
- automation_status.go
- backup_agent_config.go
- checkpoints.go
- clusters.go
- deployments.go
- deployments_databases.go
- deployments_disks.go
- deployments_hosts.go
- diagnostics.go
- doc.go
- global_alerts.go
- global_api_key_whitelists.go
- global_api_keys.go
- logs.go
- measurements.go
- measurements_databases.go
- measurements_disks.go
- measurements_hosts.go
- monitoring_agent_config.go
- opsmngr.go
- organizations.go
- projects.go
- unauth_users.go