common_function_gateways

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package common_function_gateways contains functionality for working with ECL Commnon Function Gateway resources.

Example to List CommonFunctionGateways

listOpts := common_function_gateways.ListOpts{
	TenantID: "a99e9b4e620e4db09a2dfb6e42a01e66",
}

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

allCommonFunctionGateways, err := common_function_gateways.ExtractCommonFunctionGateways(allPages)
if err != nil {
	panic(err)
}

for _, common_function_gateways := range allCommonFunctionGateways {
	fmt.Printf("%+v", common_function_gateways)
}

Example to Create a common_function_gateways

createOpts := common_function_gateways.CreateOpts{
	Name:         "network_1",
}

common_function_gateways, err := common_function_gateways.Create(networkClient, createOpts).Extract()
if err != nil {
	panic(err)
}

Example to Update a common_function_gateways

commonFunctionGatewayID := "484cda0e-106f-4f4b-bb3f-d413710bbe78"

updateOpts := common_function_gateways.UpdateOpts{
	Name: "new_name",
}

common_function_gateways, err := common_function_gateways.Update(networkClient, commonFunctionGatewayID, updateOpts).Extract()
if err != nil {
	panic(err)
}

Example to Delete a common_function_gateways

commonFunctionGatewayID := "484cda0e-106f-4f4b-bb3f-d413710bbe78"
err := common_function_gateways.Delete(networkClient, commonFunctionGatewayID).ExtractErr()
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractCommonFunctionGatewaysInto

func ExtractCommonFunctionGatewaysInto(r pagination.Page, v interface{}) error

ExtractCommonFunctionGatewaysInto interprets the results of a single page from a List() call, producing a slice of Server entities.

func IDFromName

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

IDFromName is a convenience function that returns a common function gateway's ID, given its name.

func List

func List(c *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

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

Types

type CommonFunctionGateway

type CommonFunctionGateway struct {
	// UUID for the network
	ID string `json:"id"`

	// Human-readable name for the network. Might not be unique.
	Name string `json:"name"`

	Description string `json:"description"`

	CommonFunctionPoolID string `json:"common_function_pool_id"`

	NetworkID string `json:"network_id"`

	SubnetID string `json:"subnet_id"`
	Status   string `json:"status"`
	TenantID string `json:"tenant_id"`
}

CommonFunctionGateway represents, well, a common function gateway.

func ExtractCommonFunctionGateways

func ExtractCommonFunctionGateways(r pagination.Page) ([]CommonFunctionGateway, error)

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

type CommonFunctionGatewayPage

type CommonFunctionGatewayPage struct {
	pagination.LinkedPageBase
}

CommonFunctionGatewayPage is the page returned by a pager when traversing over a collection of common function gateway.

func (CommonFunctionGatewayPage) IsEmpty

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

IsEmpty checks whether a CommonFunctionGatewayPage struct is empty.

func (CommonFunctionGatewayPage) NextPageURL

func (r CommonFunctionGatewayPage) NextPageURL() (string, error)

NextPageURL is invoked when a paginated collection of common function gateway

has reached the end of a page and the pager seeks to traverse over a new one.

In order to do this, it needs to construct the next page's URL.

type CreateOpts

type CreateOpts struct {
	Name                 string `json:"name,omitempty"`
	Description          string `json:"description,omitempty"`
	CommonFunctionPoolID string `json:"common_function_pool_id,omitempty"`
	TenantID             string `json:"tenant_id,omitempty"`
}

CreateOpts represents options used to create a common function gateway.

func (CreateOpts) ToCommonFunctionGatewayCreateMap

func (opts CreateOpts) ToCommonFunctionGatewayCreateMap() (map[string]interface{}, error)

ToCommonFunctionGatewayCreateMap builds a request body from CreateOpts. func (opts CreateOpts) ToCommonFunctionGatewayCreateMap() (map[string]interface{}, error) {

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToCommonFunctionGatewayCreateMap() (map[string]interface{}, error)
}

CreateOptsBuilder allows extensions to add additional parameters to the Create request.

type CreateResult

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

CreateResult represents the result of a create operation. Call its Extract method to interpret it as a Common Function Gateway.

func Create

func Create(c *eclcloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

Create accepts a CreateOpts struct and creates a new common function gateway using the values provided. This operation does not actually require a request body, i.e. the CreateOpts struct argument can be empty.

The tenant ID that is contained in the URI is the tenant that creates the common function gateway. An admin user, however, has the option of specifying another tenant ID in the CreateOpts struct.

func (CreateResult) Extract

func (r CreateResult) Extract() (*CommonFunctionGateway, error)

Extract is a function that accepts a result and extracts a common function gateway resource.

func (CreateResult) ExtractInto

func (r CreateResult) ExtractInto(v interface{}) error

Extract interprets any commonResult as a Common Function Gateway, if possible.

type DeleteResult

type DeleteResult struct {
	eclcloud.ErrResult
}

DeleteResult represents the result of a delete operation. Call its ExtractErr method to determine if the request succeeded or failed.

func Delete

func Delete(c *eclcloud.ServiceClient, commonFunctionGatewayID string) (r DeleteResult)

Delete accepts a unique ID and deletes the common function gateway associated with it.

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 Gateway.

func Get

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

Get retrieves a specific common function gateway based on its unique ID.

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a common function gateway resource.

func (GetResult) ExtractInto

func (r GetResult) ExtractInto(v interface{}) error

Extract interprets any commonResult as a Common Function Gateway, if possible.

type ListOpts

type ListOpts struct {
	CommonFunctionPoolID string `q:"common_function_pool_id"`
	Description          string `q:"description"`
	ID                   string `q:"id"`
	Name                 string `q:"name"`
	NetworkID            string `q:"network_id"`
	Status               string `q:"status"`
	SubnetID             string `q:"subnet_id"`
	TenantID             string `q:"tenant_id"`
}

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 gateway attributes you want to see returned.

func (ListOpts) ToCommonFunctionGatewayListQuery

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

ToCommonFunctionGatewayListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

type UpdateOpts

type UpdateOpts struct {
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

UpdateOpts represents options used to update a common function gateway.

func (UpdateOpts) ToCommonFunctionGatewayUpdateMap

func (opts UpdateOpts) ToCommonFunctionGatewayUpdateMap() (map[string]interface{}, error)

ToCommonFunctionGatewayUpdateMap builds a request body from UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToCommonFunctionGatewayUpdateMap() (map[string]interface{}, error)
}

UpdateOptsBuilder allows extensions to add additional parameters to the Update request.

type UpdateResult

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

UpdateResult represents the result of an update operation. Call its Extract method to interpret it as a Common Function Gateway.

func Update

func Update(c *eclcloud.ServiceClient, commonFunctionGatewayID string, opts UpdateOptsBuilder) (r UpdateResult)

Update accepts a UpdateOpts struct and updates an existing common function gateway using the values provided. For more information, see the Create function.

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*CommonFunctionGateway, error)

Extract is a function that accepts a result and extracts a common function gateway resource.

func (UpdateResult) ExtractInto

func (r UpdateResult) ExtractInto(v interface{}) error

Extract interprets any commonResult as a Common Function Gateway, if possible.

Directories

Path Synopsis
Package testing contains common function gateways unit tests
Package testing contains common function gateways unit tests

Jump to

Keyboard shortcuts

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