vrrpsubnets

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Overview

Package vrrpsubnets provides the ability to retrieve and manage VRRP subnets through the Resell v2 API.

Example of getting a single VRRP subnet referenced by its id

vrrpsubnet, _, err := vrrpsubnets.Get(context, resellClient, vrrpSubnetID)
if err != nil {
  log.Fatal(err)
}
fmt.Println(vrrpsubnet)

Example of getting all VRRP subnets

allVRRPSubnets, _, err := vrrpsubnets.List(ctx, resellClient, vrrpsubnets.ListOpts{})
if err != nil {
  log.Fatal(err)
}
for _, vrrpSubnet := range allVRRPSubnets {
  fmt.Println(vrrpSubnet)
}

Example of creating VRRP subnets

createOpts := vrrpsubnets.VRRPSubnetOpts{
  VRRPSubnets: []vrrpsubnets.VRRPSubnetOpt{
    {
      Quantity: 1,
      Regions: vrrpsubnets.VRRPRegionOpt{
        Master: "ru-2",
        Slave:  "ru-1",
      },
      Type:         "ipv4",
      PrefixLength: 29,
    },
  },
}
newVRRPSubnets, _, err := vrrpsubnets.Create(ctx, resellClient, projectID, createOpts)
if err != nil {
  log.Fatal(err)
}
for _, newVRRPSubnet := range newVRRPSubnets {
  fmt.Printf("%v\n", newVRRPSubnet)
}

Example of deleting a single VRRP subnet

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

Delete deletes a single VRRP subnet by its id.

Types

type ListOpts

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

ListOpts represents options for the VRRP subnets List request.

type VRRPRegionOpt

type VRRPRegionOpt struct {
	// Master represent region that contains a master VRRP router.
	Master string `json:"master"`

	// Slave represent region that contains a slave VRRP router.
	Slave string `json:"slave"`
}

VRRPRegionOpt represents region options for the single VRRP subnet.

type VRRPSubnet

type VRRPSubnet struct {
	// ID is a unique id of a VRRP subnet.
	ID int `json:"id"`

	// Status shows if VRRP subnet is used.
	Status string `json:"status"`

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

	// MasterRegion is a reference to a region that contains a master VRRP router.
	MasterRegion string `json:"master_region"`

	// MasterRegion is a reference to a region that contains a slave VRRP router.
	SlaveRegion string `json:"slave_region"`

	// CIDR is a VRRP subnet prefix in CIDR notation.
	CIDR string `json:"cidr"`

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

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

VRRPSubnet represents a single Resell VRRP subnet.

func Create

func Create(ctx context.Context, client *selvpcclient.ServiceClient, projectID string, createOpts VRRPSubnetOpts) ([]*VRRPSubnet, *selvpcclient.ResponseResult, error)

Create requests a creation of the VRRP subnets in the specified project.

func Get

Get returns a single VRRP subnet by its id.

func List

List gets a list of VRRP subnets in the current domain.

type VRRPSubnetOpt

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

	// RegionOpt represents region options for the VRRP subnet.
	Regions VRRPRegionOpt `json:"regions"`

	// Type represents ip version type.
	Type selvpcclient.IPVersion `json:"type"`

	// PrefixLength represents length of the subnet prefix.
	PrefixLength int `json:"prefix_length"`
}

VRRPSubnetOpt represents options for the single VRRP subnet.

type VRRPSubnetOpts

type VRRPSubnetOpts struct {
	// VRRPSubnets represents options for all VRRP subnets.
	VRRPSubnets []VRRPSubnetOpt `json:"vrrp_subnets"`
}

VRRPSubnetOpts represents options for the VRRP subnets Create request.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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