buckets

package
v0.0.0-...-7c6f6d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

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

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

func NewClient(client *rest.Client) *Client

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

func (c Client) Create(ctx context.Context, data []byte) (*http.Response, error)

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

func (c Client) Delete(ctx context.Context, bucketName string) (*http.Response, error)

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

func (c Client) Get(ctx context.Context, bucketName string) (*http.Response, error)

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

func (c Client) List(ctx context.Context) (*http.Response, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL