github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcs/v1/lifecycle/Get.go (about)

     1  package lifecycle
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     6  	"github.com/opentelekomcloud/gophertelekomcloud/openstack/common/tags"
     7  )
     8  
     9  // Get a instance with detailed information by id
    10  func Get(client *golangsdk.ServiceClient, id string) (*Instance, error) {
    11  	raw, err := client.Get(client.ServiceURL("instances", id), nil, nil)
    12  	if err != nil {
    13  		return nil, err
    14  	}
    15  
    16  	var res Instance
    17  	err = extract.Into(raw.Body, &res)
    18  	return &res, err
    19  }
    20  
    21  type Instance struct {
    22  	// DCS instance name.
    23  	Name string `json:"name"`
    24  	// DCS instance engine.
    25  	Engine string `json:"engine"`
    26  	// DCS instance cache capacity. Unit: GB.
    27  	Capacity int `json:"capacity"`
    28  	// Cache capacity of a small-scale, single-node DCS instance.
    29  	CapacityMinor string `json:"capacity_minor"`
    30  	// IP address for connecting to the DCS instance For a cluster instance,
    31  	// multiple IP addresses are returned and separated by commas (,).
    32  	// For example, 192.168.0.1,192.168.0.2.
    33  	IP string `json:"ip"`
    34  	// Port number of the cache node.
    35  	Port int `json:"port"`
    36  	// Cache instance status.
    37  	Status string `json:"status"`
    38  	// true: This instance is a libos instance.
    39  	// false: This instance is not a libos instance.
    40  	Libos bool `json:"libos"`
    41  	// Brief description of the DCS instance.
    42  	Description string `json:"description"`
    43  	// Total memory size.
    44  	// Unit: MB.
    45  	MaxMemory int `json:"max_memory"`
    46  	// Size of the used memory.
    47  	// Unit: MB.
    48  	UsedMemory int `json:"used_memory"`
    49  	// DCS instance ID.
    50  	InstanceID string `json:"instance_id"`
    51  	// Resource specifications.
    52  	// For example:
    53  	// dcs.single_node: indicates a DCS instance in single-node mode.
    54  	// dcs.master_standby: indicates a DCS instance in master/standby mode.
    55  	// dcs.cluster: indicates a DCS instance in cluster mode.
    56  	ResourceSpecCode string `json:"resource_spec_code"`
    57  	// Cache engine version.
    58  	EngineVersion string `json:"engine_version"`
    59  	// Internal DCS version.
    60  	InternalVersion string `json:"internal_version"`
    61  	// Billing mode. 0: pay-per-use.
    62  	ChargingMode int `json:"charging_mode"`
    63  	// VPC ID.
    64  	VPCID string `json:"vpc_id"`
    65  	// VPC name.
    66  	VPCName string `json:"vpc_name"`
    67  	// Time at which the DCS instance is created.
    68  	// For example, 2017-03-31T12:24:46.297Z.
    69  	CreatedAt string `json:"created_at"`
    70  	// Error code returned when the DCS instance fails to be created or is abnormal.
    71  	ErrorCode string `json:"error_code"`
    72  	// User ID.
    73  	UserID string `json:"user_id"`
    74  	// Username.
    75  	UserName string `json:"user_name"`
    76  	// Time at which the maintenance time window starts.
    77  	// Format: hh:mm:ss.
    78  	MaintainBegin string `json:"maintain_begin"`
    79  	// Time at which the maintenance time window ends.
    80  	// Format: hh:mm:ss.
    81  	MaintainEnd string `json:"maintain_end"`
    82  	// An indicator of whether a DCS instance can be accessed in password-free mode.
    83  	// true: indicates that a DCS instance can be accessed without a password.
    84  	// false: indicates that a DCS instance can be accessed only after password authentication.
    85  	NoPasswordAccess string `json:"no_password_access"`
    86  	// Username used for accessing a DCS instance with password authentication.
    87  	AccessUser string `json:"access_user"`
    88  	// An indicator of whether public access is enabled for a DCS Redis instance. Options:
    89  	EnablePublicIp bool `json:"enable_publicip"`
    90  	// ID of the elastic IP address bound to a DCS Redis instance.
    91  	// The parameter value is null if public access is disabled.
    92  	PublicIpId string `json:"publicip_id"`
    93  	// Elastic IP address bound to a DCS Redis instance.
    94  	// The parameter value is null if public access is disabled.
    95  	PublicIpAddress string `json:"publicip_address"`
    96  	// An indicator of whether to enable SSL for public access to a DCS Redis instance.
    97  	EnableSsl bool `json:"enable_ssl"`
    98  	// An indicator of whether an upgrade task has been created for a DCS instance.
    99  	ServiceUpgrade bool `json:"service_upgrade"`
   100  	// Upgrade task ID.
   101  	// If the value of service_upgrade is set to true, the value of this parameter is the ID of the upgrade task.
   102  	// If the value of service_upgrade is set to false, the value of this parameter is empty.
   103  	ServiceTaskId string `json:"service_task_id"`
   104  	// Edition of DCS for Redis. Options:
   105  	// generic: standard edition
   106  	// libos: high-performance edition
   107  	ProductType string `json:"product_type"`
   108  	// CPU architecture. Options: x86_64 and aarch_64.
   109  	CpuType string `json:"cpu_type"`
   110  	// Memory type. Options: DRAM and SCM.
   111  	StorageType string `json:"storage_type"`
   112  	// DCS instance type. Options:
   113  	// single: single-node
   114  	// ha: master/standby
   115  	// cluster: Redis Cluster
   116  	// proxy: Proxy Cluster
   117  	CacheMode string `json:"cache_mode"`
   118  	// Time when the instance started running. 2022-07-06T09:32:16.502Z
   119  	LaunchedAt string `json:"launched_at"`
   120  	// AZ where a cache node resides. The value of this parameter in the response contains an AZ ID.
   121  	AvailableZones []string `json:"available_zones"`
   122  	// Subnet ID.
   123  	SubnetID string `json:"subnet_id"`
   124  	// Security group ID.
   125  	SecurityGroupID string `json:"security_group_id"`
   126  	// Backend address of a cluster instance.
   127  	BackendAddrs string `json:"backend_addrs"`
   128  	// Cloud service type code.
   129  	CloudServiceTypeCode string `json:"cloud_service_type_code"`
   130  	// Cloud resource type code.
   131  	CloudResourceTypeCode string `json:"cloud_resource_type_code"`
   132  	// Security group name.
   133  	SecurityGroupName string `json:"security_group_name"`
   134  	// Subnet name.
   135  	SubnetName string `json:"subnet_name"`
   136  	// Subnet segment.
   137  	SubnetCIDR string `json:"subnet_cidr"`
   138  	// Order ID.
   139  	OrderID string `json:"order_id"`
   140  	// Backup policy.
   141  	// This parameter is available for master/standby and cluster DCS instances.
   142  	InstanceBackupPolicy BackupPolicy `json:"instance_backup_policy"`
   143  	// Instance tag key and value.
   144  	Tags []tags.ResourceTag `json:"tags"`
   145  	// Product specification code.
   146  	SpecCode string `json:"spec_code"`
   147  	// Domain name of the instance.
   148  	DomainName string `json:"domain_name"`
   149  	// Read-only domain name.
   150  	ReadonlyDomainName string `json:"readonly_domain_name"`
   151  	// Scenario where the instance is frozen.
   152  	FreezeScene string `json:"freeze_scene"`
   153  	// Update time. 2022-07-06T09:32:16.502Z
   154  	UpdateAt string `json:"update_at"`
   155  	// Task status.
   156  	TaskStatus string `json:"task_status"`
   157  	// Whether the instance is free of charge.
   158  	IsFree bool `json:"is_free"`
   159  	// AZs with available resources.
   160  	AzCodes []string `json:"az_codes"`
   161  	// Role in cross-region DR.
   162  	CrrRole string `json:"crr_role"`
   163  	// Product specification code.
   164  	InQuerySpecCode string `json:"inquery_spec_code"`
   165  	// Whether slow query logs are supported.
   166  	SupportSlowLogFlag string `json:"support_slow_log_flag"`
   167  	// IPv6 address.
   168  	Ipv6 string `json:"ipv6"`
   169  	// Whether IPv6 is enabled.
   170  	EnableIpv6 bool `json:"enable_ipv6"`
   171  	// Number of databases in the instance.
   172  	DbNumber int `json:"db_number"`
   173  	// Whether ACL is supported.
   174  	SupportAcl bool `json:"support_acl"`
   175  	// Task response.
   176  	Task string `json:"task"`
   177  	// Number of shards.
   178  	ShardingCount int `json:"sharding_count"`
   179  }
   180  
   181  type BackupPolicy struct {
   182  	BackupPolicyId string               `json:"backup_policy_id"`
   183  	CreatedAt      string               `json:"created_at"`
   184  	UpdatedAt      string               `json:"updated_at"`
   185  	Policy         InstanceBackupPolicy `json:"policy"`
   186  	TenantId       string               `json:"tenant_id"`
   187  }