0.3.0 • Published 6 years ago

atlas-api-client v0.3.0

Weekly downloads
9
License
-
Repository
-
Last release
6 years ago

Modules

Functions

atlas-api-client

atlas-api-client client library.

AtlasAPIClient ⏏

atlas-api-client client

Kind: Exported class

new AtlasAPIClient(options)

Create a new client object.

ParamTypeDefaultDescription
optionsObjectOptions for constructing a client object.
options.addressstringURL where the server is located. Must provide this or the discovery argument
options.discoveryboolUse clever-discovery to locate the server. Must provide this or the address argument
options.timeoutnumberThe timeout to use for all client requests, in milliseconds. This can be overridden on a per-request basis. Default is 5000ms.
options.retryPolicyRetryPoliciesRetryPolicies.SingleThe logic to determine which requests to retry, as well as how many times to retry.
options.loggermodule:kayvee.Loggerlogger.New("atlas-api-client-wagclient")The Kayvee logger to use in the client.
options.circuitObjectOptions for constructing the client's circuit breaker.
options.circuit.forceClosedboolWhen set to true the circuit will always be closed. Default: true.
options.circuit.maxConcurrentRequestsnumberthe maximum number of concurrent requests the client can make at the same time. Default: 100.
options.circuit.requestVolumeThresholdnumberThe minimum number of requests needed before a circuit can be tripped due to health. Default: 20.
options.circuit.sleepWindownumberhow long, in milliseconds, to wait after a circuit opens before testing for recovery. Default: 5000.
options.circuit.errorPercentThresholdnumberthe threshold to place on the rolling error rate. Once the error rate exceeds this percentage, the circuit opens. Default: 90.

atlasAPIClient.getClusters(groupID, options, cb) ⇒ Promise

Get All Clusters

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
groupIDstring
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.createCluster(params, options, cb) ⇒ Promise

Create a Cluster

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.createOrUpdateClusterRequest
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.deleteCluster(params, options, cb) ⇒ Promise

Deletes a cluster

Kind: instance method of AtlasAPIClient
Fulfill: undefined
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.clusterNamestring
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.getCluster(params, options, cb) ⇒ Promise

Gets a cluster

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.clusterNamestring
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.updateCluster(params, options, cb) ⇒ Promise

Update a Cluster

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.clusterNamestring
params.createOrUpdateClusterRequest
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.getDatabaseUsers(groupID, options, cb) ⇒ Promise

Get All DatabaseUsers

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
groupIDstring
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.createDatabaseUser(params, options, cb) ⇒ Promise

Create a DatabaseUser

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.createDatabaseUserRequest
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.deleteDatabaseUser(params, options, cb) ⇒ Promise

Deletes a DatabaseUser

Kind: instance method of AtlasAPIClient
Fulfill: undefined
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.usernamestring
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.getDatabaseUser(params, options, cb) ⇒ Promise

Gets a database user

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.usernamestring
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.updateDatabaseUser(params, options, cb) ⇒ Promise

Update a DatabaseUser

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.usernamestring
params.updateDatabaseUserRequest
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.getProcesses(groupID, options, cb) ⇒ Promise

Get All Processes

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
groupIDstring
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.getProcessDatabases(params, options, cb) ⇒ Promise

Get the available databases for a Atlas MongoDB Process

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.hoststring
params.portnumber
params.pageNumnumber
params.itemsPerPagenumber
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.getProcessDatabaseMeasurements(params, options, cb) ⇒ Promise

Get the measurements of the specified database for a Atlas MongoDB process.

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.hoststring
params.portnumber
params.databaseIDstring
params.granularitystring
params.periodstring
params.startstring
params.endstring
params.mArray.<string>
params.pageNumnumber
params.itemsPerPagenumber
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.getProcessDisks(params, options, cb) ⇒ Promise

Get the available disks for a Atlas MongoDB Process

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.hoststring
params.portnumber
params.pageNumnumber
params.itemsPerPagenumber
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.getProcessDiskMeasurements(params, options, cb) ⇒ Promise

Get the measurements of the specified disk for a Atlas MongoDB process.

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.hoststring
params.portnumber
params.diskNamestring
params.granularitystring
params.periodstring
params.startstring
params.endstring
params.mArray.<string>
params.pageNumnumber
params.itemsPerPagenumber
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

atlasAPIClient.getProcessMeasurements(params, options, cb) ⇒ Promise

Get measurements for a specific Atlas MongoDB process (mongod or mongos).

Kind: instance method of AtlasAPIClient
Fulfill: Object
Reject: BadRequest
Reject: Unauthorized
Reject: NotFound
Reject: InternalError
Reject: Error

ParamTypeDescription
paramsObject
params.groupIDstring
params.hoststring
params.portnumber
params.granularitystring
params.periodstring
params.startstring
params.endstring
params.mArray.<string>
params.pageNumnumber
params.itemsPerPagenumber
optionsobject
options.timeoutnumberA request specific timeout
options.spanSpanAn OpenTracing span - For example from the parent request
options.retryPolicyRetryPoliciesA request specific retryPolicy
cbfunction

AtlasAPIClient.RetryPolicies

Retry policies available to use.

Kind: static property of AtlasAPIClient

RetryPolicies.Exponential

The exponential retry policy will retry five times with an exponential backoff.

Kind: static constant of RetryPolicies

RetryPolicies.Single

Use this retry policy to retry a request once.

Kind: static constant of RetryPolicies

RetryPolicies.None

Use this retry policy to turn off retries.

Kind: static constant of RetryPolicies

AtlasAPIClient.Errors

Errors returned by methods.

Kind: static property of AtlasAPIClient

Errors.BadRequest ⇐ Error

BadRequest

Kind: static class of Errors
Extends: Error
Properties

NameType
detailstring
errornumber
messagestring
reasonstring

Errors.Unauthorized ⇐ Error

Unauthorized

Kind: static class of Errors
Extends: Error
Properties

NameType
detailstring
errornumber
messagestring
reasonstring

Errors.NotFound ⇐ Error

NotFound

Kind: static class of Errors
Extends: Error
Properties

NameType
detailstring
errornumber
messagestring
reasonstring

Errors.InternalError ⇐ Error

InternalError

Kind: static class of Errors
Extends: Error
Properties

NameType
detailstring
errornumber
messagestring
reasonstring

AtlasAPIClient.DefaultCircuitOptions

Default circuit breaker options.

Kind: static constant of AtlasAPIClient

responseLog()

Request status log is used to to output the status of a request returned by the client.

Kind: global function