Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type Application
- type ApplicationListOptions
- type AppsService
- type AppsServiceOp
- type Client
- type ClientOpt
- type ErrorResponse
- type EventTrigger
- type EventTriggerConfig
- type EventTriggerRequest
- type EventTriggersService
- type EventTriggersServiceOp
- func (s *EventTriggersServiceOp) Create(ctx context.Context, groupID, appID string, createRequest *EventTriggerRequest) (*EventTrigger, *Response, error)
- func (s *EventTriggersServiceOp) Delete(ctx context.Context, groupID, appID, triggerID string) (*Response, error)
- func (s *EventTriggersServiceOp) Get(ctx context.Context, groupID, appID, triggerID string) (*EventTrigger, *Response, error)
- func (s EventTriggersServiceOp) List(ctx context.Context, groupID, appID string) ([]EventTrigger, *Response, error)
- func (s *EventTriggersServiceOp) Update(ctx context.Context, groupID, appID, triggerID string, ...) (*EventTrigger, *Response, error)
- type RequestCompletionCallback
- type Response
Constants ¶
const ( // URL specifies the public cloud base url. URL = "https://realm.mongodb.com/" // APIAdminV3Path specifies the v3 adminapi path. APIAdminV3Path = "api/admin/v3.0/" )
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type Application ¶
type Application struct { ID string `json:"_id,omitempty"` ClientAppID string `json:"client_app_id,omitempty"` Name string `json:"name,omitempty"` Location string `json:"location,omitempty"` DeploymentModel string `json:"deployment_model,omitempty"` DomainID string `json:"domain_id,omitempty"` GroupID string `json:"group_id,omitempty"` }
type ApplicationListOptions ¶
type ApplicationListOptions struct {
Product string `url:"product,omitempty"`
}
type AppsService ¶
type AppsService interface {
List(context.Context, string, *ApplicationListOptions) ([]Application, *Response, error)
}
AppsService provides access to the applications related functions in the Realm API.
See more: https://docs.mongodb.com/realm/admin/api/v3/#application-level-apis
type AppsServiceOp ¶
type AppsServiceOp service
AppsServiceOp provides an implementation of the AppsService interface.
func (*AppsServiceOp) List ¶
func (s *AppsServiceOp) List(ctx context.Context, groupID string, opts *ApplicationListOptions) ([]Application, *Response, error)
List all Realm apps within an Atlas project/group.
See more: https://docs.mongodb.com/realm/admin/api/v3/#application-level-apis
type Client ¶
type Client struct { BaseURL *url.URL UserAgent string Apps AppsService EventTriggers EventTriggersService // contains filtered or unexported fields }
Client manages communication with Ops Manager API.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it. 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) 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 URL 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 mongodbatlas.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.
func SetWithRaw ¶
func SetWithRaw() ClientOpt
SetWithRaw is a client option for getting raw atlas server response within Response structure.
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // The error code as specified in https://docs.atlas.mongodb.com/reference/api/api-errors/ ErrorCode string `json:"error_code"` // A short description of the error, which is simply the HTTP status phrase. Reason string `json:"reason"` // A more detailed description of the error. Detail string `json:"error,omitempty"` }
ErrorResponse reports the error caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type EventTrigger ¶
type EventTrigger struct { ID string `json:"_id,omitempty"` Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` FunctionID string `json:"function_id,omitempty"` FunctionName string `json:"function_name,omitempty"` Disabled *bool `json:"disabled,omitempty"` Config EventTriggerConfig `json:"config,omitempty"` EventProcessors map[string]interface{} `json:"event_processors,omitempty"` LastModified *int64 `json:"last_modified,omitempty"` }
EventTrigger Represents a response of a trigger
type EventTriggerConfig ¶
type EventTriggerConfig struct { OperationTypes []string `json:"operation_types,omitempty"` OperationType string `json:"operation_type,omitempty"` Providers []string `json:"providers,omitempty"` Database string `json:"database,omitempty"` Collection string `json:"collection,omitempty"` ServiceID string `json:"service_id,omitempty"` Match interface{} `json:"match,omitempty"` Project interface{} `json:"project,omitempty"` FullDocument *bool `json:"full_document,omitempty"` FullDocumentBeforeChange *bool `json:"full_document_before_change,omitempty"` Schedule string `json:"schedule,omitempty"` ScheduleType string `json:"schedule_type,omitempty"` Unordered *bool `json:"unordered,omitempty"` ClusterName string `json:"clusterName,omitempty"` }
EventTriggerConfig Represents a request of a trigger config
type EventTriggerRequest ¶
type EventTriggerRequest struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` FunctionID string `json:"function_id,omitempty"` Disabled *bool `json:"disabled,omitempty"` Config *EventTriggerConfig `json:"config,omitempty"` EventProcessors map[string]interface{} `json:"event_processors,omitempty"` }
EventTriggerRequest Represents a request of create a trigger
type EventTriggersService ¶
type EventTriggersService interface { Create(context.Context, string, string, *EventTriggerRequest) (*EventTrigger, *Response, error) Get(context.Context, string, string, string) (*EventTrigger, *Response, error) List(context.Context, string, string) ([]EventTrigger, *Response, error) Update(context.Context, string, string, string, *EventTriggerRequest) (*EventTrigger, *Response, error) Delete(context.Context, string, string, string) (*Response, error) }
EventTriggersService provides access to the event triggers related functions in the Realm API.
See more: https://docs.mongodb.com/realm/admin/api/v3/#event-trigger-apis
type EventTriggersServiceOp ¶
type EventTriggersServiceOp service
EventTriggersServiceOp provides an implementation of the EventTriggersService interface.
func (*EventTriggersServiceOp) Create ¶
func (s *EventTriggersServiceOp) Create(ctx context.Context, groupID, appID string, createRequest *EventTriggerRequest) (*EventTrigger, *Response, error)
Create one trigger.
See more: https://docs.mongodb.com/realm/admin/api/v3/#post-/groups/%7Bgroupid%7D/apps/%7Bappid%7D/triggers
func (*EventTriggersServiceOp) Delete ¶
func (s *EventTriggersServiceOp) Delete(ctx context.Context, groupID, appID, triggerID string) (*Response, error)
Delete one trigger.
func (*EventTriggersServiceOp) Get ¶
func (s *EventTriggersServiceOp) Get(ctx context.Context, groupID, appID, triggerID string) (*EventTrigger, *Response, error)
Get Retrieve the configuration for a specific trigger.
func (EventTriggersServiceOp) List ¶
func (s EventTriggersServiceOp) List(ctx context.Context, groupID, appID string) ([]EventTrigger, *Response, error)
List all triggers.
See more: https://docs.mongodb.com/realm/admin/api/v3/#responses-96
func (*EventTriggersServiceOp) Update ¶
func (s *EventTriggersServiceOp) Update(ctx context.Context, groupID, appID, triggerID string, updateRequest *EventTriggerRequest) (*EventTrigger, *Response, error)
Update updates a trigger.
type RequestCompletionCallback ¶
type RequestCompletionCallback = mongodbatlas.RequestCompletionCallback
type Response ¶
type Response = mongodbatlas.Response