tenant_connections

package
v2.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package tenant_connections manages and retrieves Tenant Connection in the Enterprise Cloud Provider Connectivity Service.

Example to List Tenant Connection

allPages, err := tenant_connections.List(tcClient).AllPages()
if err != nil {
	panic(err)
}

allTenantConnections, err := tenant_connections.ExtractTenantConnections(allPages)
if err != nil {
	panic(err)
}

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

Example to Get a Tenant Connection

tenant_connection_id := "ea5d975c-bd31-11e7-bcac-0050569c850d"

tenantConnection, err := tenant_connections.Get(tcClient, tenant_connection_id).Extract()
if err != nil {
	panic(err)
}

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

Example to Create a Tenant Connection

createOpts := tenant_connections.CreateOpts{
	Name:                      "create_test_name",
	Description:               "create_test_desc",
	Tags: map[string]string{
		"test_tags": "test",
	},
	TenantConnectionRequestID: "21b344d8-be11-11e7-bf3c-0050569c850d",
	DeviceType:                "ECL::VirtualNetworkAppliance::VSRX",
	DeviceID:                  "c291f4c4-a680-4db0-8b88-7e579f0aaa37",
	DeviceInterfaceID:		   "interface_2",
	AttachmentOpts: tenant_connections.Vna{
		FixedIPs: []tenant_connections.VnaFixedIPs{
			IPAddress: "192.168.1.3",
		},
	},
}

result := tenant_connections.Create(tcClient, createOpts)
if result.Err != nil {
	panic(result.Err)
}

Example to Update a Tenant Connection

tenant_connection_id := "ea5d975c-bd31-11e7-bcac-0050569c850d"

updateOpts := tenant_connections.UpdateOpts{
	Name: "test_name",
	Description: "test_desc",
	Tags: map[string]string{
		"test_tags": "test",
	},
	NameOther: "test_name_other",
	DescriptionOther: "test_desc_other",
	TagsOther: map[string]string{
		"test_tags_other": "test_other",
	},
}

result := tenant_connections.Update(tcClient, tenant_connection_id, updateOpts)
if result.Err != nil {
	panic(result.Err)
}

Example to Delete a Tenant Connection

tenant_connection_id := "ea5d975c-bd31-11e7-bcac-0050569c850d"

result := tenant_connections.Delete(tcClient, tenant_connection_id)
if result.Err != nil {
	panic(result.Err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

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

List retrieves a list of Tenant Connection.

Types

type AddressPair

type AddressPair struct {
	IPAddress  string `json:"ip_address,omitempty"`
	MACAddress string `json:"mac_address,omitempty"`
}

AddressPair contains the IP Address and the MAC address.

type BaremetalServer

type BaremetalServer struct {
	AllowedAddressPairs []AddressPair    `json:"allowed_address_pairs,omitempty"`
	FixedIPs            []ServerFixedIPs `json:"fixed_ips,omitempty"`
	SegmentationID      int              `json:"segmentation_id,omitempty"`
	SegmentationType    string           `json:"segmentation_type,omitempty"`
}

BaremetalServer represents the parameter when device_type is Baremetal Server.

type ComputeServer

type ComputeServer struct {
	AllowedAddressPairs []AddressPair    `json:"allowed_address_pairs,omitempty"`
	FixedIPs            []ServerFixedIPs `json:"fixed_ips,omitempty"`
}

ComputeServer represents the parameter when device_type is Compute Server.

type CreateOpts

type CreateOpts struct {
	Name                      string            `json:"name,omitempty"`
	Description               string            `json:"description,omitempty"`
	Tags                      map[string]string `json:"tags,omitempty"`
	TenantConnectionRequestID string            `json:"tenant_connection_request_id" required:"true"`
	DeviceType                string            `json:"device_type" required:"true"`
	DeviceID                  string            `json:"device_id" required:"true"`
	DeviceInterfaceID         string            `json:"device_interface_id,omitempty"`
	AttachmentOpts            interface{}       `json:"attachment_opts,omitempty"`
}

CreateOpts provides options used to create a Tenant Connection.

func (CreateOpts) ToTenantConnectionCreateMap

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

ToTenantConnectionCreateMap formats a CreateOpts into a create request.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToTenantConnectionCreateMap() (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 is the response from a Create operation. Call its Extract method to interpret it as a Tenant Connection.

func Create

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

Create creates a new Tenant Connection.

func (CreateResult) Extract

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

Extract interprets any commonResult as a Tenant Connection.

type DeleteResult

type DeleteResult struct {
	eclcloud.ErrResult
}

DeleteResult is the response from a Delete operation. Call its ExtractErr to determine if the request succeeded or failed.

func Delete

func Delete(client *eclcloud.ServiceClient, id string) (r DeleteResult)

Delete deletes a Tenant Connection.

type GetResult

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

GetResult is the response from a Get operation. Call its Extract method to interpret it as a Tenant Connection.

func Get

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

Get retrieves details of an Tenant Connection.

func (GetResult) Extract

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

Extract interprets any commonResult as a Tenant Connection.

type ListOpts

type ListOpts struct {
	TenantConnectionRequestID string `q:"tenant_connection_request_id"`
	Status                    string `q:"status"`
	Name                      string `q:"name"`
	TenantID                  string `q:"tenant_id"`
	NameOther                 string `q:"name_other"`
	TenantIDOther             string `q:"tenant_id_other"`
	NetworkID                 string `q:"network_id"`
	DeviceType                string `q:"device_type"`
	DeviceID                  string `q:"device_id"`
	DeviceInterfaceID         string `q:"device_interface_id"`
	PortID                    string `q:"port_id"`
}

ListOpts provides options to filter the List results.

func (ListOpts) ToTenantConnectionListQuery

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

ToTenantConnectionListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

ListOptsBuilder allows extensions to add additional parameters to the List request

type ServerFixedIPs

type ServerFixedIPs struct {
	SubnetID  string `json:"subnet_id,omitempty"`
	IPAddress string `json:"ip_address,omitempty"`
}

ServerFixedIPs contains the IP Address and the SubnetID.

type TenantConnection

type TenantConnection struct {
	ID                        string            `json:"id"`
	TenantConnectionRequestID string            `json:"tenant_connection_request_id"`
	Name                      string            `json:"name"`
	Description               string            `json:"description"`
	Tags                      map[string]string `json:"tags"`
	TenantID                  string            `json:"tenant_id"`
	NameOther                 string            `json:"name_other"`
	DescriptionOther          string            `json:"description_other"`
	TagsOther                 interface{}       `json:"tags_other"`
	TenantIDOther             string            `json:"tenant_id_other"`
	NetworkID                 string            `json:"network_id"`
	DeviceType                string            `json:"device_type"`
	DeviceID                  string            `json:"device_id"`
	DeviceInterfaceID         string            `json:"device_interface_id"`
	PortID                    string            `json:"port_id"`
	Status                    string            `json:"status"`
}

TenantConnection represents Tenant Connection. TagsOther is interface{} because the data type returned by Create API depends on the value of device_type. When the device_type of Create Request is ECL::Compute::Server, the data type of tags_other is map[]. When the device_type of Create Request is ECL::Baremetal::Server or ECL::VirtualNetworkAppliance::VSRX, the data type of tags_other is string.

func ExtractTenantConnections

func ExtractTenantConnections(r pagination.Page) ([]TenantConnection, error)

ExtractTenantConnections returns a slice of Tenant Connections contained in a single page of results.

type TenantConnectionPage

type TenantConnectionPage struct {
	pagination.LinkedPageBase
}

TenantConnectionPage is a single page of Tenant Connection results.

func (TenantConnectionPage) IsEmpty

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

IsEmpty determines whether or not a page of Tenant Connection contains any results.

type UpdateOpts

type UpdateOpts struct {
	Name             *string            `json:"name,omitempty"`
	Description      *string            `json:"description,omitempty"`
	Tags             *map[string]string `json:"tags,omitempty"`
	NameOther        *string            `json:"name_other,omitempty"`
	DescriptionOther *string            `json:"description_other,omitempty"`
	TagsOther        *map[string]string `json:"tags_other,omitempty"`
}

UpdateOpts represents parameters to update a Tenant Connection.

func (UpdateOpts) ToTenantConnectionUpdateMap

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

ToTenantConnectionUpdateMap formats a UpdateOpts into an update request.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToTenantConnectionUpdateMap() (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 is the result of an Update request. Call its Extract method to interpret it as a Tenant Connection.

func Update

func Update(client *eclcloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult)

Update modifies the attributes of a Tenant Connection.

func (UpdateResult) Extract

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

Extract interprets any commonResult as a Tenant Connection.

type Vna

type Vna struct {
	FixedIPs []VnaFixedIPs `json:"fixed_ips,omitempty"`
}

Vna represents the parameter when device_type is VSRX.

type VnaFixedIPs

type VnaFixedIPs struct {
	IPAddress string `json:"ip_address,omitempty"`
}

VnaFixedIPs represents ip address part of virtual network appliance.

Directories

Path Synopsis
Tenant Connection unit tests
Tenant Connection unit tests

Jump to

Keyboard shortcuts

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