Documentation ¶
Index ¶
- type Client
- func (a Client) Create(ctx context.Context, resourceType automation.ResourceType, data []byte) (result Response, err error)
- func (a Client) Delete(ctx context.Context, resourceType automation.ResourceType, id string) (Response, error)
- func (a Client) Get(ctx context.Context, resourceType automation.ResourceType, id string) (Response, error)
- func (a Client) List(ctx context.Context, resourceType automation.ResourceType) (ListResponse, error)
- func (a Client) Update(ctx context.Context, resourceType automation.ResourceType, id string, ...) (Response, error)
- func (a Client) Upsert(ctx context.Context, resourceType automation.ResourceType, id string, ...) (result Response, err error)
- type ClientOption
- type ListResponse
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client can be used to interact with the Automation API
func NewClient ¶
NewClient creates and returns a new instance a client which is used for interacting with automation resources.
Parameters:
- client: A REST client used for making HTTP requests to interact with automation resources.
Returns:
- *Client: A new instance of the Client type initialized with the provided REST client and resources.
func (Client) Create ¶
func (a Client) Create(ctx context.Context, resourceType automation.ResourceType, data []byte) (result Response, err error)
Create creates a new automation object based on the specified resource type.
Parameters:
- ctx: The context for the HTTP request.
- resourceType: The type of the resource to retrieve.
- data: the data of the resource
Returns:
- Response: A Response containing the result of the HTTP operation, including status code and data.
- error: An error if the HTTP call fails or another error happened.
func (Client) Delete ¶
func (a Client) Delete(ctx context.Context, resourceType automation.ResourceType, id string) (Response, error)
Delete removes an automation object of the specified resource type by its unique identifier (ID).
If the initial DELETE request results in a forbidden status code (HTTP 403) for Workflows, it retries the request without the "adminAccess" parameter.
Parameters:
- ctx: A context.Context for controlling the request lifecycle.
- resourceType: The type of resource from which to delete the object.
- id: The unique identifier (ID) of the object to delete.
Returns:
- Response: A Response containing the result of the HTTP operation, including status code and data.
- error: An error if the HTTP call fails or another error happened.
func (Client) Get ¶
func (a Client) Get(ctx context.Context, resourceType automation.ResourceType, id string) (Response, error)
Get retrieves a single automation object based on the specified resource type and ID.
It checks if the ID is non-empty, and if not, returns an error.
Parameters:
- ctx: The context for the HTTP request.
- resourceType: The type of the resource to retrieve.
- id: The unique identifier of the object to retrieve.
Returns:
- Response: A Response containing the result of the HTTP operation, including status code and data.
- error: An error if the HTTP call fails or another error happened.
func (Client) List ¶
func (a Client) List(ctx context.Context, resourceType automation.ResourceType) (ListResponse, error)
List retrieves a list of automation objects of the specified resource
The function sends multiple HTTP GET requests to fetch paginated data. It continues making requests until the total number of objects retrieved matches the expected count provided by the server.
The result is returned as a slice of ListResponse objects. Each ListResponse contains information about the HTTP response, including the status code, response data, and request details. The objects retrieved from each paginated request are stored as byte slices within the ListResponse.
Parameters:
- ctx: A context.Context for controlling the request lifecycle.
- resourceType: The type of resource to list.
Returns:
- ListResponse: A ListResponse which is an api.PagedListResponse containing all objects fetched from the api
- error: An error if the HTTP call fails or another error happened.
func (Client) Update ¶
func (a Client) Update(ctx context.Context, resourceType automation.ResourceType, id string, data []byte) (Response, error)
Update updates an automation object based on the specified resource type and id
Parameters:
- ctx: The context for the HTTP request.
- resourceType: The type of the resource to retrieve.
- id: the id of the resource to be updated
- data: the updated data
Returns:
- Response: A Response containing the result of the HTTP operation, including status code and data.
- error: An error if the HTTP call fails or another error happened.
func (Client) Upsert ¶
func (a Client) Upsert(ctx context.Context, resourceType automation.ResourceType, id string, data []byte) (result Response, err error)
Upsert creates or updates an object of a specified resource type with the given ID and data.
Parameters:
- ctx: The context for the HTTP request.
- resourceType: The type of the resource to upsert.
- id: The unique identifier for the object.
- data: The data payload representing the object.
Returns:
- Response: A Response containing the result of the HTTP operation, including status code and data.
- error: An error if the HTTP call fails or another error happened.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption are (optional) additional parameter passed to the creation of an automation client
type ListResponse ¶
type ListResponse = api.PagedListResponse