Categorygithub.com/ibmjstart/cf-object-storage
modulepackage
1.0.3
Repository: https://github.com/ibmjstart/cf-object-storage.git
Documentation: pkg.go.dev

# README

cf-object-storage

Go Report Card standard-readme compliant

A CloudFoundry Plugin for interacting with OpenStack Object Storage

Table of Contents

Background

Static Large Objects (SLOs) and Dynamic Large Objects (DLOs) are incredibly useful aggregate file types available in OpenStack Object Storage. However, manipulating them can be quite difficult. This Cloud Foundry CLI plugin is designed to make using SLOs and DLOs much more accessible.

This plugin makes heavy use of the swiftlygo library. Much more information on SLOs and DLOs can be found by reading that library's README.

Additionally, some basic object and container interactions are included as commands. This allows for working with Object Storage from the command line without having to go through the long authentication process on your own.

Install

Dependenies: This plugin requires the Cloud Foundry CLI version 6.21.0 or later. You can check your version with cf version. Install and update instructions can be found here.

Since this plugin is not currently in an offical Cloud Foundry plugin repo, it will need to be downloaded and installed manually.

Install From Binary (Recommended)

Download the binary for your machine from the releases page and navigate to the downloaded binary from within your terminal. Then run the following cf command from the directory the binary was downloaded to.

Note: If you are reinstalling, run cf uninstall-plugin cf-object-storage first to uninstall the outdated version.

Mac & Linux

cf install-plugin cf-object-storage

If you get a permission error, ensure that the binary has execute permissions.

chmod +x cf-object-storage

Windows

cf install-plugin cf-object-storage.exe

Install From Source

Installing this way requires Go. Binaries and install instructions can be found on their official website. To download this package, open your terminal and run

go get github.com/ibmjstart/cf-object-storage

Mac & Linux

Navigate to the project's root directory, which should be $GOPATH/src/github.com/ibmjstart/cf-object-storage with most standard Go setups. The provided reinstall.sh script can then be ran to install the plugin.

cd $GOPATH/src/github.com/ibmjstart/cf-object-storage
./scripts/reinstall.sh

Note: reinstall.sh first attempts to uninstall the plugin, so you will get a failure message from the uninstall command if the plugin is not already installed. However, as long as the following install succeeds all should work fine.

Windows

reinstall.sh is intended for use on Mac and Linux. To install on Windows, first navigate to the project's root directory, which should be %GOPATH%\src\github.com\ibmjstart\cf-object-storage with most standard Go setups. Then build and install as shown.

cd %GOPATH%\src\github.com\ibmjstart\cf-object-storage
go build
cf install-plugin cf-object-storage.exe

Usage

This plugin is invoked as follows: cf os SUBCOMMAND [ARGS...]

Sixteen subcommands are included in this plugin, described below. More information can be found by using cf os help followed by any of the subcommands.

Subcommand List

SubcommandUsageDescription
authcf os auth service_name [-url] [-x]Retrieve and store! a service's x-auth info
containerscf os containers service_nameShow all containers in an Object Storage instance
containercf os container service_name container_nameShow a given container's information
create-containercf os create-container service_name container_name [headers...] [-gr] [-rm-gr]Create a new container in an Object Storage instance
update-containercf os update-container service_name container_name headers... [-gr] [-rm-gr]Update an existing container's metadata
rename-containercf os rename-container service_name container_name new_container_nameRename an existing container!!
delete-containercf os delete-container service_name container_name [-f]Remove a container from an Object Storage instance
objectscf os objects service_name container_nameShow all objects in a container
objectcf os object service_name container_name object_nameShow a given object's information
put-objectcf os put-object service_name container_name path_to_source [-n object_name]Upload a file to Object Storage
get-objectcf os get-object service_name container_name object_name path_to_downloadDownload an object from Object Storage
rename-objectcf os rename-object service_name container_name object_name new_object_nameRename an object
copy-objectcf os copy-object service_name container_name object_name new_container_nameCopy an object from one container to another
delete-objectcf os delete-object service_name container_name object_name [-l]Remove an object from a container
create-dynamic-objectcf os create-dynamic-object service_name dlo_container dlo_name [-c object_container] [-p dlo_prefix]Create a DLO manifest in Object Storage
put-large-objectcf os put-large-object service_name slo_container slo_name source_file [-m] [-o output_file] [-s chunk_size] [-t num_threads]Upload a file to Object Storage as an SLO

! auth checks if HOME/.cf/os_creds.json exists and contains the target service's x-auth token and storage url. If it does, these credentials are used to authenticate with Object Storage (which saves a few http requests). Upon successful authentication, auth will save a service's x-auth info to the above location to speed up subsequent commands.

!! rename-container should not be used (and will likely fail) on containers containing SLOs and DLOs. This is due to their strict naming conventions that expect certain containers to have certain names.

Contribute

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

Apache 2.0 © IBM jStart

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

ObjectStoragePlugin is the struct implementing the plugin interface.