quobyte

package module
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

README

Quobyte API Clients

Get the quobyte api client

go get github.com/quobyte/api

Usage

package main

import (
  "log"
  quobyte_api "github.com/quobyte/api"
)

func main() {
    client := quobyte_api.NewQuobyteClient("http://apiserver:7860", "user", "password")
    client.SetAPIRetryPolicy(quobyte_api.RetryInfinitely) // Default quobyte_api.RetryInteractive
    req := &quobyte_api.CreateVolumeRequest{
        Name:              "MyVolume",
        RootUserID:        "root",
        RootGroupID:       "root",
        ConfigurationName: "BASE",
        Labels: []quobyte_api.Label{
            {Name: "label1", Value: "value1"},
            {Name: "label2", Value: "value2"},
        },
    }

    volumeUUID, err := client.CreateVolume(req)
    if err != nil {
        log.Fatalf("Error:", err)
    }

    log.Printf("%s", volumeUUID)
}

Documentation

Overview

Package quobyte represents a golang API for the Quobyte Storage System

Index

Constants

View Source
const (
	RetryNever         string = "NEVER"
	RetryInteractive   string = "INTERACTIVE"
	RetryInfinitely    string = "INFINITELY"
	RetryOncePerTarget string = "ONCE_PER_TARGET"
)

retry policy codes

Variables

View Source
var UUIDValidator = regexp.MustCompile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$")

Functions

func IsValidUUID added in v0.1.2

func IsValidUUID(uuid string) bool

IsValidUUID Validates the given uuid

Types

type Client

type Client struct {
	MountedUserName   string `json:"mount_user_name,omitempty"`
	MountedVolumeUUID string `json:"mounted_volume_uuid,omitempty"`
}

type CreateVolumeRequest

type CreateVolumeRequest struct {
	Name              string   `json:"name,omitempty"`
	RootUserID        string   `json:"root_user_id,omitempty"`
	RootGroupID       string   `json:"root_group_id,omitempty"`
	ReplicaDeviceIDS  []uint64 `json:"replica_device_ids,string,omitempty"`
	ConfigurationName string   `json:"configuration_name,omitempty"`
	Labels            []Label  `json:"label,omitempty"`
	AccessMode        uint32   `json:"access_mode,uint32,omitempty"`
	TenantID          string   `json:"tenant_id,omitempty"`
	// contains filtered or unexported fields
}

CreateVolumeRequest represents a CreateVolumeRequest

type GetClientListResponse

type GetClientListResponse struct {
	Clients []Client `json:"client,omitempty"`
}

type GetTenantResponse

type GetTenantResponse struct {
	Tenants []*TenantDomainConfiguration `json:"tenant,omitempty"`
}

type Label added in v0.1.6

type Label struct {
	Name  string `json:"name,string,omitempty"`
	Value string `json:"value,string,omitempty"`
}

type QuobyteClient

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

func NewQuobyteClient

func NewQuobyteClient(url string, username string, password string) *QuobyteClient

NewQuobyteClient creates a new Quobyte API client

func (QuobyteClient) CreateVolume

func (client QuobyteClient) CreateVolume(request *CreateVolumeRequest) (string, error)

CreateVolume creates a new Quobyte volume. Its root directory will be owned by given user and group

func (*QuobyteClient) DeleteVolume

func (client *QuobyteClient) DeleteVolume(UUID string) error

DeleteVolume deletes a Quobyte volume

func (*QuobyteClient) DeleteVolumeByName

func (client *QuobyteClient) DeleteVolumeByName(volumeName, tenant string) error

DeleteVolumeByName deletes a volume by a given name

func (*QuobyteClient) DeleteVolumeByResolvingNamesToUUID added in v0.1.2

func (client *QuobyteClient) DeleteVolumeByResolvingNamesToUUID(volume, tenant string) error

DeleteVolumeByResolvingNamesToUUID deletes the volume by resolving the volume name and tenant name to respective UUID if required. This method should be used if the given volume, tenant information is name or UUID.

func (*QuobyteClient) GetAPIRetryPolicy

func (client *QuobyteClient) GetAPIRetryPolicy() string

func (*QuobyteClient) GetClientList

func (client *QuobyteClient) GetClientList(tenant string) (GetClientListResponse, error)

GetClientList returns a list of all active clients

func (*QuobyteClient) GetTenant

func (client *QuobyteClient) GetTenant(tenantIDs []string) (GetTenantResponse, error)

GetTenant returns the Tenant configuration for all specified tenants

func (*QuobyteClient) GetTenantMap

func (client *QuobyteClient) GetTenantMap() (map[string]string, error)

GetTenantMap returns a map that contains all tenant names and there ID's

func (QuobyteClient) GetTenantUUID added in v0.1.2

func (client QuobyteClient) GetTenantUUID(tenant string) (string, error)

GetTenantUUID resolves the tenatnUUID for the given name This method should be used when it is not clear if the given string is Tenant UUID or Name.

func (QuobyteClient) GetVolumeUUID added in v0.1.2

func (client QuobyteClient) GetVolumeUUID(volume, tenant string) (string, error)

GetVolumeUUID resolves the volumeUUID for the given volume and tenant name. This method should be used when it is not clear if the given string is volume UUID or Name.

func (*QuobyteClient) ResolveTenantNameToUUID added in v0.1.2

func (client *QuobyteClient) ResolveTenantNameToUUID(name string) (string, error)

ResolveTenantNameToUUID Returns UUID for given name, error if not found.

func (*QuobyteClient) ResolveVolumeNameToUUID

func (client *QuobyteClient) ResolveVolumeNameToUUID(volumeName, tenant string) (string, error)

ResolveVolumeNameToUUID resolves a volume name to a UUID

func (*QuobyteClient) SetAPIRetryPolicy

func (client *QuobyteClient) SetAPIRetryPolicy(retry string)

func (*QuobyteClient) SetTenant

func (client *QuobyteClient) SetTenant(tenantName string) (string, error)

SetTenant creates a Tenant with the specified name

func (*QuobyteClient) SetTransport added in v0.1.7

func (client *QuobyteClient) SetTransport(t http.RoundTripper)

func (*QuobyteClient) SetVolumeQuota

func (client *QuobyteClient) SetVolumeQuota(volumeUUID string, quotaSize uint64) error

SetVolumeQuota sets a Quota to the specified Volume

type TenantDomainConfiguration

type TenantDomainConfiguration struct {
	TenantID          string                                   `json:"tenant_id,omitempty"`
	Name              string                                   `json:"name,omitempty"`
	RestrictToNetwork []string                                 `json:"restrict_to_network,omitempty"`
	VolumeAccess      []*TenantDomainConfigurationVolumeAccess `json:"volume_access,omitempty"`
}

type TenantDomainConfigurationVolumeAccess

type TenantDomainConfigurationVolumeAccess struct {
	VolumeUUID        string `json:"volume_uuid,omitempty"`
	RestrictToNetwork string `json:"restrict_to_network,omitempty"`
	ReadOnly          bool   `json:"read_only,omitempty"`
}

Jump to

Keyboard shortcuts

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