Documentation
¶
Index ¶
Constants ¶
const ( // StitchRequestOriginHeader is the name of the header for where the api request // is coming from (UI, CLI, ADMIN API) StitchRequestOriginHeader = "X-STITCH-Request-Origin" // StitchCLIHeaderValue is the value of the StitchRequestOriginHeader if the request // is from the CLI StitchCLIHeaderValue = "mongodb-stitch-cli" )
const DefaultAtlasBaseURL = "https://cloud.mongodb.com"
DefaultAtlasBaseURL is the default atlas prod base url
const DefaultBaseURL = "https://stitch.mongodb.com"
DefaultBaseURL is the default prod base url for Stitch apps
Variables ¶
This section is empty.
Functions ¶
func UnmarshalStitchError ¶
UnmarshalStitchError unmarshals an *http.Response into an ErrStitchResponse. If the Body does not contain content it uses the provided Status
Types ¶
type AuthClient ¶
type AuthClient struct { Client // contains filtered or unexported fields }
AuthClient is a Client that is aware of a User's auth credentials
func NewAuthClient ¶
func NewAuthClient(client Client, user *user.User) *AuthClient
NewAuthClient returns a new *AuthClient
func (*AuthClient) ExecuteRequest ¶
func (ac *AuthClient) ExecuteRequest(method, path string, options RequestOptions) (*http.Response, error)
ExecuteRequest makes a call to the provided path, supplying the user's access token
func (*AuthClient) RefreshAuth ¶
func (ac *AuthClient) RefreshAuth() (auth.Response, error)
RefreshAuth makes a call to the session endpoint using the user's refresh token in order to obtain a new access token
type Client ¶
type Client interface {
ExecuteRequest(method, path string, options RequestOptions) (*http.Response, error)
}
Client represents something that is capable of making HTTP requests
type ErrAppNotFound ¶
type ErrAppNotFound struct {
ClientAppID string
}
ErrAppNotFound is used when an app cannot be found by client app ID
func (ErrAppNotFound) Error ¶
func (eanf ErrAppNotFound) Error() string
type ErrStitchResponse ¶
type ErrStitchResponse struct {
// contains filtered or unexported fields
}
ErrStitchResponse represents a response from a Stitch API call
func (ErrStitchResponse) Error ¶
func (esr ErrStitchResponse) Error() string
Error returns a stringified error message
func (ErrStitchResponse) ErrorCode ¶ added in v1.6.0
func (esr ErrStitchResponse) ErrorCode() string
ErrorCode returns this ErrorCode on the error
func (*ErrStitchResponse) UnmarshalJSON ¶
func (esr *ErrStitchResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON data into an ErrStitchResponse
type ExportStrategy ¶ added in v1.4.0
type ExportStrategy string
ExportStrategy is the enumeration of possible strategies which can be used when exporting a stitch application
const ( // ExportStrategyNone will result in no extra configuration into the call to Export ExportStrategyNone ExportStrategy = "none" // ExportStrategyTemplate will result in the `template` querystring parameter getting added to the call to Export ExportStrategyTemplate ExportStrategy = "template" // ExportStrategySourceControl will result in the `source_control` querystring parameter getting added to the call to Export ExportStrategySourceControl ExportStrategy = "source_control" )
type RequestOptions ¶
RequestOptions represents a simple set of options to use with HTTP requests
type StitchClient ¶
type StitchClient interface { AddSecret(groupID, appID string, secret secrets.Secret) error Authenticate(authProvider auth.AuthenticationProvider) (*auth.Response, error) CopyAsset(groupID, appID, fromPath, toPath string) error CreateDraft(groupID, appID string) (*models.AppDraft, error) CreateEmptyApp(groupID, appName, location, deploymentModel string) (*models.App, error) DeleteAsset(groupID, appID, path string) error DeployDraft(groupID, appID, draftID string) (*models.Deployment, error) Diff(groupID, appID string, appData []byte, strategy string) ([]string, error) DiscardDraft(groupID, appID, draftID string) error DraftDiff(groupID, appID, draftID string) (*models.DraftDiff, error) Export(groupID, appID string, strategy ExportStrategy) (string, io.ReadCloser, error) ExportDependencies(groupID, appID string) (string, io.ReadCloser, error) FetchAppByClientAppID(clientAppID string) (*models.App, error) FetchAppByGroupIDAndClientAppID(groupID, clientAppID string) (*models.App, error) FetchAppsByGroupID(groupID string) ([]*models.App, error) GetDeployment(groupID, appID, deploymentID string) (*models.Deployment, error) GetDrafts(groupID, appID string) ([]models.AppDraft, error) Import(groupID, appID string, appData []byte, strategy string) error InvalidateCache(groupID, appID, path string) error ListAssetsForAppID(groupID, appID string) ([]hosting.AssetMetadata, error) ListSecrets(groupID, appID string) ([]secrets.Secret, error) MoveAsset(groupID, appID, fromPath, toPath string) error RemoveSecretByID(groupID, appID, secretID string) error RemoveSecretByName(groupID, appID, secretName string) error SetAssetAttributes(groupID, appID, path string, attributes ...hosting.AssetAttribute) error UpdateSecretByID(groupID, appID, secretID, secretValue string) error UpdateSecretByName(groupID, appID, secretName, secretValue string) error UploadAsset(groupID, appID, path, hash string, size int64, body io.Reader, attributes ...hosting.AssetAttribute) error UploadDependencies(groupID, appID, fullPath string) error }
StitchClient represents a Client that can be used to call the Stitch Admin API
func NewStitchClient ¶
func NewStitchClient(client Client) StitchClient
NewStitchClient returns a new StitchClient to be used for making calls to the Stitch Admin API