storage

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

README

Kubemq storage target Connector

Kubemq gcp-storage target connector allows services using kubemq server to access google storage server.

Prerequisites

The following required to run the gcp-storage target connector:

  • kubemq cluster
  • gcp-storage set up
  • kubemq-targets deployment

Configuration

storage target connector configuration properties:

Properties Key Required Description Example
credentials yes gcp credentials files "<google json credentials"

Example:

bindings:
  - name: kubemq-query-gcp-storage
    source:
      kind: kubemq.query
      name: kubemq-query
      properties:
        address: "kubemq-cluster:50000"
        client_id: "kubemq-query-gcp-storage-connector"
        auth_token: ""
        channel: "query.gcp.storage"
        group:   ""
        auto_reconnect: "true"
        reconnect_interval_seconds: "1"
        max_reconnects: "0"
    target:
      kind: gcp.storage
      name: gcp-storage
      properties:
        credentials: 'json'

Usage

Create bucket

create a new bucket under storage

Create bucket metadata settings:

Metadata Key Required Description Possible values
method yes type of method "create_bucket"
bucket yes bucket name "bucket name"
storage_class yes gcp-storage_class "storage_class"
project_id yes gcp storage project_id "/myproject"
location yes gcp storage valid location "gcp-supported locations"

Example:

{
  "metadata": {
    "method": "create_bucket",
    "bucket": "myBucketName",
    "storage_class": "COLDLINE",
    "project_id": "MyID",
    "location": "us"
  },
  "data": null
}
Upload file

upload a file to selected bucket

Upload file metadata settings:

Metadata Key Required Description Possible values
method yes type of method "upload"
bucket yes bucket name "bucket name"
object yes object name to save the file under "anyString"
path yes path to the file to upload "<absolute or relative path to file/filename.type>"

Example:

{
  "metadata": {
    "method": "upload",
    "bucket": "myBucketName",
    "object": "MyFile",
    "path": "./myFile.yaml"
  },
  "data": null
}
Delete file

delete file from a bucket

Delete file metadata settings:

Metadata Key Required Description Possible values
method yes type of method "delete"
bucket yes bucket name "bucket name"
object yes object name "anyString"

Example:

{
  "metadata": {
    "method": "delete",
    "bucket": "myBucketName",
    "object": "MyFile"
  },
  "data": null
}
Download file

download file from bucket by object name

Download file metadata settings:

Metadata Key Required Description Possible values
method yes type of method "download"
bucket yes bucket name "bucket name"
object yes object name "anyString"

Example:

{
  "metadata": {
    "method": "download",
    "bucket": "myBucketName",
    "object": "MyFile"
  },
  "data": null
}
Rename file

rename an object under the same bucket

Rename file metadata settings:

Metadata Key Required Description Possible values
method yes type of method "rename"
bucket yes bucket name "bucket name"
object yes old object name "anyString"
rename_object yes new object name "anyString"

Example:

{
  "metadata": {
    "method": "rename",
    "bucket": "myBucketName",
    "object": "MyOldFile",
    "rename_object": "MyNewFile"
  },
  "data": null
}
Copy file

copy file from one bucket to another

Copy file metadata settings:

Metadata Key Required Description Possible values
method yes type of method "copy"
bucket yes old bucket name "bucket name"
dst_bucket yes new bucket name(can be the same) "bucket name"
object yes old object name "anyString"
rename_object yes new object name(can be the same) "anyString"

Example:

{
  "metadata": {
    "method": "copy",
    "bucket": "myOldBucketName",
    "dst_bucket": "myNewBucketName",
    "object": "MyOldFile",
    "rename_object": "MyNewFile"
  },
  "data": null
}
Move file

move a file from one bucket to another

Move file metadata settings:

Metadata Key Required Description Possible values
method yes type of method "move"
bucket yes old bucket name "bucket name"
dst_bucket yes new bucket name(can be the same) "bucket name"
object yes old object name "anyString"
rename_object yes new object name(can be the same) "anyString"

Example:

{
  "metadata": {
    "method": "move",
    "bucket": "myOldBucketName",
    "dst_bucket": "myNewBucketName",
    "object": "MyOldFile",
    "rename_object": "MyNewFile"
  },
  "data": null
}
List files

list all files from a bucket

List files metadata settings:

Metadata Key Required Description Possible values
method yes type of method "list"
bucket yes old bucket name "bucket name"

Example:

{
  "metadata": {
    "method": "list",
    "bucket": "myBucketName"
  },
  "data": null
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connector

func Connector() *common.Connector

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New() *Client

func (*Client) Connector

func (c *Client) Connector() *common.Connector

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *types.Request) (*types.Response, error)

func (*Client) Init

func (c *Client) Init(ctx context.Context, cfg config.Spec, log *logger.Logger) error

func (*Client) Stop

func (c *Client) Stop() error

Jump to

Keyboard shortcuts

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