Documentation ¶
Index ¶
- func Bool(v bool) *bool
- func CheckResponse(r *http.Response) error
- func DoRequest(ctx context.Context, req *http.Request) (*http.Response, error)
- func DoRequestWithClient(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)
- func Int(v int) *int
- func StreamToString(stream io.Reader) string
- func String(v string) *string
- func Stringify(message interface{}) string
- type ArgError
- type AwsAccount
- type AwsAccountCreateOrUpdateRequest
- type AwsAccountData
- type AwsAccountDataEdge
- type AwsAccountDataText
- type AwsAccountDataTextMapPos
- type AwsAccountIamParameters
- type AwsAccountSnapshot
- type AwsAccountSnapshotParameters
- type AwsAccountSnapshotRequest
- type AwsAccountsRoot
- type AwsAccountsService
- type AwsAccountsServiceOp
- func (s *AwsAccountsServiceOp) Create(ctx context.Context, createRequest *AwsAccountCreateOrUpdateRequest) (*AwsAccount, *Response, error)
- func (s *AwsAccountsServiceOp) Delete(ctx context.Context, awsAccountID string) (*Response, error)
- func (s *AwsAccountsServiceOp) Get(ctx context.Context, awsAccountID string) (*AwsAccount, *Response, error)
- func (s *AwsAccountsServiceOp) IamParameters(ctx context.Context) (*AwsAccountIamParameters, *Response, error)
- func (s *AwsAccountsServiceOp) List(ctx context.Context) ([]AwsAccount, *Response, error)
- func (s *AwsAccountsServiceOp) Snapshot(ctx context.Context, awsAccountID string, ...) (*AwsAccountSnapshot, *Response, error)
- func (s *AwsAccountsServiceOp) Update(ctx context.Context, awsAccountID string, ...) (*AwsAccount, *Response, error)
- type Blueprint
- type BlueprintCreateRequest
- type BlueprintData
- type BlueprintExportParameters
- type BlueprintExportRequest
- type BlueprintImage
- type BlueprintUpdateRequest
- type BlueprintsRoot
- type BlueprintsService
- type BlueprintsServiceOp
- func (s *BlueprintsServiceOp) Create(ctx context.Context, createRequest *BlueprintCreateRequest) (*Blueprint, *Response, error)
- func (s *BlueprintsServiceOp) Delete(ctx context.Context, blueprintId string) (*Response, error)
- func (s *BlueprintsServiceOp) Export(ctx context.Context, blueprintId string, exportRequest *BlueprintExportRequest) (*BlueprintImage, *Response, error)
- func (s *BlueprintsServiceOp) Get(ctx context.Context, blueprintId string) (*Blueprint, *Response, error)
- func (s *BlueprintsServiceOp) List(ctx context.Context) ([]Blueprint, *Response, error)
- func (s *BlueprintsServiceOp) Update(ctx context.Context, blueprintId string, updateRequest *BlueprintUpdateRequest) (*Blueprint, *Response, error)
- type Client
- type ClientOpt
- type ErrorResponse
- type RequestCompletionCallback
- type ResourceWithURN
- type Response
- type Timestamp
- type User
- type UsersService
- type UsersServiceOp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.
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.
func DoRequestWithClient ¶
func DoRequestWithClient( ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)
DoRequestWithClient submits an HTTP request using the specified client.
func Int ¶
Int is a helper routine that allocates a new int32 value to store v and returns a pointer to it, but unlike Int32 its argument value is an int.
func StreamToString ¶
StreamToString converts a reader to a string
Types ¶
type ArgError ¶
type ArgError struct {
// contains filtered or unexported fields
}
ArgError is an error that represents an error with an input to cloudcraft-go. It identifies the argument and the cause (if possible).
func NewArgError ¶
NewArgError creates an InputError.
type AwsAccount ¶
type AwsAccount struct { CreatedAt time.Time `json:"createdAt,omitempty"` CreatorId string `json:"CreatorId,omitempty"` ExternalId string `json:"externalId"` Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` RoleArn string `json:"roleArn,omitempty"` UpdatedAt time.Time `json:"createdAt,omitempty"` }
AwsAccount represents a Cloudcraft AwsAccount
type AwsAccountCreateOrUpdateRequest ¶
type AwsAccountCreateOrUpdateRequest struct { Name string `json:"name"` RoleArn string `json:"roleArn"` }
func (AwsAccountCreateOrUpdateRequest) String ¶
func (d AwsAccountCreateOrUpdateRequest) String() string
type AwsAccountData ¶
type AwsAccountData struct { Grid string `json:"grid,omitempty"` LinkKey string `json:"linkKey,omitempty"` Name string `json:"name,omitempty"` Text []map[string]interface{} `json:"text,omitempty"` Edges []map[string]interface{} `json:"edges,omitempty"` Icons []map[string]interface{} `json:"icons,omitempty"` Nodes []map[string]interface{} `json:"nodes,omitempty"` Groups []map[string]interface{} `json:"groups,omitempty"` Images []map[string]interface{} `json:"images,omitempty"` Surfaces []map[string]interface{} `json:"surfaces,omitempty"` Connectors []map[string]interface{} `json:"connectors,omitempty"` DisabledLayers []map[string]interface{} `json:"disabledLayers,omitempty"` }
type AwsAccountDataEdge ¶
type AwsAccountDataText ¶
type AwsAccountDataText struct { Id string `json:"id,omitempty"` Text string `json:"text,omitempty"` Type string `json:"type,omitempty"` Color string `json:"color,omitempty"` TextSize int `json:"textSize,omitempty"` Direction string `json:"direction,omitempty"` Isometric bool `json:"isometric,omitempty"` MapPos AwsAccountDataTextMapPos `json:"mapPos,omitempty"` }
type AwsAccountDataTextMapPos ¶
type AwsAccountDataTextMapPos struct { RelTo string `json:"relTo,omitempty"` // contains filtered or unexported fields }
type AwsAccountIamParameters ¶
type AwsAccountIamParameters struct { AccountId string `json:"accountId"` ExternalId string `json:"externalId"` AwsConsoleUrl string `json:"awsConsoleUrl"` }
func (AwsAccountIamParameters) String ¶
func (d AwsAccountIamParameters) String() string
type AwsAccountSnapshot ¶
type AwsAccountSnapshot struct { ContentType string Content *bytes.Buffer SnapshotParameters *AwsAccountSnapshotParameters }
type AwsAccountSnapshotParameters ¶
type AwsAccountSnapshotParameters struct { Autoconnect bool `url:"autoconnect,omitempty"` Exclude []string `url:"exclude,omitempty,comma"` Filter string `url:"filter,omitempty"` Grid bool `url:"grid,omitempty"` Height int `url:"height,omitempty"` Label bool `url:"label,omitempty"` Landscape bool `url:"landscape,omitempty"` PaperSize string `url:"paperSize,omitempty"` Projection string `url:"projection,omitempty"` Scale float32 `url:"scale,omitempty"` Transparent bool `url:"transparent,omitempty"` Width int `url:"width,omitempty"` }
type AwsAccountSnapshotRequest ¶
type AwsAccountSnapshotRequest struct { Format string Region string SnapshotParameters *AwsAccountSnapshotParameters }
func (AwsAccountSnapshotRequest) String ¶
func (d AwsAccountSnapshotRequest) String() string
type AwsAccountsRoot ¶
type AwsAccountsRoot struct {
AwsAccounts []AwsAccount `json:"accounts"`
}
type AwsAccountsService ¶
type AwsAccountsService interface { List(context.Context) ([]AwsAccount, *Response, error) Get(context.Context, string) (*AwsAccount, *Response, error) Create(context.Context, *AwsAccountCreateOrUpdateRequest) (*AwsAccount, *Response, error) Update(context.Context, string, *AwsAccountCreateOrUpdateRequest) (*AwsAccount, *Response, error) Delete(context.Context, string) (*Response, error) Snapshot(context.Context, string, *AwsAccountSnapshotRequest) (*AwsAccountSnapshot, *Response, error) IamParameters(context.Context) (*AwsAccountIamParameters, *Response, error) }
AwsAccountsService is an interface for interfacing with the AwsAccounts endpoints of the Cloudcraft API See: https://developers.cloudcraft.co/#dbc3d135-6447-47f2-b043-bae65b722246
type AwsAccountsServiceOp ¶
type AwsAccountsServiceOp struct {
// contains filtered or unexported fields
}
AwsAccountsServiceOp handles communication with the AwsAccount related methods of the Cloudcraft API.
func (*AwsAccountsServiceOp) Create ¶
func (s *AwsAccountsServiceOp) Create(ctx context.Context, createRequest *AwsAccountCreateOrUpdateRequest) (*AwsAccount, *Response, error)
Create AwsAccount
func (*AwsAccountsServiceOp) Get ¶
func (s *AwsAccountsServiceOp) Get(ctx context.Context, awsAccountID string) (*AwsAccount, *Response, error)
Get individual AwsAccount.
func (*AwsAccountsServiceOp) IamParameters ¶
func (s *AwsAccountsServiceOp) IamParameters(ctx context.Context) (*AwsAccountIamParameters, *Response, error)
Get AwsAccount IAM Parameters.
func (*AwsAccountsServiceOp) List ¶
func (s *AwsAccountsServiceOp) List(ctx context.Context) ([]AwsAccount, *Response, error)
List all AwsAccounts.
func (*AwsAccountsServiceOp) Snapshot ¶
func (s *AwsAccountsServiceOp) Snapshot(ctx context.Context, awsAccountID string, snapshotRequest *AwsAccountSnapshotRequest) (*AwsAccountSnapshot, *Response, error)
Snapshot AwsAccount.
func (*AwsAccountsServiceOp) Update ¶
func (s *AwsAccountsServiceOp) Update(ctx context.Context, awsAccountID string, updateRequest *AwsAccountCreateOrUpdateRequest) (*AwsAccount, *Response, error)
Update AwsAccount
type Blueprint ¶
type Blueprint struct { Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` CreatedAt time.Time `json:"createdAt,omitempty"` UpdatedAt time.Time `json:"createdAt,omitempty"` CreatorId string `json:"CreatorId,omitempty"` LastUserId string `json:"LastUserId,omitempty"` Data *BlueprintData `json:data,omitempty` }
Blueprint represents a Cloudcraft Blueprint
type BlueprintCreateRequest ¶
type BlueprintCreateRequest struct {
Data *BlueprintData `json:"data"`
}
BlueprintCreateRequest represents a request to create a Blueprint.
func (BlueprintCreateRequest) String ¶
func (d BlueprintCreateRequest) String() string
type BlueprintData ¶
type BlueprintData struct { Grid string `json:"grid,omitempty"` LinkKey string `json:"linkKey,omitempty"` Name string `json:"name,omitempty"` Text []map[string]interface{} `json:"text,omitempty"` Edges []map[string]interface{} `json:"edges,omitempty"` Icons []map[string]interface{} `json:"icons,omitempty"` Nodes []map[string]interface{} `json:"nodes,omitempty"` Groups []map[string]interface{} `json:"groups,omitempty"` Images []map[string]interface{} `json:"images,omitempty"` Surfaces []map[string]interface{} `json:"surfaces,omitempty"` Connectors []map[string]interface{} `json:"connectors,omitempty"` DisabledLayers []map[string]interface{} `json:"disabledLayers,omitempty"` }
type BlueprintExportRequest ¶
type BlueprintExportRequest struct { Format string ExportParameters *BlueprintExportParameters }
func (BlueprintExportRequest) String ¶
func (d BlueprintExportRequest) String() string
type BlueprintImage ¶
type BlueprintImage struct { ContentType string Content *bytes.Buffer ExportParameters *BlueprintExportParameters }
type BlueprintUpdateRequest ¶
type BlueprintUpdateRequest struct {
Data *BlueprintData `json:"data"`
}
BlueprintCreateRequest represents a request to update a Blueprint.
func (BlueprintUpdateRequest) String ¶
func (d BlueprintUpdateRequest) String() string
type BlueprintsRoot ¶
type BlueprintsRoot struct {
Blueprints []Blueprint `json:"blueprints"`
}
type BlueprintsService ¶
type BlueprintsService interface { List(context.Context) ([]Blueprint, *Response, error) Get(context.Context, string) (*Blueprint, *Response, error) Create(context.Context, *BlueprintCreateRequest) (*Blueprint, *Response, error) Update(context.Context, string, *BlueprintUpdateRequest) (*Blueprint, *Response, error) Delete(context.Context, string) (*Response, error) Export(context.Context, string, *BlueprintExportRequest) (*BlueprintImage, *Response, error) }
BlueprintsService is an interface for interfacing with the Blueprints endpoints of the Cloudcraft API See: https://developers.cloudcraft.co/#dbc3d135-6447-47f2-b043-bae65b722246
type BlueprintsServiceOp ¶
type BlueprintsServiceOp struct {
// contains filtered or unexported fields
}
BlueprintsServiceOp handles communication with the Blueprint related methods of the Cloudcraft API.
func (*BlueprintsServiceOp) Create ¶
func (s *BlueprintsServiceOp) Create(ctx context.Context, createRequest *BlueprintCreateRequest) (*Blueprint, *Response, error)
Create Blueprint
func (*BlueprintsServiceOp) Export ¶
func (s *BlueprintsServiceOp) Export(ctx context.Context, blueprintId string, exportRequest *BlueprintExportRequest) (*BlueprintImage, *Response, error)
imageMediaType = "image/svg+xml, image/png, application/pdf, application/xml, application/json" Export Blueprint.
func (*BlueprintsServiceOp) Get ¶
func (s *BlueprintsServiceOp) Get(ctx context.Context, blueprintId string) (*Blueprint, *Response, error)
Get individual Blueprint.
func (*BlueprintsServiceOp) Update ¶
func (s *BlueprintsServiceOp) Update(ctx context.Context, blueprintId string, updateRequest *BlueprintUpdateRequest) (*Blueprint, *Response, error)
Update Blueprint
type Client ¶
type Client struct { // Base URL for API requests. BaseURL *url.URL // User agent for client UserAgent string // Services used for communicating with the API AwsAccounts AwsAccountsService Blueprints BlueprintsService Users UsersService // contains filtered or unexported fields }
func NewClient ¶
NewClient returns a new Cloudcraft API client, using the given http.Client to perform all requests.
Users who wish to pass their own http.Client should use this method. If you're in need of further customization, the godo.New method allows more options, such as setting a custom URL or a custom user agent string.
func NewFromToken ¶
NewFromToken returns a new Cloudcraft API client with the given API token.
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.
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, which will be resolved 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 in as the request body.
func (*Client) OnRequestCompleted ¶
func (c *Client) OnRequestCompleted(rc 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 SetRequestHeaders ¶
SetRequestHeaders sets optional HTTP headers on the client that are sent on each HTTP request.
func SetUserAgent ¶
SetUserAgent is a client option for setting the user agent.
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // Error message Message string `json:"error"` // Error code Code int `json:"code"` }
An ErrorResponse reports the error caused by an API request
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type ResourceWithURN ¶
type ResourceWithURN interface {
URN() string
}
ResourceWithURN is an interface for interfacing with the types that implement the URN method.
type Response ¶
Response is a Cloudcraft response. This wraps the standard http.Response returned from Cloudcraft.
type Timestamp ¶
Timestamp represents a time that can be unmarshalled from a JSON string formatted as either an RFC3339 or Unix timestamp. All exported methods of time.Time can be called on Timestamp.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface. Time is expected in RFC3339 or Unix format.
type User ¶
type User struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` CreatedAt time.Time `json:"createdAt,omitempty"` UpdatedAt time.Time `json:"createdAt,omitempty"` CreatorId string `json:"CreatorId,omitempty"` LastUserId string `json:"LastUserId,omitempty"` }
User represents a Cloudcraft User
type UsersService ¶
UsersService is an interface for interfacing with the Users endpoints of the Cloudcraft API See: https://developers.cloudcraft.co/#398fa0e6-3139-41e6-a5c2-3b9a31e15d6d
type UsersServiceOp ¶
type UsersServiceOp struct {
// contains filtered or unexported fields
}
UsersServiceOp handles communication with the User related methods of the Cloudcraft API.