common_function_pool

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package common_function_pool contains functionality for working with ECL Common Function Pool resources.

Example to List Common Function Pools

listOpts := common_function_pool.ListOpts{
	Description: "general",
}

allPages, err := common_function_pool.List(networkClient, listOpts).AllPages()
if err != nil {
	panic(err)
}

allCommonFunctionPools, err := common_function_pool.ExtractCommonFunctionPools(allPages)
if err != nil {
	panic(err)
}

for _, commonFunctionPool := range allCommonFunctionPools {
	fmt.Printf("%+v\n", commonFunctionPool)
}

Example to Show Common Function Pool

commonFunctionPoolID := "c57066cc-9553-43a6-90de-asfdfesfffff"

commonFunctionPool, err := common_function_pool.Get(networkClient, commonFunctionPoolID).Extract()
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", commonFunctionPool)

Example to look for Common Function Pool's ID by its name

commonFunctionPoolName := "CF_Pool1"

commonFunctionPoolID, err := common_function_pool.IDFromName(networkClient, commonFunctionPoolName)
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", commonFunctionPoolID)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDFromName

func IDFromName(client *eclcloud.ServiceClient, name string) (string, error)

IDFromName is a convenience function that returns a Common Function Pool's ID, given its name.

func List

List returns a Pager which allows you to iterate over a collection of Common Function Pools. It accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

Default policy settings return only those Common Function Pools that are owned by the tenant who submits the request, unless the request is submitted by a user with administrative rights.

Types

type CommonFunctionPool

type CommonFunctionPool struct {

	// Description is description
	Description string `json:"description"`

	// UUID representing the Common Function Pool.
	ID string `json:"id"`

	// Name of Common Function Pool
	Name string `json:"name"`
}

CommonFunctionPool represents a Common Function Pool. See package documentation for a top-level description of what this is.

func ExtractCommonFunctionPools

func ExtractCommonFunctionPools(r pagination.Page) ([]CommonFunctionPool, error)

ExtractCommonFunctionPools accepts a Page struct, specifically a CommonFunctionPoolPage struct, and extracts the elements into a slice of Common Function Pool structs. In other words, a generic collection is mapped into a relevant slice.

type CommonFunctionPoolPage

type CommonFunctionPoolPage struct {
	pagination.LinkedPageBase
}

CommonFunctionPoolPage is the page returned by a pager when traversing over a collection of common function pools.

func (CommonFunctionPoolPage) IsEmpty

func (r CommonFunctionPoolPage) IsEmpty() (bool, error)

IsEmpty checks whether a CommonFunctionPoolPage struct is empty.

type GetResult

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

GetResult represents the result of a get operation. Call its Extract method to interpret it as a Common Function Pool.

func Get

func Get(c *eclcloud.ServiceClient, id string) (r GetResult)

Get retrieves a specific Common Function Pool based on its unique ID.

func (GetResult) Extract

func (r GetResult) Extract() (*CommonFunctionPool, error)

Extract is a function that accepts a result and extracts a Common Function Pool resource.

type ListOpts

type ListOpts struct {
	Description string `q:"description"`
	ID          string `q:"id"`
	Name        string `q:"name"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the Common Function Pool attributes you want to see returned. SortKey allows you to sort by a particular Common Function Pool attribute. SortDir sets the direction, and is either `asc' or `desc'. Marker and Limit are used for pagination.

func (ListOpts) ToCommonFunctionPoolListQuery

func (opts ListOpts) ToCommonFunctionPoolListQuery() (string, error)

ToCommonFunctionPoolsListQuery formats a ListOpts into a query string.

type ListOptsBuilder

type ListOptsBuilder interface {
	ToCommonFunctionPoolListQuery() (string, error)
}

ListOptsBuilder allows extensions to add additional parameters to the List request.

Directories

Path Synopsis
Common Function Pool unit tests
Common Function Pool unit tests

Jump to

Keyboard shortcuts

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