Documentation ¶
Overview ¶
Package buckets (api/clients/buckets) provides a simple CRUD client for the Grail Bucket API. For a 'smart' API client see package clients/buckets.
Index ¶
- type Client
- func (c Client) Create(ctx context.Context, data []byte) (*http.Response, error)
- func (c Client) Delete(ctx context.Context, bucketName string) (*http.Response, error)
- func (c Client) Get(ctx context.Context, bucketName string) (*http.Response, error)
- func (c Client) List(ctx context.Context) (*http.Response, error)
- func (c Client) Update(ctx context.Context, bucketName string, bucketVersion string, data []byte) (*http.Response, error)
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
}
func NewClient ¶
NewClient creates a new instance of a Client, which provides methods for interacting with the Grail bucket management API. This function initializes and returns a new Client instance that can be used to perform various operations on the remote server.
Parameters:
- client: A pointer to a rest.Client instance used for making HTTP requests to the remote server.
- option: A variadic slice of client Option. Each Option will be applied to the new Client and define options such as retry settings.
Returns:
- *Client: A pointer to a new Client instance initialized with the provided rest.Client and logger.
func (Client) Create ¶
Create a new bucket by making a HTTP POST request against the API.
Parameters:
- ctx: Context for controlling the HTTP operation's lifecycle. Possibly containing a logger created with logr.NewContext.
- data: The data containing information about the new bucket.
Returns:
- Response: A Response containing the result of the HTTP call, including status code and data.
- error: An error if the HTTP call fails or another error happened.
func (Client) Delete ¶
Delete a bucket by name, by making a HTTP DELETE /<bucketName> request against the API.
Parameters:
- ctx: Context for controlling the HTTP operation's lifecycle. Possibly containing a logger created with logr.NewContext.
- bucketName: The name of the bucket to delete.
Returns:
- Response: A Response containing the result of the HTTP call, including status code and data.
- error: An error if the HTTP call fails or another error happened.
func (Client) Get ¶
Get a bucket by name, by making a HTTP GET /<bucketName> request against the API.
Parameters:
- ctx: Context for controlling the HTTP operation's lifecycle. Possibly containing a logger created with logr.NewContext.
- bucketName: The name of the bucket to query.
Returns:
- Response: A Response containing the result of the HTTP call, including status code and data.
- error: An error if the HTTP call fails or another error happened.
func (Client) List ¶
List all buckets, by making a HTTP GET request against the API.
Parameters:
- ctx: Context for controlling the HTTP operation's lifecycle. Possibly containing a logger created with logr.NewContext.
Returns:
- Response: A Response containing the result of the HTTP call, including status code and data.
- error: An error if the HTTP call fails or another error happened.
func (Client) Update ¶
func (c Client) Update(ctx context.Context, bucketName string, bucketVersion string, data []byte) (*http.Response, error)
Update a bucket by name, by making a HTTP PUT /<bucketName> request against the API.
Parameters:
- ctx: Context for controlling the HTTP operation's lifecycle. Possibly containing a logger created with logr.NewContext.
- bucketName: The name of the bucket to update.
- bucketVersion: The expected version of the bucket. If this does not match the current version, the API will return a HTTP 409 Conflict error.
- data: The data to update the bucket to.
Returns:
- Response: A Response containing the result of the HTTP call, including status code and data.
- error: An error if the HTTP call fails or another error happened.