gcsutil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gcsutil contains utility functions for Google Cloud Storage data access.

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
}

The documentation for context states:

Contexts should not be stored inside a struct type, but instead passed
to each function that needs it.

However, while it is generally important to pass the Context rather than store it in another type, in the case below, this is not needed since there is no risk of confusion. Indeed, the context is only used for the GCS client here. Note that, if the use of context is extended in the future, then it should be passed explicitly to each function that needs it as an argument.

Client contains a Google Cloud Storage client and a context.Context.

func NewClientWithContext

func NewClientWithContext(ctx context.Context) (*Client, error)

NewClientWithContext creates and returns a new Client. The given ctx is used for the lifetime of the Client!

func (*Client) GetBlobData

func (c *Client) GetBlobData(bucketName string, blobPath string) ([]byte, error)

GetBlobData gets the data in a blob in a Google Cloud Storage bucket.

func (*Client) GetLogsData

func (c *Client) GetLogsData(bucketName string, relativePath string) ([][]byte, error)

GetLogsData gets the data in log-files in a Google Cloud Storage bucket under a relative path.

func (*Client) ListBlobPaths

func (c *Client) ListBlobPaths(bucketName string, relativePath string) ([]string, error)

ListBlobPaths returns all the objects paths in a Google Cloud Storage bucket under a given relative path.

func (*Client) ListLogFilePaths

func (c *Client) ListLogFilePaths(bucketName string, relativePath string) ([]string, error)

ListLogFilePaths returns all the log-files paths in a Google Cloud Storage bucket under a given relative path.

type ContextInStruct

type ContextInStruct context.Context

ContextInStruct contains contexts that can be used in structures when there is no risk of confusion. Using context.Context directly can lead to linting errors.

Jump to

Keyboard shortcuts

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