peerings

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package peerings enables management and retrieval of vpc peering connections

Example to List a Vpc Peering Connections

listOpts:=peerings.ListOpts{}

peering,err :=peerings.List(client,sub).AllPages()
if err != nil{
	fmt.Println(err)
}

peerings,err:=peerings.ExtractPeerings(peering)
if err != nil{
	fmt.Println(err)
}

Example to Get a Vpc Peering Connection

peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3"
peering,err :=peerings.Get(client,peeringID).Extract()
if err != nil{
	fmt.Println(err)
}

Example to Accept a Vpc Peering Connection Request

 // Note:- The TenantId should be of accepter

    peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3"

    peering,err:=peerings.Accept(client,peeringID).ExtractResult()

	if err != nil{
		fmt.Println(err)
	}

Example to Reject a Vpc Peering Connection Request

 // Note:- The TenantId should be of accepter
    peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3"

    peering,err:=peerings.Reject(client,peeringID).ExtractResult()

	if err != nil{
		fmt.Println(err)
	}

Example to Create a Vpc Peering Connection

RequestVpcInfo:=peerings.VpcInfo{VpcId:"3127e30b-5f8e-42d1-a3cc-fdadf412c5bf"}
AcceptVpcInfo:=peerings.VpcInfo{"c6efbdb7-dca4-4178-b3ec-692f125c1e25","17fbda95add24720a4038ba4b1c705ed"}

opt:=peerings.CreateOpts{"C2C_test",RequestVpcInfo,AcceptVpcInfo}

peering,err:=peerings.Create(client,opt).Extract()

if err != nil{
	fmt.Println(err)
}

Example to Update a VpcPeeringConnection

peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3"

updateOpts:=peerings.UpdateOpts{"C2C_tes1"}

peering,err:=peerings.Update(client,peeringID,updateOpts).Extract()

if err != nil{
	fmt.Println(err)
}

Example to Delete a VpcPeeringConnection

peeringID := "6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3"
err := peerings.Delete(client,"6bbacb0f-9f94-4fe8-a6b6-1818bdccb2a3")
if err != nil {
	panic(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptResult

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

AcceptResult represents the result of a get operation. Call its Extract method to interpret it as a Vpc Peering Connection.

func Accept

func Accept(c *golangsdk.ServiceClient, id string) (r AcceptResult)

Accept is used by a tenant to accept a VPC peering connection request initiated by another tenant.

func (AcceptResult) Extract

func (r AcceptResult) Extract() (*Peering, error)

Extract is a function that accepts a result and extracts a Peering.

func (AcceptResult) ExtractResult

func (r AcceptResult) ExtractResult() (Peering, error)

ExtractResult is a function that accepts a result and extracts a Peering.

type CreateOpts

type CreateOpts struct {
	Name           string  `json:"name"`
	RequestVpcInfo VpcInfo `json:"request_vpc_info" required:"true"`
	AcceptVpcInfo  VpcInfo `json:"accept_vpc_info" required:"true"`
	Description    string  `json:"description,omitempty"`
}

CreateOpts is a struct which is used to create vpc peering connection.

func (CreateOpts) ToPeeringCreateMap

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

ToVpcPeeringCreateMap builds a create request body from CreateOpts.

type CreateOptsBuilder

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

CreateOptsBuilder is an interface by which can build the request body of vpc peering connection.

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 vpc peering connection.

func Create

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

Create is a method by which can access to create the vpc peering connection.

func (CreateResult) Extract

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

Extract is a function that accepts a result and extracts a Peering.

func (CreateResult) ExtractResult

func (r CreateResult) ExtractResult() (Peering, error)

ExtractResult is a function that accepts a result and extracts a Peering.

type DeleteResult

type DeleteResult struct {
	golangsdk.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(client *golangsdk.ServiceClient, id string) (r DeleteResult)

Delete is a method by which can be able to delete a vpc peering connection.

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 Vpc Peering Connection.

func Get

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

func (GetResult) Extract

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

Extract is a function that accepts a result and extracts a Peering.

func (GetResult) ExtractResult

func (r GetResult) ExtractResult() (Peering, error)

ExtractResult is a function that accepts a result and extracts a Peering.

type ListOpts

type ListOpts struct {
	//ID is the unique identifier for the vpc_peering_connection.
	ID string `q:"id"`

	//Name is the human readable name for the vpc_peering_connection. It does not have to be
	// unique.
	Name string `q:"name"`

	//Status indicates whether or not a vpc_peering_connection is currently operational.
	Status string `q:"status"`

	// TenantId indicates  vpc_peering_connection avalable in specific tenant.
	TenantId string `q:"tenant_id"`

	// VpcId indicates vpc_peering_connection avalable in specific vpc.
	VpcId string `q:"vpc_id"`

	// VpcId indicates vpc_peering_connection available in specific vpc.
	Peer_VpcId string
}

ListOpts allows the filtering of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the floating IP attributes you want to see returned.

func FilterVpcIdParam

func FilterVpcIdParam(opts ListOpts) (filter ListOpts)

type Peering

type Peering struct {
	// ID is the unique identifier for the vpc_peering_connection.
	ID string `json:"id"`

	// Name is the human readable name for the vpc_peering_connection. It does not have to be
	// unique.
	Name string `json:"name"`

	// Status indicates whether or not a vpc_peering_connections is currently operational.
	Status string `json:"status"`

	// Description is the supplementary information about the VPC peering connection.
	Description string `json:"description"`

	// RequestVpcInfo indicates information about the local VPC
	RequestVpcInfo VpcInfo `json:"request_vpc_info"`

	// AcceptVpcInfo indicates information about the peer VPC
	AcceptVpcInfo VpcInfo `json:"accept_vpc_info"`
}

Peering represents a Neutron VPC peering connection. Manage and perform other operations on VPC peering connections, including querying VPC peering connections as well as creating, querying, deleting, and updating a VPC peering connection.

func ExtractPeerings

func ExtractPeerings(r pagination.Page) ([]Peering, error)

ExtractPeerings accepts a Page struct, specifically a PeeringConnectionPage struct, and extracts the elements into a slice of Peering structs. In other words, a generic collection is mapped into a relevant slice.

func FilterVpcPeeringConns

func FilterVpcPeeringConns(peerings []Peering, opts ListOpts) ([]Peering, error)

func List

func List(c *golangsdk.ServiceClient, opts ListOpts) ([]Peering, error)

List returns a Pager which allows you to iterate over a collection of vpc_peering_connection resources. It accepts a ListOpts struct, which allows you to filter the returned collection for greater efficiency.

type PeeringConnectionPage

type PeeringConnectionPage struct {
	pagination.LinkedPageBase
}

PeeringConnectionPage is the page returned by a pager when traversing over a collection of vpc_peering_connections.

func (PeeringConnectionPage) IsEmpty

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

IsEmpty checks whether a PeeringConnectionPage struct is empty.

func (PeeringConnectionPage) NextPageURL

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

NextPageURL is invoked when a paginated collection of vpc_peering_connections 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 RejectResult

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

RejectResult represents the result of a get operation. Call its Extract method to interpret it as a Vpc Peering Connection.

func Reject

func Reject(c *golangsdk.ServiceClient, id string) (r RejectResult)

Reject is used by a tenant to reject a VPC peering connection request initiated by another tenant.

func (RejectResult) Extract

func (r RejectResult) Extract() (*Peering, error)

Extract is a function that accepts a result and extracts a Peering.

func (RejectResult) ExtractResult

func (r RejectResult) ExtractResult() (Peering, error)

ExtractResult is a function that accepts a result and extracts a Peering.

type UpdateOpts

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

UpdateOpts is a struct which represents the request body of update method.

func (UpdateOpts) ToVpcPeeringUpdateMap

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

ToVpcPeeringUpdateMap builds a update request body from UpdateOpts.

type UpdateOptsBuilder

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

UpdateOptsBuilder is an interface by which can be able to build the request body of vpc peering connection.

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 vpc peering connection.

func Update

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

Update is a method which can be able to update the name of vpc peering connection.

func (UpdateResult) Extract

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

Extract is a function that accepts a result and extracts a Peering.

func (UpdateResult) ExtractResult

func (r UpdateResult) ExtractResult() (Peering, error)

ExtractResult is a function that accepts a result and extracts a Peering.

type VpcInfo

type VpcInfo struct {
	VpcId    string `json:"vpc_id" required:"true"`
	TenantId string `json:"tenant_id,omitempty"`
}

Jump to

Keyboard shortcuts

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