crossregionsubnets

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package crossregionsubnets provides the ability to retrieve and manage cross-region subnets through the Resell v2 API.

Example of getting a single cross-region subnet referenced by its id

crossRegionSubnet, _, err := crossregionsubnets.Get(context, resellClient, crossRegionSubnetID)
if err != nil {
  log.Fatal(err)
}
fmt.Println(crossRegionSubnet)

Example of getting all cross-region subnets

allCrossRegionSubnets, _, err := crossregionsubnets.List(ctx, resellClient, crossregionsubnets.ListOpts{})
if err != nil {
  log.Fatal(err)
}
for _, crossRegionSubnet := range allCrossRegionSubnets {
  fmt.Println(crossRegionSubnet)
}

Example of creating cross-region subnets

createOpts := crossregionsubnets.CrossRegionSubnetOpts{
  CrossRegionSubnets: []crossregionsubnets.CrossRegionSubnetOpt{
    {
      Quantity: 1,
      Regions: []crossregionsubnets.CrossRegionOpt{
        {
          Region: "ru-1",
        },
        {
          Region: "ru-3",
        },
      },
      CIDR: "192.168.200.0/24",
    },
  },
}
newCrossRegionSubnets, _, err := crossregionsubnets.Create(ctx, resellClient, projectID, createOpts)
if err != nil {
  log.Fatal(err)
}
for _, newCrossRegionSubnet := range newCrossRegionSubnets {
  fmt.Printf("%v\n", newCrossRegionSubnet)
}

Example of deleting a single cross-region subnet

_, err = crossregionsubnets.Delete(ctx, resellClient, crossRegionSubnetID)
if err != nil {
  log.Fatal(err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

Delete deletes a single cross-region subnet by its id.

Types

type CrossRegionOpt

type CrossRegionOpt struct {
	// Region represents region that cross-region subnet is associated to.
	Region string `json:"region"`
}

CrossRegionOpt represents region options for the cross-region subnet.

type CrossRegionSubnet

type CrossRegionSubnet struct {
	// ID is a unique id of a cross-region subnet.
	ID int `json:"id"`

	// CIDR is a cross-region subnet prefix in CIDR notation.
	CIDR string `json:"cidr"`

	// VLANID represents id of the associated VLAN in the Networking service.
	VLANID int `json:"vlan_id"`

	// Status shows if cross-region subnet is used.
	Status string `json:"status"`

	// ProjectID represents an associated Identity service project.
	ProjectID string `json:"project_id"`

	// Servers contains info about servers to which cross-region subnet is associated to.
	Servers []servers.Server `json:"servers"`

	// Subnets contains standard subnets in every region that cross-region subnet is attached to.
	Subnets []subnets.Subnet `json:"subnets"`
}

CrossRegionSubnet represents a single Resell cross-region subnet.

func Create

Create requests a creation of the cross-region subnets in the specified project.

func Get

Get returns a single cross-region subnet by its id.

func List

List gets a list of cross-region subnets in the current domain.

type CrossRegionSubnetOpt

type CrossRegionSubnetOpt struct {
	// Quantity represents how many subnets do we need to create.
	Quantity int `json:"quantity"`

	// Regions represents region options for the cross-region subnet.
	Regions []CrossRegionOpt `json:"regions"`

	// CIDR represents a subnet prefix in CIDR notation for the cross-region subnet.
	CIDR string `json:"cidr"`
}

CrossRegionSubnetOpt represents options for the single cross-region subnet.

type CrossRegionSubnetOpts

type CrossRegionSubnetOpts struct {
	// CrossRegionSubnets represents options for all cross-region subnets.
	CrossRegionSubnets []CrossRegionSubnetOpt `json:"cross_region_subnets"`
}

CrossRegionSubnetOpts represents options for the cross-region subnets Create request.

type ListOpts

type ListOpts struct {
	Detailed bool `param:"detailed"`
}

ListOpts represents options for the List request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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