github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/cci/v1/persistentvolumeclaims/results.go (about) 1 package persistentvolumeclaims 2 3 import ( 4 "github.com/huaweicloud/golangsdk" 5 "github.com/huaweicloud/golangsdk/pagination" 6 ) 7 8 type PersistentVolumeClaim struct { 9 Kind string `json:"kind"` 10 ApiVersion string `json:"apiVersion"` 11 Metadata MetaResp `json:"metadata"` 12 Spec SpecResp `json:"spec"` 13 Status Status `json:"status"` 14 } 15 16 type MetaResp struct { 17 // The name of the Persistent Volume Claim. 18 Name string `json:"name"` 19 // The namespace where the Persistent Volume Claim is located. 20 Namespace string `json:"namespace"` 21 // An unstructured key value map stored with a resource that may be set by external tools to store and retrieve 22 // arbitrary metadata. 23 Annotations map[string]string `json:"annotations"` 24 // ID of the Persistent Volume Claim in UUID format. 25 UID string `json:"uid"` 26 // String that identifies the server's internal version of this object that can be used by clients to determine 27 // when objects have changed. 28 ResourceVersion string `json:"resourceVersion"` 29 // A timestamp representing the server time when this object was created. 30 CreationTimestamp string `json:"creationTimestamp"` 31 // SelfLink is a URL representing this object. 32 SelfLink string `json:"selfLink"` 33 // Map of string keys and values that can be used to organize and categorize (scope and select) objects. 34 Labels map[string]string `json:"labels"` 35 // Each finalizer string of array is an identifier for the responsible component that will remove the entry form 36 // the list. 37 Finalizers []string `json:"finalizers"` 38 // Enable identify whether the resource is available. 39 Enable bool `json:"enable"` 40 } 41 42 // The extra response of Persistent Volume are Capacity, FlexVolume, ClaimRef and PersistentVolumeReclaimPolicy. 43 type SpecResp struct { 44 // The name of the volume. 45 VolumeName string `json:"volumeName"` 46 // AccessModes contains the actual access modes the volume backing the PVC has. 47 AccessModes []string `json:"accessModes"` 48 // Resources represents the minimum resources the volume should have. 49 Resources ResourceRequirement `json:"resources"` 50 // Name of the storage class required by the claim. 51 StorageClassName string `json:"storageClassName"` 52 // Mode of the volume. 53 VolumeMode string `json:"volumeMode"` 54 // The capacity of the storage. 55 Capacity ResourceName `json:"capacity"` 56 // PersistentVolumeClaim. 57 FlexVolume FlexVolume `json:"flexVolume"` 58 // Part of a bi-directional binding between persistentVolume and persistentVolumeClaim. 59 ClaimRef ClaimRef `json:"claimRef"` 60 // Specifies what happens to a persistent volume when released form its claim. 61 PersistentVolumeReclaimPolicy string `json:"persistentVolumeReclaimPolicy"` 62 } 63 64 type FlexVolume struct { 65 Driver string `json:"driver"` 66 FsType string `json:"fsType"` 67 Options Options `json:"options"` 68 } 69 70 type Options struct { 71 // The type of the file system. 72 FsType string `json:"fsType"` 73 // ID of the volume. 74 VolumeID string `json:"volumeID"` 75 // The Shared path of the SFS and the SFS Turbo. 76 DeviceMountPath string `json:"deviceMountPath"` 77 } 78 79 type ClaimRef struct { 80 // Kind of the referent. 81 Kind string `json:"kind"` 82 // Namespace of the referent. 83 Namespace string `json:"namespace"` 84 // Name of the referent. 85 Name string `json:"name"` 86 // UID of the referent. 87 UID string `json:"uid"` 88 // API version of the referent. 89 AapiVersion string `json:"apiVersion"` 90 // Specifies resource version to which this reference is made, If any. 91 ResourceVersion string `json:"resourceVersion"` 92 } 93 94 type Status struct { 95 // Phase represents the current phase of persistentVolumeClaim. 96 // pending: used for PersistentVolumeClaims that are not yet bound. 97 // Bound: used for PersistentVolumeClaims that are bound. 98 // Lost: used for PersistentVolumeClaims that lost their underlying. 99 Phase string `json:"phase"` 100 } 101 102 type commonResult struct { 103 golangsdk.Result 104 } 105 106 type CreateResult struct { 107 commonResult 108 } 109 110 func (r commonResult) Extract() (*PersistentVolumeClaim, error) { 111 var s PersistentVolumeClaim 112 err := r.ExtractInto(&s) 113 return &s, err 114 } 115 116 type ListResp struct { 117 PersistentVolumeClaim PersistentVolumeClaim `json:"persistentVolumeClaim"` 118 PersistentVolume PersistentVolumeClaim `json:"persistentVolume"` 119 } 120 121 type PersistentVolumeClaimPage struct { 122 pagination.SinglePageBase 123 } 124 125 func ExtractPersistentVolumeClaims(r pagination.Page) ([]ListResp, error) { 126 var s []ListResp 127 err := r.(PersistentVolumeClaimPage).Result.ExtractIntoSlicePtr(&s, "") 128 return s, err 129 } 130 131 type DeleteResult struct { 132 commonResult 133 } 134 135 func (r DeleteResult) Extract() ([]PersistentVolumeClaim, error) { 136 var s []PersistentVolumeClaim 137 err := r.ExtractInto(&s) 138 return s, err 139 }