github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/servicestage/v2/instances/results.go (about) 1 package instances 2 3 import "github.com/chnsz/golangsdk/pagination" 4 5 type JobResp struct { 6 // Component instance ID. 7 InstanceId string `json:"instance_id"` 8 // Job ID. 9 JobId string `json:"job_id"` 10 } 11 12 // Instance is the structure that represents the details of the ServiceStage component instance. 13 type Instance struct { 14 // Component instance ID. 15 ID string `json:"id"` 16 // Component instance name. 17 Name string `json:"name"` 18 // Component environment ID. 19 EnvironmentId string `json:"environment_id"` 20 // Platform type. 21 // Value: cce or vmapp. 22 PlatformType string `json:"platform_type"` 23 // Instance description. 24 Description string `json:"description"` 25 // Resource flavor. 26 FlavorId string `json:"flavor_id"` 27 // Artifact. key indicates the component name. In the Docker container scenario, key indicates the container name. 28 Artifacts map[string]Artifact `json:"artifacts"` 29 // Component version. 30 Version string `json:"version"` 31 // Component configurations, such as environment variables. 32 Configuration ConfigurationResp `json:"configuration"` 33 // Creator. 34 Creator string `json:"creator"` 35 // Creation time. 36 CreatedAt int `json:"create_time"` 37 // Update time. 38 UpdatedAt int `json:"update_time"` 39 // Access mode. 40 ExternalAccesses []ExternalAccessResp `json:"external_accesses"` 41 // Deployed resources. 42 ReferResources []ReferResource `json:"refer_resources"` 43 // Status details. 44 StatusDetail StatusDetail `json:"status_detail"` 45 } 46 47 // ConfigurationResp is an object represents the configuration details of the deployment. 48 type ConfigurationResp struct { 49 // Environment variable. 50 EnvVariables []VariableResp `json:"env"` 51 // Data storage configuration. 52 Storages []StorageResp `json:"storage"` 53 // Upgrade policy. 54 Strategy StrategyResp `json:"strategy"` 55 // Lifecycle. 56 Lifecycle LifecycleResp `json:"lifecycle"` 57 // Policy list of log collection. 58 LogCollectionPolicy []LogCollectionPolicyResp `json:"logs"` 59 // Scheduling policy. 60 Scheduler SchedulerResp `json:"scheduler"` 61 // Health check. 62 Probe ProbeResp `json:"probes"` 63 } 64 65 // VariableResp is an object represents the detail of the environment variable. 66 67 type VariableResp struct { 68 // Whether variable is internal variable. 69 Internal bool `json:"internal"` 70 // Environment variable name. 71 // The value contains 1 to 64 characters, including letters, digits, underscores (_), hyphens (-), and dots (.), 72 // and cannot start with a digit. 73 Name string `json:"name"` 74 // Environment variable value. 75 Value string `json:"value"` 76 } 77 78 // StorageResp is an object represents the storage configuration of the deployment. 79 type StorageResp struct { 80 // Storage type. Value: 81 // HostPath: host path mounting. 82 // EmptyDir: temporary directory mounting. 83 // ConfigMap: configuration item mounting. 84 // Secret: secret volume mounting. 85 // PersistentVolumeClaim: cloud storage mounting. 86 Type string `json:"type" required:"true"` 87 // Storage parameter. 88 Parameters StorageParams `json:"parameters" required:"true"` 89 // Directory mounted to the container. 90 Mounts []Mount `json:"mounts" required:"true"` 91 } 92 93 // StrategyResp is an object represents the upgrade information of the deployment. 94 type StrategyResp struct { 95 Spec Spec `json:"spec"` 96 // Upgrade policy. Value: Recreate or RollingUpdate (default). 97 // The former indicates in-place upgrade while the latter indicates rolling upgrade. 98 Upgrade string `json:"upgrade,omitempty"` 99 } 100 101 // Spec is an object represents the other upgrade details. 102 type Spec struct { 103 // The maximum surge number. 104 MaxSurge int `json:"maxSurge"` 105 // The maximum unavailable upgrade count. 106 MaxUnavailable int `json:"maxUnavailable"` 107 } 108 109 // LifecycleResp is an object represents the lifecycle of the deployment. 110 type LifecycleResp struct { 111 // Startup command. 112 Entrypoint Entrypoint `json:"entrypoint"` 113 // Post-start processing. 114 PostStart ProcessResp `json:"post-start"` 115 // Pre-stop processing. 116 PreStop ProcessResp `json:"pre-stop"` 117 } 118 119 // ProcessResp is an object represents the details of the post-processing or stop pre-processing. 120 type ProcessResp struct { 121 // Process type. The value is command or http. 122 // The command is to execute the command line, and http is to send an http request. 123 Type string `json:"type" required:"true"` 124 // Start post-processing or stop pre-processing parameters. 125 Parameters ProcessParams `json:"parameters" required:"true"` 126 } 127 128 // LogCollectionPolicyResp is an object represents the details of the log collection policy. 129 type LogCollectionPolicyResp struct { 130 // Container mounting path. 131 LogPath string `json:"logPath"` 132 // The extend host path, the valid values are as follows: 133 // None 134 // PodUID 135 // PodName 136 // PodUID/ContainerName 137 // PodName/ContainerName 138 // If omited, means container mounting. 139 HostExtendPath string `json:"hostExtendPath"` 140 // Aging period. 141 AgingPeriod string `json:"rotate"` 142 // Host mounting path. 143 HostPath string `json:"hostPath"` 144 } 145 146 // SchedulerResp is an object represents the scheduling policy. 147 type SchedulerResp struct { 148 // Affinity. 149 Affinity Affinity `json:"affinity,omitempty"` 150 // Anti-affinity. 151 AntiAffinity Affinity `json:"anti-affinity,omitempty"` 152 } 153 154 // ProbeResp is an object represents the probe members configuration of the deployment. 155 type ProbeResp struct { 156 // Component liveness probe. 157 LivenessProbe ProbeDetail `json:"livenessProbe,omitempty"` 158 // Component service probe. 159 ReadinessProbe ProbeDetail `json:"readinessProbe,omitempty"` 160 } 161 162 // ExternalAccessResp is an object represents the configuration of the external IP access. 163 type ExternalAccessResp struct { 164 // Protocol. Value: http or https. 165 Protocol string `json:"protocol"` 166 // Access address. 167 Address string `json:"address"` 168 // Port number. 169 ForwardPort int `json:"forward_port"` 170 // Type. 171 Type string `json:"type"` 172 // Status. 173 Status string `json:"status"` 174 // Creation time. 175 CreatedAt int `json:"create_time"` 176 // Update time. 177 UpdatedAt int `json:"update_time"` 178 } 179 180 // StorageResp is an object represents the status details of the deployment. 181 type StatusDetail struct { 182 // Enterprise project ID. 183 EnterpriseProjectId string `json:"enterprise_project_id"` 184 // Instance status. 185 Status string `json:"status"` 186 // Number of normal instance replicas. 187 AvailableReplica int `json:"available_replica"` 188 // Number of instance replicas. 189 Replica int `json:"replica"` 190 // Failure description. 191 FailDetail string `json:"fail_detail"` 192 // Latest job ID. 193 LastJobId string `json:"last_job_id"` 194 // Latest job status. 195 LastJobStatus string `json:"last_job_status"` 196 } 197 198 // InstancePage is a single page maximum result representing a query by offset page. 199 type InstancePage struct { 200 pagination.OffsetPageBase 201 } 202 203 // ExtractInstances is a method to extract the list of environment details for ServiceStage service. 204 func ExtractInstances(r pagination.Page) ([]Instance, error) { 205 var s []Instance 206 r.(InstancePage).Result.ExtractIntoSlicePtr(&s, "isntances") 207 return s, nil 208 } 209 210 // Job is the structure that represents the result of the Action. 211 type Job struct { 212 // Job ID. 213 ID string `json:"job_id"` 214 }