Documentation ¶
Overview ¶
Package core should not be used by end users.
Index ¶
Constants ¶
const ( // DefaultCloudURL is default base URL for the services. DefaultCloudURL = "https://cloud.mongodb.com" // ClientName of the v2 API client. ClientName = "go-atlas-sdk-admin" // DefaultUserAgent is default user agent header. DefaultUserAgent = ClientName + "/" + Version + " (" + runtime.GOOS + ";" + runtime.GOARCH + ")" )
const ( // SDK release tag version. Version = "v20241113002.0.0" // Resource Version. Resource = "20241113" )
Version of the SDK used for the autorelease process. When version is bumped in the PR it means that the PR is ready to be merged. For more information please see: https://github.com/mongodb/atlas-sdk-go/blob/main/docs/doc_1_concepts.md
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { // Response that caused this error Response *http.Response // ErrorCode is the code as specified in https://docs.atlas.mongodb.com/reference/api/api-errors/ ErrorCode string `json:"errorCode"` // HTTPCode status code. HTTPCode int `json:"error"` // Reason is short description of the error, which is simply the HTTP status phrase. Reason string `json:"reason"` // Detail is more detailed description of the error. Detail string `json:"detail,omitempty"` }
ErrorResponse reports the error caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
func (*ErrorResponse) Is ¶
func (r *ErrorResponse) Is(target error) bool
type Response ¶
type Response struct { *http.Response // Links that were returned with the response. Links []*Link `json:"links"` // Raw data from server response Raw []byte `json:"-"` }
Response is a MongoDBAtlas response. This wraps the standard http.Response returned from MongoDBAtlas API.
func (*Response) CheckResponse ¶
func (resp *Response) CheckResponse(body io.ReadCloser) error
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.