persistentvolumeclaims

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(c *golangsdk.ServiceClient, clusterId, ns string) pagination.Pager

List is a method to obtain an array of the persistent volume claims for specifies namespace.

Types

type Capacity

type Capacity struct {
	// Volume size, in GB format: 'xGi'.
	Storage string `json:"storage"`
}

Capacity is an object struct that represents the volume capacity.

type CapacityReq

type CapacityReq struct {
	// Volume size, in GB format: 'xGi'.
	Storage string `json:"storage" required:"true"`
}

CapacityReq is an object struct that represents the volume capacity.

type CreateOpts

type CreateOpts struct {
	// The version of the persistent API, valid value is 'v1'.
	ApiVersion string `json:"apiVersion" required:"true"`
	// Kind is a string value representing the REST resource this object represents.
	// Servers may infer this from the endpoint the c submits requests to.
	Kind string `json:"kind" required:"true"`
	// Standard object's metadata.
	Metadata Metadata `json:"metadata" required:"true"`
	// The desired characteristics of a volume.
	Spec Spec `json:"spec" required:"true"`
}

CreateOpts allows to create a persistent volume claims using given parameters.

func (CreateOpts) ToPvcCreateMap

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

ToPvcCreateMap builds a create request body from CreateOpts.

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToPvcCreateMap() (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 represents a result of the Create method.

func Create

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

Create accepts a CreateOpts struct and uses the namespace name to import a volume into the namespace.

func (CreateResult) Extract

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

type DeleteResult

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

DeleteResult represents a result of the Create method.

func Delete

func Delete(c *golangsdk.ServiceClient, clusterId, ns, name string) (r DeleteResult)

Delete accepts to delete the specifies persistent volume claim form the namespace.

func (DeleteResult) Extract

func (r DeleteResult) Extract() ([]PersistentVolumeClaim, error)

Extract is a method which to extract the response to a PVC object.

type MetaResp

type MetaResp struct {
	// The name of the Persistent Volume Claim.
	Name string `json:"name"`
	// The namespace where the Persistent Volume Claim is located.
	Namespace string `json:"namespace"`
	// An unstructured key value map stored with a resource that may be set by external tools to store and retrieve
	// arbitrary metadata.
	Annotations map[string]string `json:"annotations"`
	// ID of the Persistent Volume Claim in UUID format.
	UID string `json:"uid"`
	// String that identifies the server's internal version of this object that can be used by clients to determine
	// when objects have changed.
	ResourceVersion string `json:"resourceVersion"`
	// A timestamp representing the server time when this object was created.
	CreationTimestamp string `json:"creationTimestamp"`
	// SelfLink is a URL representing this object.
	SelfLink string `json:"selfLink"`
	// Map of string keys and values that can be used to organize and categorize (scope and select) objects.
	Labels map[string]string `json:"labels"`
	// Each finalizer string of array is an identifier for the responsible component that will remove the entry form
	// the list.
	Finalizers []string `json:"finalizers"`
	// Enable identify whether the resource is available.
	Enable bool `json:"enable"`
}

MetaResp is an object struct that represents the persistent volume claim metadata.

type Metadata

type Metadata struct {
	// The name of the persistent volume claim.
	Name string `json:"name,omitempty"`
	// The namespace of the persistent volume claim.
	Namespace string `json:"namespace,omitempty"`
	// The labels of the persistent volume claim.
	Labels map[string]string `json:"labels,omitempty"`
	// The annotations of the persistent volume claim.
	Annotations map[string]string `json:"annotations,omitempty"`
}

Metadata is an object which will be build up standard object metadata.

type PersistentVolumeClaim

type PersistentVolumeClaim struct {
	// The version of the persistent API.
	ApiVersion string `json:"apiVersion"`
	// The REST resource of object represents.
	Kind string `json:"kind"`
	// Standard object's metadata.
	Metadata MetaResp `json:"metadata"`
	// The desired characteristics of a volume.
	Spec SpecResp `json:"spec"`
	// PVC status.
	Status Status `json:"status"`
}

PersistentVolumeClaim is a struct that represents the result of Create, Get and List methods.

func ExtractPersistentVolumeClaims

func ExtractPersistentVolumeClaims(r pagination.Page) ([]PersistentVolumeClaim, error)

ExtractPersistentVolumeClaims is a method to interpret the PersistentVolumeClaimPage as a PVC list.

type PersistentVolumeClaimPage

type PersistentVolumeClaimPage struct {
	pagination.SinglePageBase
}

PersistentVolumeClaimPage represents the result of a List method.

type ResourceRequest

type ResourceRequest struct {
	// Minimum amount of compute resources required.
	// If requests is omitted for a container, it defaults to Limits if that is explicitly specified,
	// otherwise to an implementation-defined value.
	Requests CapacityReq `json:"requests" required:"true"`
}

ResourceRequest is an object struct that represents the detailed of the volume.

type ResourceRequirement

type ResourceRequirement struct {
	// Minimum amount of compute resources required.
	// If requests is omitted for a container, it defaults to Limits if that is explicitly specified,
	// otherwise to an implementation-defined value.
	Requests Capacity `json:"requests"`
}

ResourceRequirement is an object struct that represents the detailed of the volume.

type Spec

type Spec struct {
	// Access mode of the volume. Only the first value in all selected options is valid.
	// ReadWriteOnce: The volume can be mounted as read-write by a single node.
	// NOTE:
	// This function is supported only when the cluster version is v1.13.10 and the storage-driver version is 1.0.19.
	// ReadOnlyMany (default): The volume can be mounted as read-only by many nodes.
	// ReadWriteMany: The volume can be mounted as read-write by many nodes.
	AccessModes []string `json:"accessModes" required:"true"`
	// Storage class name of the PVC.
	StorageClassName string `json:"storageClassName,omitempty"`
	// Resources represents the minimum resources the volume should have.
	Resources ResourceRequest `json:"resources" required:"true"`
	// Name of the PV bound to the PVC.
	VolumeName string `json:"volumeName,omitempty"`
}

Spec defines the detailed description of the cluster object.

type SpecResp

type SpecResp struct {
	// The name of the volume.
	VolumeName string `json:"volumeName"`
	// AccessModes contains the actual access modes the volume backing the PVC has.
	AccessModes []string `json:"accessModes"`
	// Resources represents the minimum resources the volume should have.
	Resources ResourceRequirement `json:"resources"`
	// Name of the storage class required by the claim.
	StorageClassName string `json:"storageClassName"`
	// Mode of the volume.
	VolumeMode string `json:"volumeMode"`
}

SpecResp is an object struct that represents the detailed description.

type Status

type Status struct {
	// AccessModes contains the actual access modes the volume backing the PVC has.
	Capacity Capacity `json:"capacity"`
	// AccessModes contains the actual access modes the volume backing the PVC has.
	AccessModes []string `json:"accessModes"`
	// Phase represents the current phase of persistentVolumeClaim.
	//   pending: used for PersistentVolumeClaims that are not yet bound.
	//   Bound: used for PersistentVolumeClaims that are bound.
	//   Lost: used for PersistentVolumeClaims that lost their underlying.
	Phase string `json:"phase"`
}

Status is an object struct that represents the volume capacity.

Jump to

Keyboard shortcuts

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