github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/autoscaling/v1/configurations/get.go (about)

     1  package configurations
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  )
     7  
     8  func Get(client *golangsdk.ServiceClient, id string) (*Configuration, error) {
     9  	raw, err := client.Get(client.ServiceURL("scaling_configuration", id), nil, nil)
    10  	if err != nil {
    11  		return nil, err
    12  	}
    13  
    14  	var res Configuration
    15  	err = extract.IntoStructPtr(raw.Body, &res, "scaling_configuration")
    16  	return &res, err
    17  }
    18  
    19  type Configuration struct {
    20  	// Specifies the AS configuration ID. This parameter is globally unique.
    21  	ID string `json:"scaling_configuration_id"`
    22  	// Specifies the tenant ID.
    23  	Tenant string `json:"tenant"`
    24  	// Specifies the AS configuration name.
    25  	// Supports fuzzy search.
    26  	Name string `json:"scaling_configuration_name"`
    27  	// Specifies the information about instance configurations.
    28  	InstanceConfig InstanceConfig `json:"instance_config"`
    29  	// Specifies the time when AS configurations are created. The time format complies with UTC.
    30  	CreateTime string `json:"create_time"`
    31  	// Specifies the ID of the AS group to which the AS configuration is bound.
    32  	ScalingGroupId string `json:"scaling_group_id,omitempty"`
    33  }
    34  
    35  type InstanceConfig struct {
    36  	// Specifies the ECS flavor ID.
    37  	FlavorRef string `json:"flavorRef"`
    38  	// Specifies the image ID. It is same as image_id.
    39  	ImageRef string `json:"imageRef"`
    40  	// Specifies the disk group information.
    41  	Disk []Disk `json:"disk"`
    42  	// Specifies the name of the SSH key pair used to log in to the ECS.
    43  	SSHKey string `json:"key_name"`
    44  	// Specifies the fingerprint of the SSH key pair used to log in to the ECS.
    45  	KeyFingerprint string `json:"key_fingerprint"`
    46  	// This parameter is reserved.
    47  	InstanceName string `json:"instance_name"`
    48  	// This parameter is reserved.
    49  	InstanceID string `json:"instance_id"`
    50  	// This parameter is reserved.
    51  	AdminPass string `json:"adminPass"`
    52  	// Specifies information about the injected file.
    53  	Personality []Personality `json:"personality"`
    54  	// Specifies the EIP of the ECS.
    55  	PublicIp PublicIp `json:"public_ip"`
    56  	// Specifies the Cloud-Init user data, which is encoded using Base64.
    57  	UserData string `json:"user_data"`
    58  	// Specifies the ECS metadata.
    59  	Metadata AdminPassMetadata `json:"metadata"`
    60  	// Specifies the security group information.
    61  	SecurityGroups []SecurityGroup `json:"security_groups"`
    62  	// This parameter is reserved.
    63  	ServerGroupID string `json:"server_group_id"`
    64  	// This parameter is reserved.
    65  	Tenancy string `json:"tenancy"`
    66  	// This parameter is reserved.
    67  	DedicatedHostID string `json:"dedicated_host_id"`
    68  	// This parameter is reserved.
    69  	MarketType string `json:"market_type"`
    70  	// This parameter is reserved.
    71  	MultiFlavorPriorityPolicy string `json:"multi_flavor_priority_policy"`
    72  }
    73  
    74  type Disk struct {
    75  	// Specifies the disk size. The unit is GB.
    76  	// The system disk size ranges from 1 to 1024 and must be greater than or equal to the
    77  	// minimum size (min_disk value) of the system disk specified in the image.
    78  	// The data disk size ranges from 10 to 32768.
    79  	Size int `json:"size"`
    80  	// Specifies the ECS system disk type. The disk type must match the available disk type.
    81  	// SATA: common I/O disk type
    82  	// SAS: high I/O disk type
    83  	// SSD: ultra-high I/O disk type
    84  	// co-p1: high I/O (performance-optimized I) disk type
    85  	// uh-l1: ultra-high I/O (latency-optimized) disk type
    86  	// If the specified disk type is not available in the AZ, the disk will fail to create.
    87  	// NOTE:
    88  	// For HANA, HL1, and HL2 ECSs, use co-p1 and uh-l1 disks. For other ECSs, do not use co-p1 or uh-l1 disks.
    89  	VolumeType string `json:"volume_type"`
    90  	// Specifies the ECS system disk type. The disk type must match the available disk type.
    91  	// SATA: common I/O disk type
    92  	// SAS: high I/O disk type
    93  	// SSD: ultra-high I/O disk type
    94  	// co-p1: high I/O (performance-optimized I) disk type
    95  	// uh-l1: ultra-high I/O (latency-optimized) disk type
    96  	// If the specified disk type is not available in the AZ, the disk will fail to create.
    97  	// NOTE:
    98  	// For HANA, HL1, and HL2 ECSs, use co-p1 and uh-l1 disks. For other ECSs, do not use co-p1 or uh-l1 disks.
    99  	DiskType string `json:"disk_type"`
   100  	// Specifies a DSS device ID for creating an ECS disk.
   101  	// NOTE:
   102  	// Specify DSS devices for all disks in an AS configuration or not. If DSS devices are specified,
   103  	// all the data stores must belong to the same AZ, and the disk types supported by a DSS device for a disk
   104  	// must be the same as the volume_type value.
   105  	DedicatedStorageID string `json:"dedicated_storage_id"`
   106  	// Specifies the ID of a data disk image used to export data disks of an ECS.
   107  	DataDiskImageID string `json:"data_disk_image_id"`
   108  	// Specifies the disk backup snapshot ID for restoring the system disk
   109  	// and data disks using a full-ECS backup when a full-ECS image is used.
   110  	// NOTE:
   111  	// Each disk in an AS configuration must correspond to a disk backup in the full-ECS backup by snapshot_id.
   112  	SnapshotID string `json:"snapshot_id"`
   113  	// Specifies the metadata for creating disks.
   114  	Metadata map[string]interface{} `json:"metadata"`
   115  }
   116  
   117  type Personality struct {
   118  	// Specifies the path of the injected file.
   119  	// For Linux OSs, specify the path, for example, /etc/foo.txt, for storing the injected file.
   120  	// For Windows, the injected file is automatically stored in the root directory of drive C.
   121  	// You only need to specify the file name, for example, foo. The file name contains only letters and digits.
   122  	Path string `json:"path"`
   123  	// Specifies the content of the injected file.
   124  	// The value must be the information after the content of the injected file is encoded using Base64.
   125  	Content string `json:"content"`
   126  }
   127  
   128  type PublicIp struct {
   129  	// Specifies the EIP automatically assigned to the ECS.
   130  	Eip Eip `json:"eip,omitempty"`
   131  }
   132  
   133  type Eip struct {
   134  	// Specifies the EIP type.
   135  	// Enumerated value of the IP address type: 5_bgp (indicates dynamic BGP)
   136  	Type string `json:"ip_type"`
   137  	// Specifies the bandwidth of an IP address.
   138  	Bandwidth Bandwidth `json:"bandwidth"`
   139  }
   140  
   141  type Bandwidth struct {
   142  	// Specifies the bandwidth (Mbit/s). The value range is 1 to 500.
   143  	// NOTE:
   144  	// The specific range may vary depending on the configuration in each region.
   145  	// You can see the bandwidth range of each region on the management console.
   146  	// The minimum unit for bandwidth varies depending on the bandwidth range.
   147  	// The minimum unit is 1 Mbit/s if the allowed bandwidth size ranges from 0 to 300 Mbit/s (with 300 Mbit/s included).
   148  	// The minimum unit is 50 Mbit/s if the allowed bandwidth size ranges 300 Mbit/s to 500 Mbit/s (with 500 Mbit/s included).
   149  	Size int `json:"size"`
   150  	// Specifies the bandwidth sharing type.
   151  	// Enumerated values of the sharing type:
   152  	// PER: dedicated
   153  	// Only dedicated bandwidth is available.
   154  	ShareType string `json:"share_type"`
   155  	// Specifies the bandwidth billing mode.
   156  	// traffic: billed by traffic.
   157  	// If the parameter value is out of the preceding options, creating the ECS will fail.
   158  	ChargingMode string `json:"charging_mode"`
   159  }
   160  
   161  type SecurityGroup struct {
   162  	// Specifies the ID of the security group.
   163  	ID string `json:"id"`
   164  }