Version: v0.5.1 Latest Latest

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

Go to latest
Published: May 5, 2020 License: Apache-2.0 Imports: 15 Imported by: 0



Package opsmngr provides a client for using the MongoDB Ops Manager and Cloud Manager API.


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.


The ops-manager library does not directly handle authentication. Instead, when creating a new client, pass an http.Client that can handle authentication for you. The easiest and recommended way to do this is using the https://github.com/Sectorbob/mlab-ns2/gae/ns/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 (


func main() {
	t := digest.NewTransport("your public key", "your private key")
	tc, err := t.Client()
	if err != nil {

	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.



View Source
const (

	// APIPublicV1Path specifies the v1 api path
	APIPublicV1Path = "api/public/v1.0/"


This section is empty.


func OptionSkipVerify

func OptionSkipVerify(c *Client) error

OptionSkipVerify will set the Insecure Skip which means that TLS certs will not be verified for validity.


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 AgentAPIKey struct {
	ID            string  `json:"_id"`
	Key           string  `json:"key"`
	Desc          string  `json:"desc"`
	CreatedTime   int64   `json:"createdTime"`
	CreatedUserID *string `json:"createdUserId"`
	CreatedIPAddr *string `json:"createdIpAddr"`
	CreatedBy     string  `json:"createdBy"`

type AgentAPIKeysRequest

type AgentAPIKeysRequest struct {
	Desc string `json:"desc"`

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.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/agentapikeys/get-all-agent-api-keys-for-project/

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 AllClustersProject struct {
	GroupName string               `json:"groupName"`
	OrgName   string               `json:"orgName"`
	PlanType  string               `json:"planType,omitempty"`
	GroupID   string               `json:"groupId"`
	OrgID     string               `json:"orgId"`
	Tags      []string             `json:"tags"`
	Clusters  []AllClustersCluster `json:"clusters"`

type AllClustersProjects

type AllClustersProjects struct {
	Links      []*atlas.Link         `json:"links"`
	Results    []*AllClustersProject `json:"results"`
	TotalCount int                   `json:"totalCount"`

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 {
	Users                    []*MongoDBUser `json:"usersWanted,omitempty"` // Users is a list which contains the desired users at the project level.
	Disabled                 bool           `json:"disabled"`
	AuthoritativeSet         bool           `json:"authoritativeSet"`                   // AuthoritativeSet indicates if the MongoDBUsers should be synced with the current list of Users
	AutoAuthMechanisms       []string       `json:"autoAuthMechanisms,omitempty"`       // AutoAuthMechanisms is a list of auth mechanisms the Automation Agent is able to use
	AutoAuthMechanism        string         `json:"autoAuthMechanism"`                  // AutoAuthMechanism is the currently active agent authentication mechanism. This is a read only field
	DeploymentAuthMechanisms []string       `json:"deploymentAuthMechanisms,omitempty"` // DeploymentAuthMechanisms is a list of possible auth mechanisms that can be used within deployments
	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
	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
	AutoPwd                  string         `json:"autoPwd,omitempty"`                  // AutoPwd is a required field when going from `Disabled=false` to `Disabled=true`

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       []*IndexConfig            `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"`

AutomationConfig represents an Ops Manager project automation config.

See more: https://docs.opsmanager.mongodb.com/current/reference/cluster-configuration/

type AutomationConfigAgent

type AutomationConfigAgent struct {
	AutomationAgentVersion string `json:"automationAgentVersion"`
	BiConnectorVersion     string `json:"biConnectorVersion"`

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)
	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) GetConfig added in v0.5.0

func (s *AutomationServiceOp) GetConfig(ctx context.Context, groupID string) (*AutomationConfig, *atlas.Response, error)

Get retrieve the current automation configuration for a project.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/automation-config/#get-the-automation-configuration

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.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/automation-config/#update-agend-versions-example

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.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/automation-config/#update-the-automation-configuration

type AutomationStatus

type AutomationStatus struct {
	Processes   []ProcessStatus `json:"processes"`
	GoalVersion int             `json:"goalVersion"`

type CheckpointsService

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
	Agents                AgentsService
	Checkpoints           CheckpointsService
	GlobalAlerts          GlobalAlertsService
	Deployments           DeploymentsService
	Measurements          MeasurementsService
	Clusters              ClustersService
	Logs                  LogsService
	LogCollections        LogCollectionService
	Diagnostics           DiagnosticsService
	// contains filtered or unexported fields

Client manages communication with Ops Manager API

func New

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

New returns a new Ops Manager API client instance.

func NewClient

func NewClient(httpClient *http.Client) *Client

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 github.com/Sectorbob/mlab-ns2/gae/ns/digest).

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*atlas.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. 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

func (c *Client) NewGZipRequest(ctx context.Context, method, urlStr string) (*http.Request, error)

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

type ClientOpt func(*Client) error

ClientOpt are options for New.

func OptionCAValidate

func OptionCAValidate(ca string) ClientOpt

OptionCAValidate will use the CA certificate, passed as a string, to validate the certificates presented by Ops Manager.

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 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

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

ListAll list all clusters available to the user.

type CreateUserResponse

type CreateUserResponse struct {
	APIKey string `json:"apiKey"`
	User   *User  `json:"user"`

CreateUserResponse API response for the CreateFirstUser() call

type DeploymentsService added in v0.5.0

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 DiagnosticsListOpts struct {
	Limit   int64 `json:"limit,omitempty"`
	Minutes int64 `json:"minutes,omitempty"`

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


type DiagnosticsServiceOp added in v0.5.0

type DiagnosticsServiceOp struct {
	Client atlas.GZipRequestDoer

func (*DiagnosticsServiceOp) Get added in v0.5.0

Get retrieves the project’s diagnostics archive file.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/diagnostics/get-project-diagnostic-archive/

type GlobalAlert

type GlobalAlert struct {
	SourceTypeName string        `json:"sourceTypeName,omitempty"`
	Tags           []string      `json:"tags,omitempty"`
	Links          []*atlas.Link `json:"links,omitempty"`
	HostID         string        `json:"hostId,omitempty"`
	ClusterID      string        `json:"clusterId,omitempty"`

type GlobalAlerts

type GlobalAlerts struct {
	Links      []*atlas.Link  `json:"links"`
	Results    []*GlobalAlert `json:"results"`
	TotalCount int            `json:"totalCount"`

type GlobalAlertsService

GlobalAlertsService is an interface for interfacing with Clusters in MongoDB Ops Manager APIs

type GlobalAlertsServiceOp

type GlobalAlertsServiceOp service

func (*GlobalAlertsServiceOp) Acknowledge

Acknowledge acknowledges a global alert. See more: https://docs.opsmanager.mongodb.com/current/reference/api/global-alerts/

func (*GlobalAlertsServiceOp) Get

Get gets a global alert.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/global-alerts/

func (*GlobalAlertsServiceOp) List

List gets all global alerts.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/global-alerts/

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 {
	ClusterID string `url:"clusterId,omitempty"`

type Hosts

type Hosts struct {
	Links      []*atlas.Link `json:"links"`
	Results    []*Host       `json:"results"`
	TotalCount int           `json:"totalCount"`

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 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"` //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

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

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.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/log-collections/log-collections-delete-one/

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.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/log-collections/log-collections-update-one/

func (*LogCollectionServiceOp) Get

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

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 {
	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

func (*LogsServiceOp) Download

func (s *LogsServiceOp) Download(ctx context.Context, groupID, jobID string, out io.Writer) (*atlas.Response, error)

Download allows to download a log from a collection job.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/log-collections/log-collections-download-job/

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

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

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

Host measurements provide data on the state of the MongoDB process. The Monitoring collects host measurements through the MongoDB serverStatus and dbStats commands.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/measures/get-host-process-system-measurements/

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 MongoDBUser

type MongoDBUser struct {
	Mechanisms                 []string       `json:"mechanisms"`
	Roles                      []*Role        `json:"roles"`
	Username                   string         `json:"user"`
	Database                   string         `json:"db"`
	AuthenticationRestrictions []string       `json:"authenticationRestrictions,omitempty"`
	InitPassword               string         `json:"initPwd,omitempty"` // The cleartext password to be assigned to the user
	ScramSha256Creds           *ScramShaCreds `json:"scramSha256Creds,omitempty"`
	ScramSha1Creds             *ScramShaCreds `json:"scramSha1Creds,omitempty"`

type Net

type Net struct {
	Port int     `json:"port,omitempty"`
	SSL  *NetSSL `json:"ssl,omitempty"`

Net part of the internal Process struct

type NetSSL

type NetSSL struct {
	Mode       string `json:"mode"`
	PEMKeyFile string `json:"PEMKeyFile"`

NetSSL defines SSL parameters for Net

type Options

type Options struct {
	DownloadBase string `json:"downloadBase"`

Options 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 an array of organization

type OrganizationsService

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 *Organization) (*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

func (s *OrganizationsServiceOp) Delete(ctx context.Context, orgID string) (*atlas.Response, error)

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

Get gets a single organization.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/organizations/organization-get-one/

func (*OrganizationsServiceOp) GetProjects

func (s *OrganizationsServiceOp) GetProjects(ctx context.Context, orgID string, opts *atlas.ListOptions) (*Projects, *atlas.Response, error)

GetProjects gets all projects for the given organization ID.

See more: https://docs.opsmanager.mongodb.com/current/reference/api/organizations/organization-get-all-projects/

func (*OrganizationsServiceOp) List added in v0.5.0

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"`
	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 ProcessStatus

type ProcessStatus struct {
	Plan                    []string `json:"plan"`
	LastGoalVersionAchieved int      `json:"lastGoalVersionAchieved"`
	Name                    string   `json:"name"`
	Hostname                string   `json:"hostname"`

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

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

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

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

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"`

ReplicaSet configs

type Replication

type Replication struct {
	ReplSetName string `json:"replSetName,omitempty"`

Replication is part of the internal Process struct

type Role

type Role struct {
	Role     string `json:"role"`
	Database string `json:"db"`

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 ScramShaCreds struct {
	IterationCount int    `json:"iterationCount"`
	Salt           string `json:"salt"`
	ServerKey      string `json:"serverKey"`
	StoredKey      string `json:"storedKey"`

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 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 WhitelistOpts

type WhitelistOpts struct {
	Whitelist []string `url:"whitelist"`

Jump to

Keyboard shortcuts

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