partitions

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: 2 Imported by: 0

Documentation

Overview

Package partitions is a new feature introduced by CCE Turbo remote distributed cluster management. Currently, partitions are divided into three categories: Center, HomeZone, and IES.

  • Default: Indicates the availability zone resources of the HuaweiCloudStack data center
  • HomeZone: Indicates the edge computing area in the user's home, which is not currently supported
  • IES: IES is the edge station of HuaweiCloudStack, which deploys user-specific cloud resources to the local computer zone

The concept of partitions can support CCE Turbo to manage distributed nodes, which has strong applicability in the field of edge computing.

Index

Constants

This section is empty.

Variables

View Source
var RequestOpts golangsdk.RequestOpts = golangsdk.RequestOpts{
	MoreHeaders: map[string]string{"Content-Type": "application/json"},
}

Functions

func GetStructNestedField

func GetStructNestedField(v *Partitions, field string, structDriller []string) string

Types

type ContainerNetwork

type ContainerNetwork struct {
	// The default SubnetID for the partition container
	SubnetID string `json:"subnetID,omitempty"`
}

ContainerNetwork the default host network for the partition container

type CreateMetaData

type CreateMetaData struct {
	// Partition name
	Name string `json:"name,omitempty"`
	// Partition tag, key value pair format
	Labels map[string]string `json:"labels,omitempty"`
	// Partition annotation, key value pair format
	Annotations map[string]string `json:"annotations,omitempty"`
}

Metadata required to create a Partition

type CreateOpts

type CreateOpts struct {
	// API type, fixed value Partition
	Kind string `json:"kind" required:"true"`
	// API version, fixed value v3
	ApiVersion string `json:"apiversion" required:"true"`
	// Metadata required to create a Partition
	Metadata CreateMetaData `json:"metadata"`
	// specifications to create a Partition
	Spec Spec `json:"spec" required:"true"`
}

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

func (CreateOpts) ToPartitionCreateMap

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

ToPartitionCreateMap builds a create request body from CreateOpts.

type CreateOptsBuilder

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

Create accepts a CreateOpts struct and uses the values to create a new logical Partition. When it is created, the Partition does not have an internal interface

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

func Create

func Create(c *golangsdk.ServiceClient, clusterid string, opts CreateOptsBuilder) (r CreateResult)

Create accepts a CreateOpts struct and uses the values to create a new logical Partition.

func (CreateResult) Extract

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

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

func (CreateResult) ExtractPartitions

func (r CreateResult) ExtractPartitions() ([]Partitions, error)

ExtractPartitions is a function that accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

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(c *golangsdk.ServiceClient, clusterid, partitionName string) (r DeleteResult)

Delete will permanently delete a particular partition based on its unique Name and cluster ID.

type FilterStruct

type FilterStruct struct {
	Value   string
	Driller []string
}

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

func Get

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

Get retrieves a particular partitions based on its unique ID and cluster ID.

func (GetResult) Extract

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

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

func (GetResult) ExtractPartitions

func (r GetResult) ExtractPartitions() ([]Partitions, error)

ExtractPartitions is a function that accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

type HostNetwork

type HostNetwork struct {
	// The default SubnetID for the partition
	SubnetID string `json:"subnetID,omitempty"`
}

HostNetwork the default host network for the partition

type ListOpts

type ListOpts struct {
	Name string `json:"name"`
}

ListOpts allows the filtering of list data using given parameters.

type ListPartition

type ListPartition struct {
	// API type, fixed value "List"
	Kind string `json:"kind"`
	// API version, fixed value "v3"
	Apiversion string `json:"apiVersion"`
	// all Clusters
	Partitions []Partitions `json:"items"`
}

Describes the Partition Structure of cluster

type ListResult

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

ListResult represents the result of a list operation. Call its ExtractCluster method to interpret it as a Cluster.

func (ListResult) Extract

func (r ListResult) Extract() (*Partitions, error)

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

func (ListResult) ExtractPartitions

func (r ListResult) ExtractPartitions() ([]Partitions, error)

ExtractPartitions is a function that accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

type Metadata

type Metadata struct {
	// Partition name
	Name string `json:"name"`
}

Metadata required to create a partition

type Partitions

type Partitions struct {
	// API type, fixed value " Host "
	Kind string `json:"kind"`
	// API version, fixed value v3
	Apiversion string `json:"apiVersion"`
	// Partition metadata
	Metadata Metadata `json:"metadata"`
	// Partition detailed parameters
	Spec Spec `json:"spec"`
}

Individual partitions of the cluster

func FilterPartitions

func FilterPartitions(partitions []Partitions, opts ListOpts) []Partitions

func List

func List(client *golangsdk.ServiceClient, clusterID string, opts ListOpts) ([]Partitions, error)

List returns collection of partitions.

type Spec

type Spec struct {
	// The category of partition
	Category string `json:"category,omitempty"`
	// The availability zone name of the partition
	PublicBorderGroup string `json:"publicBorderGroup,omitempty"`
	// The default host network for the partition
	HostNetwork HostNetwork `json:"hostNetwork,omitempty"`
	// The default host network for the partition container
	ContainerNetwork []ContainerNetwork `json:"containerNetwork,omitempty"`
}

Spec describes Partitions specification

type UpdateMetadata

type UpdateMetadata struct {
	ContainerNetwork []ContainerNetwork `json:"containerNetwork,omitempty"`
}

type UpdateOpts

type UpdateOpts struct {
	Metadata UpdateMetadata `json:"metadata,omitempty"`
}

UpdateOpts contains all the values needed to update a new partition

func (UpdateOpts) ToPartitionUpdateMap

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

ToPartitionUpdateMap builds an update body based on UpdateOpts.

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToPartitionUpdateMap() (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 Cluster.

func Update

func Update(c *golangsdk.ServiceClient, clusterid, partitionName string, opts UpdateOptsBuilder) (r UpdateResult)

Update allows partitions to be updated.

func (UpdateResult) Extract

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

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

func (UpdateResult) ExtractPartitions

func (r UpdateResult) ExtractPartitions() ([]Partitions, error)

ExtractPartitions is a function that accepts a ListOpts struct, which allows you to filter and sort the returned collection for greater efficiency.

Jump to

Keyboard shortcuts

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