goisilon

package module
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

README

GoIsilon

Overview

GoIsilon is a Go package that provides a client for the EMC Isilon OneFS HTTP API. The package provides both direct implementations of the API bindings as well as abstract, helper functionality. In addition, services such as Docker, Mesos, and REX-Ray use the GoIsilon package to integrate with the NAS storage platform.

Since the code team are no longer in existence and this project seems moribund, I'm cloning it to apply some fixes. Pull Requests are welcome.

OneFS API Support Matrix

The GoIsilon package is tested with and supports OneFS 7.2+ with support for APIv2 and APIv3 (introduced in OneFS 8.0).

Examples

The tests provide working examples for how to use the package, but here are a few code snippets to further illustrate the basic ideas:

Initialize a new client

This example shows how to initialize a new client.

client, err := NewClient(context.Background())
if err != nil {
	panic(err)
}

Please note that there is no attempt to provide a host, credentials, or any other options. The NewClient() function relies on the following environment variables to configure the GoIsilon client:

Environment Variables
Name Description
GOISILON_ENDPOINT the API endpoint, ex. https://172.17.177.230:8080
GOISILON_USERNAME the username
GOISILON_GROUP the user's group
GOISILON_PASSWORD the password
GOISILON_INSECURE whether to skip SSL validation
GOISILON_VOLUMEPATH which base path to use when looking for volume directories
Initialize a new client with options

The following example demonstrates how to explicitly specify options when creating a client:

client, err := NewClientWithArgs(
	context.Background(),
	"https://172.17.177.230:8080",
	true,
	"userName",
	"groupName",
	"password",
	"/ifs/volumes")
if err != nil {
	panic(err)
}
Create a Volume

This snippet creates a new volume named "testing" at "/ifs/volumes/loremipsum". The volume path is generated by concatenating the client's volume path and the name of the volume.

volume, err := c.CreateVolume(context.Background(), "loremipsum")
Export a Volume

Enabling a volume for NFS access is fairly straight-forward.

if err := c.ExportVolume(context.Background(), "loremipsum"); err != nil {
	panic(err)
}
Delete a Volume

When a volume is no longer needed, this is how it may be removed.

if err := c.DeleteVolume(context.Background(), "loremipsum"); err != nil {
	panic(err)
}
More Examples

Several, very detailed examples of the GoIsilon package in use can be found in the package's *_test.go files as well as in the libStorage Isilon storage driver.

Contributions

Please contribute!

Licensing

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Support

If you have questions relating to the project, please either post Github Issues, join our Slack channel available by signup through community.emc.com and post questions into #projects, or reach out to the maintainers directly. The code and documentation are released with no warranties or SLAs and are intended to be supported through a community driven process.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConcurrentHTTPConnections = 2

ConcurrentHTTPConnections is the number of allowed concurrent HTTP connections for API functions that attempt to send multiple API calls at once.

Functions

This section is empty.

Types

type ACL added in v1.3.0

type ACL *api.ACL

ACL is an Isilon Access Control List used for managing an object's security.

type Client

type Client struct {

	// API is the underlying OneFS API client.
	API api.Client
}

Client is an Isilon client.

func NewClient

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

NewClient returns a new Isilon client struct initialized from the environment.

func NewClientWithArgs

func NewClientWithArgs(
	ctx context.Context,
	endpoint string,
	insecure bool,
	user, group, pass, volumesPath string) (*Client, error)

NewClientWithArgs returns a new Isilon client struct initialized from the supplied arguments.

func (*Client) AddExportClients added in v1.1.0

func (c *Client) AddExportClients(
	ctx context.Context, name string, clients ...string) error

AddExportClients adds to the Export's clients property.

func (*Client) AddExportClientsByID added in v1.1.0

func (c *Client) AddExportClientsByID(
	ctx context.Context, id int, clients ...string) error

AddExportClientsByID adds to the Export's clients property.

func (*Client) AddExportRootClients added in v1.1.0

func (c *Client) AddExportRootClients(
	ctx context.Context, name string, clients ...string) error

AddExportRootClients adds to the Export's root_clients property.

func (*Client) AddExportRootClientsByID added in v1.1.0

func (c *Client) AddExportRootClientsByID(
	ctx context.Context, id int, clients ...string) error

AddExportRootClientsByID adds to the Export's root_clients property.

func (*Client) ClearExportClients

func (c *Client) ClearExportClients(
	ctx context.Context, name string) error

ClearExportClients sets the Export's clients property to nil.

func (*Client) ClearExportClientsByID added in v1.1.0

func (c *Client) ClearExportClientsByID(
	ctx context.Context, id int) error

ClearExportClientsByID sets the Export's clients property to nil.

func (*Client) ClearExportRootClients added in v1.1.0

func (c *Client) ClearExportRootClients(
	ctx context.Context, name string) error

ClearExportRootClients sets the Export's root_clients property to nil.

func (*Client) ClearExportRootClientsByID added in v1.1.0

func (c *Client) ClearExportRootClientsByID(
	ctx context.Context, id int) error

ClearExportRootClientsByID sets the Export's clients property to nil.

func (*Client) ClearQuota

func (c *Client) ClearQuota(ctx context.Context, name string) error

ClearQuota removes the quota from a volume

func (*Client) CopySnapshot

func (c *Client) CopySnapshot(
	ctx context.Context,
	sourceID int64, sourceName, destinationName string) (Volume, error)

CopySnapshot copies all files/directories in a snapshot to a new directory.

func (*Client) CopyVolume

func (c *Client) CopyVolume(
	ctx context.Context, src, dest string) (Volume, error)

CopyVolume creates a volume based on an existing volume

func (*Client) CreateQuota added in v1.7.3

func (c *Client) CreateQuota(
	ctx context.Context, name string, container bool, size int64) error

CreateQuota creates a new hard directory quota with the specified size and container option

func (*Client) CreateSnapshot

func (c *Client) CreateSnapshot(
	ctx context.Context, path, name string) (Snapshot, error)

CreateSnapshot creates a snapshot called name of the given path.

func (*Client) CreateVolume

func (c *Client) CreateVolume(
	ctx context.Context, name string) (Volume, error)

CreateVolume creates a volume

func (*Client) CreateVolumeDir added in v1.4.0

func (c *Client) CreateVolumeDir(
	ctx context.Context,
	volumeName, dirPath string,
	fileMode os.FileMode,
	overwrite, recursive bool) error

CreateVolumeDir creates a directory inside a volume.

func (*Client) CreateVolumeNoACL added in v1.7.5

func (c *Client) CreateVolumeNoACL(
	ctx context.Context, name string) (Volume, error)

CreateVolume creates a volume

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(
	ctx context.Context, name string) error

DeleteVolume deletes a volume

func (*Client) DisableFailureMapping added in v1.2.0

func (c *Client) DisableFailureMapping(
	ctx context.Context, name string) error

DisableFailureMapping disables the map_failure mapping for an Export.

func (*Client) DisableFailureMappingByID added in v1.2.0

func (c *Client) DisableFailureMappingByID(
	ctx context.Context, id int) error

DisableFailureMappingByID disables the map_failure mapping for an Export.

func (*Client) DisableNonRootMapping added in v1.2.0

func (c *Client) DisableNonRootMapping(
	ctx context.Context, name string) error

DisableNonRootMapping disables the map_non_root mapping for an Export.

func (*Client) DisableNonRootMappingByID added in v1.2.0

func (c *Client) DisableNonRootMappingByID(
	ctx context.Context, id int) error

DisableNonRootMappingByID disables the map_non_root mapping for an Export.

func (*Client) DisableRootMapping added in v1.1.0

func (c *Client) DisableRootMapping(
	ctx context.Context, name string) error

DisableRootMapping disables the root mapping for an Export.

func (*Client) DisableRootMappingByID added in v1.1.0

func (c *Client) DisableRootMappingByID(
	ctx context.Context, id int) error

DisableRootMappingByID disables the root mapping for an Export.

func (*Client) EnableFailureMapping added in v1.2.0

func (c *Client) EnableFailureMapping(
	ctx context.Context, name, user string) error

EnableFailureMapping enables the map_failure mapping for an Export.

func (*Client) EnableFailureMappingByID added in v1.2.0

func (c *Client) EnableFailureMappingByID(
	ctx context.Context, id int, user string) error

EnableFailureMappingByID enables the map_failure mapping for an Export.

func (*Client) EnableNonRootMapping added in v1.2.0

func (c *Client) EnableNonRootMapping(
	ctx context.Context, name, user string) error

EnableNonRootMapping enables the map_non_root mapping for an Export.

func (*Client) EnableNonRootMappingByID added in v1.2.0

func (c *Client) EnableNonRootMappingByID(
	ctx context.Context, id int, user string) error

EnableNonRootMappingByID enables the map_non_root mapping for an Export.

func (*Client) EnableRootMapping added in v1.1.0

func (c *Client) EnableRootMapping(
	ctx context.Context, name, user string) error

EnableRootMapping enables the root mapping for an Export.

func (*Client) EnableRootMappingByID added in v1.1.0

func (c *Client) EnableRootMappingByID(
	ctx context.Context, id int, user string) error

EnableRootMappingByID enables the root mapping for an Export.

func (*Client) Export

func (c *Client) Export(ctx context.Context, name string) (int, error)

Export the volume with a given name on the cluster

func (*Client) ExportVolume

func (c *Client) ExportVolume(
	ctx context.Context, name string) (int, error)

ExportVolume exports a volume

func (*Client) ExportVolumeWithZone added in v1.7.2

func (c *Client) ExportVolumeWithZone(
	ctx context.Context, name, zone string) (int, error)

ExportVolumeWithZone exports a volume in the specified access zone

func (*Client) ExportWithZone added in v1.7.2

func (c *Client) ExportWithZone(ctx context.Context, name, zone string) (int, error)

ExportWithZone exports the volume with a given name and zone on the cluster

func (*Client) ForceDeleteVolume added in v1.4.0

func (c *Client) ForceDeleteVolume(ctx context.Context, name string) error

ForceDeleteVolume force deletes a volume by resetting the ownership of all descendent directories to the current user prior to issuing a delete call.

func (*Client) GetExportByID added in v1.1.0

func (c *Client) GetExportByID(ctx context.Context, id int) (Export, error)

GetExportByID returns an export with the provided ID.

func (*Client) GetExportByName added in v1.1.0

func (c *Client) GetExportByName(
	ctx context.Context, name string) (Export, error)

GetExportByName returns the first export with a path for the provided volume name.

func (*Client) GetExportByNameWithZone added in v1.7.4

func (c *Client) GetExportByNameWithZone(
	ctx context.Context, name, zone string) (Export, error)

GetExportByNameWithZone returns the first export with a path for the provided volume name in the given zone.

func (*Client) GetExportClients

func (c *Client) GetExportClients(
	ctx context.Context, name string) ([]string, error)

GetExportClients returns an Export's clients property.

func (*Client) GetExportClientsByID added in v1.1.0

func (c *Client) GetExportClientsByID(
	ctx context.Context, id int) ([]string, error)

GetExportClientsByID returns an Export's clients property.

func (*Client) GetExportRootClients added in v1.1.0

func (c *Client) GetExportRootClients(
	ctx context.Context, name string) ([]string, error)

GetExportRootClients returns an Export's root_clients property.

func (*Client) GetExportRootClientsByID added in v1.1.0

func (c *Client) GetExportRootClientsByID(
	ctx context.Context, id int) ([]string, error)

GetExportRootClientsByID returns an Export's clients property.

func (*Client) GetExports added in v1.1.0

func (c *Client) GetExports(ctx context.Context) (ExportList, error)

GetExports returns a list of all exports on the cluster

func (*Client) GetFailureMapping added in v1.2.0

func (c *Client) GetFailureMapping(
	ctx context.Context, name string) (UserMapping, error)

GetFailureMapping returns the map_failure mapping for an Export.

func (*Client) GetFailureMappingByID added in v1.2.0

func (c *Client) GetFailureMappingByID(
	ctx context.Context, id int) (UserMapping, error)

GetFailureMappingByID returns the map_failure mapping for an Export.

func (*Client) GetNonRootMapping added in v1.2.0

func (c *Client) GetNonRootMapping(
	ctx context.Context, name string) (UserMapping, error)

GetNonRootMapping returns the map_non_root mapping for an Export.

func (*Client) GetNonRootMappingByID added in v1.2.0

func (c *Client) GetNonRootMappingByID(
	ctx context.Context, id int) (UserMapping, error)

GetNonRootMappingByID returns the map_non_root mapping for an Export.

func (*Client) GetQuota

func (c *Client) GetQuota(ctx context.Context, name string) (Quota, error)

GetQuota returns a specific quota by path

func (*Client) GetRootMapping added in v1.1.0

func (c *Client) GetRootMapping(
	ctx context.Context, name string) (UserMapping, error)

GetRootMapping returns the root mapping for an Export.

func (*Client) GetRootMappingByID added in v1.1.0

func (c *Client) GetRootMappingByID(
	ctx context.Context, id int) (UserMapping, error)

GetRootMappingByID returns the root mapping for an Export.

func (*Client) GetSnapshot

func (c *Client) GetSnapshot(
	ctx context.Context, id int64, name string) (Snapshot, error)

GetSnapshot returns a snapshot matching id, or if that is not found, matching name

func (*Client) GetSnapshots

func (c *Client) GetSnapshots(ctx context.Context) (SnapshotList, error)

GetSnapshots returns a list of snapshots from the cluster.

func (*Client) GetSnapshotsByPath

func (c *Client) GetSnapshotsByPath(
	ctx context.Context, path string) (SnapshotList, error)

GetSnapshotsByPath returns a list of snapshots covering the supplied path.

func (*Client) GetVolume

func (c *Client) GetVolume(
	ctx context.Context, id, name string) (Volume, error)

GetVolume returns a specific volume by name or ID

func (*Client) GetVolumeACL added in v1.3.0

func (c *Client) GetVolumeACL(
	ctx context.Context,
	volumeName string) (ACL, error)

GetVolumeACL returns the ACL for a volume.

func (*Client) GetVolumeExportMap added in v1.2.0

func (c *Client) GetVolumeExportMap(
	ctx context.Context,
	includeRootClients bool) (map[Volume]Export, error)

GetVolumeExportMap returns a map that relates Volumes to their corresponding Exports. This function uses an Export's "clients" property to define the relationship. The flag "includeRootClients" can be set to "true" in order to also inspect the "root_clients" property of an Export when determining the Volume-to-Export relationship.

func (*Client) GetVolumes

func (c *Client) GetVolumes(ctx context.Context) ([]Volume, error)

GetVolumes returns a list of volumes

func (*Client) IsExported added in v1.1.0

func (c *Client) IsExported(
	ctx context.Context, name string) (bool, int, error)

IsExported returns a flag and export ID if the provided volume name is already exported.

func (*Client) IsExportedWithZone added in v1.7.4

func (c *Client) IsExportedWithZone(
	ctx context.Context, name, zone string) (bool, int, error)

IsExportedWithZone returns a flag and export ID if the provided volume name in the specified zone isalready exported.

func (*Client) QueryVolumeChildren added in v1.4.0

func (c *Client) QueryVolumeChildren(
	ctx context.Context, name string) (VolumeChildrenMap, error)

QueryVolumeChildren retrieves a list of all of a volume's descendent files and directories.

func (*Client) RemoveSnapshot

func (c *Client) RemoveSnapshot(
	ctx context.Context, id int64, name string) error

RemoveSnapshot removes the snapshot by id, or failing that, the snapshot matching name.

func (*Client) SetExportClients

func (c *Client) SetExportClients(
	ctx context.Context, name string, clients ...string) error

SetExportClients sets the Export's clients property.

func (*Client) SetExportClientsByID added in v1.1.0

func (c *Client) SetExportClientsByID(
	ctx context.Context, id int, clients ...string) error

SetExportClientsByID sets the Export's clients property.

func (*Client) SetExportRootClients added in v1.1.0

func (c *Client) SetExportRootClients(
	ctx context.Context, name string, clients ...string) error

SetExportRootClients sets the Export's root_clients property.

func (*Client) SetExportRootClientsByID added in v1.1.0

func (c *Client) SetExportRootClientsByID(
	ctx context.Context, id int, clients ...string) error

SetExportRootClientsByID sets the Export's clients property.

func (*Client) SetQuotaSize

func (c *Client) SetQuotaSize(
	ctx context.Context, name string, size int64) error

SetQuotaSize sets the max size (hard threshold) of a quota for a volume

func (*Client) SetVolumeMode added in v1.7.7

func (c *Client) SetVolumeMode(
	ctx context.Context,
	volumeName string, mode int) error

SetVolumeMode sets the permissions to the specified mode (chmod)

func (*Client) SetVolumeOwner added in v1.3.0

func (c *Client) SetVolumeOwner(
	ctx context.Context,
	volumeName, userName string) error

SetVolumeOwner sets the owner for a volume.

func (*Client) SetVolumeOwnerToCurrentUser added in v1.3.0

func (c *Client) SetVolumeOwnerToCurrentUser(
	ctx context.Context,
	volumeName string) error

SetVolumeOwnerToCurrentUser sets the owner for a volume to the user that was used to connect to the API.

func (*Client) Unexport

func (c *Client) Unexport(
	ctx context.Context, name string) error

Unexport stops exporting a given volume from the cluster.

func (*Client) UnexportByID added in v1.1.0

func (c *Client) UnexportByID(
	ctx context.Context, id int) error

UnexportByID unexports an Export by its ID.

func (*Client) UnexportByIDWithZone added in v1.7.4

func (c *Client) UnexportByIDWithZone(
	ctx context.Context, id int, zone string) error

UnexportByIDWithZone unexports an Export by its ID and zone.

func (*Client) UnexportVolume

func (c *Client) UnexportVolume(
	ctx context.Context, name string) error

UnexportVolume stops exporting a volume

func (*Client) UnexportWithZone added in v1.7.4

func (c *Client) UnexportWithZone(
	ctx context.Context, name, zone string) error

UnexportWithZone stops exporting a given volume in the given from the cluster.

func (*Client) UpdateQuotaSize

func (c *Client) UpdateQuotaSize(
	ctx context.Context, name string, size int64) error

UpdateQuotaSize modifies the max size (hard threshold) of a quota for a volume

type Export

type Export *api.Export

Export is an Isilon Export

type ExportList

type ExportList []*api.Export

ExportList is a list of Isilon Exports.

type Quota

type Quota *api.IsiQuota

Quota maps to an Isilon filesystem quota.

type Snapshot

type Snapshot *api.IsiSnapshot

Snapshot represents an Isilon snapshot.

type SnapshotList

type SnapshotList []*api.IsiSnapshot

SnapshotList represents a list of Isilon snapshots.

type UserMapping added in v1.1.0

type UserMapping *api.UserMapping

UserMapping maps to the ISI <user-mapping> type.

type Volume

type Volume *apiv1.IsiVolume

Volume represents an Isilon Volume (namespace API).

type VolumeChildren added in v1.4.0

type VolumeChildren apiv2.ContainerChildList

VolumeChildren is a list of a container's children.

type VolumeChildrenMap added in v1.4.0

type VolumeChildrenMap map[string]*apiv2.ContainerChild

VolumeChildrenMap returns a map of all descendent children of a container, where the key is the path.

Directories

Path Synopsis
api
json
Package json implements encoding and decoding of JSON as defined in RFC 4627.
Package json implements encoding and decoding of JSON as defined in RFC 4627.
v1
v2

Jump to

Keyboard shortcuts

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