github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/iec/v1/common/common.go (about)

     1  package common
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  // Operator 运营商
     8  type Operator struct {
     9  	// 运营商的唯一uuid
    10  	ID string `json:"id"`
    11  
    12  	// 运营商的名称
    13  	Name string `json:"name,omitempty"`
    14  
    15  	// 运营商的国际化名称
    16  	I18nName string `json:"i18n_name,omitempty"`
    17  
    18  	// 运营商的简写
    19  	Sa string `json:"sa"`
    20  }
    21  
    22  type PublicIP struct {
    23  	// Specifies the ID of the elastic IP address, which uniquely
    24  	// identifies the elastic IP address.
    25  	ID string `json:"id"`
    26  
    27  	// Specifies the status of the elastic IP address.
    28  	Status string `json:"status"`
    29  
    30  	// Specifies the obtained elastic IP address.
    31  	PublicIpAddress string `json:"public_ip_address"`
    32  
    33  	// Value range: 4, 6, respectively, to create ipv4 and ipv6, when not created ipv4 by default
    34  	IPVersion int `json:"ip_version"`
    35  
    36  	// Specifies the private IP address bound to the elastic IP
    37  	// address.
    38  	PrivateIpAddress string `json:"private_ip_address"`
    39  
    40  	// Specifies the port ID.
    41  	PortID string `json:"port_id"`
    42  
    43  	// Specifies the time for applying for the elastic IP address.
    44  	CreateTime string `json:"create_time"`
    45  
    46  	// Specifies the bandwidth ID of the elastic IP address.
    47  	BandwidthID string `json:"bandwidth_id"`
    48  
    49  	// Specifies the bandwidth size.
    50  	BandwidthSize int `json:"bandwidth_size"`
    51  
    52  	// Specifies whether the bandwidth is shared or exclusive.
    53  	BandwidthShareType string `json:"bandwidth_share_type"`
    54  
    55  	// Specifies the bandwidth name.
    56  	BandwidthName string `json:"bandwidth_name"`
    57  
    58  	//Operator information
    59  	Operator Operator `json:"operator"`
    60  
    61  	// Specifies the Siteid.
    62  	SiteID string `json:"site_id"`
    63  
    64  	// SiteInfo
    65  	SiteInfo string `json:"site_info"`
    66  
    67  	Region string `json:"region,omitempty"`
    68  
    69  	Type string `json:"type,omitempty"`
    70  }
    71  
    72  // GeoLocation 地理位置
    73  type GeoLocation struct {
    74  	// ID 标志
    75  	ID string `json:"id"`
    76  
    77  	// City 城市
    78  	City string `json:"city,omitempty"`
    79  
    80  	// I18nCity 城市的国家化名称
    81  	I18nCity string `json:"i18n_city,omitempty"`
    82  
    83  	// Province 省份
    84  	Province string `json:"province,omitempty"`
    85  
    86  	// I18nProvince 省份的国际化名称
    87  	I18nProvince string `json:"i18n_province,omitempty"`
    88  
    89  	// Area 区域
    90  	Area string `json:"area,omitempty"`
    91  
    92  	// I18nArea 区域国际化名称
    93  	I18nArea string `json:"i18n_area,omitempty"`
    94  
    95  	// Country 国家
    96  	Country string `json:"country"`
    97  
    98  	// I18nCountry 国家的国际化名称
    99  	I18nCountry string `json:"i18n_country,omitempty"`
   100  }
   101  
   102  // Subnet represents a subnet. See package documentation for a top-level
   103  // description of what this is.
   104  type Subnet struct {
   105  	// Specifies a resource ID in UUID format.
   106  	ID string `json:"id"`
   107  
   108  	// Specifies the subnet name. The value is a string of 1 to 64
   109  	// characters that can contain letters, digits, underscores (_), and hyphens (-).
   110  	Name string `json:"name"`
   111  
   112  	// Specifies the network segment on which the subnet resides. The
   113  	// value must be in CIDR format. The value must be within the CIDR block of the VPC. The
   114  	// subnet mask cannot be greater than 28.
   115  	Cidr string `json:"cidr"`
   116  
   117  	// Specifies the gateway of the subnet. The value must be a valid
   118  	// IP address. The value must be an IP address in the subnet segment.
   119  	GatewayIP string `json:"gateway_ip"`
   120  
   121  	// Specifies whether the DHCP function is enabled for the subnet.
   122  	// The value can be true or false. If this parameter is left blank, it is set to true by
   123  	// default.
   124  	DhcpEnable bool `json:"dhcp_enable,omitempty"`
   125  
   126  	// Specifies the IP address of DNS server 1 on the subnet. The
   127  	// value must be a valid IP address.
   128  	PrimaryDNS string `json:"primary_dns,omitempty"`
   129  
   130  	// Specifies the IP address of DNS server 2 on the subnet. The
   131  	// value must be a valid IP address.
   132  	SecondaryDNS string `json:"secondary_dns,omitempty"`
   133  
   134  	// Specifies the DNS server address list of a subnet. This field
   135  	// is required if you need to use more than two DNS servers. This parameter value is the
   136  	// superset of both DNS server address 1 and DNS server address 2.
   137  	DNSList []string `json:"dnsList,omitempty"`
   138  
   139  	// Specifies the ID of the VPC to which the subnet belongs.
   140  	VpcID string `json:"vpc_id"`
   141  
   142  	// Specifies the status of the subnet. The value can be ACTIVE,
   143  	// DOWN, UNKNOWN, or ERROR.
   144  	Status string `json:"status"`
   145  
   146  	// Specifies the network (Native OpenStack API) ID.
   147  	NeutronNetworkID string `json:"neutron_network_id"`
   148  
   149  	// Specifies the subnet (Native OpenStack API) ID.
   150  	NeutronSubnetID string `json:"neutron_subnet_id"`
   151  
   152  	// SiteID
   153  	SiteID string `json:"site_id,omitempty"`
   154  
   155  	// SiteInfo
   156  	SiteInfo string `json:"site_info,omitempty"`
   157  }
   158  
   159  type VPC struct {
   160  	// Specifies a resource ID in UUID format.
   161  	ID string `json:"id"`
   162  
   163  	// Specifies the name of the VPC. The name must be unique for a
   164  	// tenant. The value is a string of no more than 64 characters and can contain digits,
   165  	// letters, underscores (_), and hyphens (-).
   166  	Name string `json:"name,omitempty"`
   167  
   168  	// Specifies the range of available subnets in the VPC. The value
   169  	// must be in CIDR format, for example, 192.168.0.0/16. The value ranges from 10.0.0.0/8
   170  	// to 10.255.255.0/24, 172.16.0.0/12 to 172.31.255.0/24, or 192.168.0.0/16 to
   171  	// 192.168.255.0/24.
   172  	Cidr string `json:"cidr,omitempty"`
   173  
   174  	// SubnetNum
   175  	SubnetNum int64 `json:"subnet_num"`
   176  
   177  	Mode string `json:"mode,omitempty"`
   178  }
   179  
   180  // SiteAttribute 站点扩展属性
   181  type SiteAttribute struct {
   182  	// 站点属性的唯一uuid
   183  	ID string `json:"id"`
   184  
   185  	// 站点相对应的属性的key
   186  	Key string `json:"site_attr"`
   187  
   188  	// 站点相对应属性的value
   189  	Value string `json:"site_attr_value"`
   190  }
   191  
   192  // SiteBase 站点的基本信息
   193  type SiteBase struct {
   194  	// 站点所在的城市
   195  	City string `json:"city,omitempty"`
   196  
   197  	// 城市的国家化名称
   198  	I18nCity string `json:"i18n_city,omitempty"`
   199  
   200  	// 站点所在的省份
   201  	Province string `json:"province,omitempty"`
   202  
   203  	// 省份的国际化名称
   204  	I18nProvince string `json:"i18n_province,omitempty"`
   205  
   206  	// 站点所在的区域
   207  	Area string `json:"area,omitempty"`
   208  
   209  	// 区域国际化名称
   210  	I18nArea string `json:"i18n_area,omitempty"`
   211  
   212  	// 站点所在的国家
   213  	Country string `json:"country,omitempty"`
   214  
   215  	// 国家的国际化名称
   216  	I18nCountry string `json:"i18n_country,omitempty"`
   217  
   218  	Operator *Operator `json:"operator,omitempty"`
   219  }
   220  
   221  // Site 站点信息
   222  type Site struct {
   223  	// 站点的唯一uuid
   224  	ID string `json:"id"`
   225  
   226  	// 站点的名称,最好按照一定的规则命名,比如:IEG-国家-区域-省-市-运营商
   227  	Name string `json:"name"`
   228  
   229  	SiteBase
   230  
   231  	//站点的状态,
   232  	Status string `json:"status"`
   233  
   234  	// CityShortName 城市名称缩写
   235  	CityShortName string `json:"city_short_name"`
   236  
   237  	// EipPools
   238  	EipPools []EipPool `json:"pools,omitempty"`
   239  }
   240  
   241  // EipPool eip池返回体内容
   242  type EipPool struct {
   243  	// ID EIP池的唯一uuid
   244  	ID string `json:"id"`
   245  
   246  	// SiteID 站点ID
   247  	SiteID string `json:"site_id"`
   248  
   249  	// DisplayName EIP池展示名
   250  	DisplayName string `json:"display_name"`
   251  
   252  	// OperatorID 运营商ID
   253  	OperatorID *Operator `json:"operator"`
   254  
   255  	// PoolID EIP 池标识,从neutron获取
   256  	PoolID string `json:"pool_id"`
   257  
   258  	// IPVersion IPv4:IPv4池 IPv6:IPv6池
   259  	IPVersion string `json:"ip_version"`
   260  }
   261  
   262  type Port struct {
   263  	// Specifies the port ID, which uniquely identifies the port.
   264  	ID string `json:"id"`
   265  
   266  	// Specifies the port name. The value can contain no more than 255
   267  	// characters. This parameter is left blank by default.
   268  	Name string `json:"name"`
   269  
   270  	// Specifies the ID of the network to which the port belongs. The
   271  	// network ID must be a real one in the network environment.
   272  	NetworkID string `json:"network_id"`
   273  
   274  	// Specifies the administrative state of the port. The value can
   275  	// only be?true, and the default value is?true.
   276  	AdminStateUp bool `json:"admin_state_up"`
   277  
   278  	// Specifies the port MAC address. The system automatically sets
   279  	// this parameter, and you are not allowed to configure the parameter value.
   280  	MacAddress string `json:"mac_address"`
   281  
   282  	// Specifies the port IP address. A port supports only one fixed
   283  	// IP address that cannot be changed.
   284  	FixedIPs []FixedIp `json:"fixed_ips"`
   285  
   286  	// Specifies the ID of the device to which the port belongs. The
   287  	// system automatically sets this parameter, and you are not allowed to configure or
   288  	// change the parameter value.
   289  	DeviceID string `json:"device_id"`
   290  
   291  	// Specifies the belonged device, which can be the DHCP server,
   292  	// router, load balancers, or Nova. The system automatically sets this parameter, and
   293  	// you are not allowed to configure or change the parameter value.
   294  	DeviceOwner string `json:"device_owner"`
   295  
   296  	// Specifies the status of the port. The value can
   297  	// be?ACTIVE,?BUILD, or?DOWN.
   298  	Status string `json:"status"`
   299  
   300  	// Specifies the UUID of the security group. This attribute is
   301  	// extended.
   302  	SecurityGroups []string `json:"security_groups"`
   303  
   304  	// 1. Specifies a set of zero or more allowed address pairs. An
   305  	// address pair consists of an IP address and MAC address. This attribute is extended.
   306  	// For details, see parameter?allow_address_pair. 2. The IP address cannot be?0.0.0.0.
   307  	// 3. Configure an independent security group for the port if a large CIDR block (subnet
   308  	// mask less than 24) is configured for parameter?allowed_address_pairs.
   309  	AllowedAddressPairs []AllowedAddressPair `json:"allowed_address_pairs"`
   310  
   311  	// Specifies a set of zero or more extra DHCP option pairs. An
   312  	// option pair consists of an option value and name. This attribute is extended.
   313  	ExtraDhcpOpts []ExtraDHCPOpt `json:"extra_dhcp_opts"`
   314  
   315  	// Specifies the type of the bound vNIC. The value can
   316  	// be?normal?or?direct. Parameter?normal?indicates software switching.
   317  	// Parameter?direct?indicates SR-IOV PCIe passthrough, which is not supported.
   318  	BindingvnicType string `json:"binding:vnic_type"`
   319  
   320  	// Default private domain name of the main NIC
   321  	DnsAssignment []DnsAssignment `json:"dns_assignment"`
   322  
   323  	// Default private DNS name of the main NIC
   324  	DnsName string `json:"dns_name"`
   325  
   326  	// site id
   327  	SiteID string `json:"site_id"`
   328  }
   329  
   330  type FixedIp struct {
   331  	// Specifies the subnet ID. You cannot change the parameter
   332  	// value.
   333  	SubnetId string `json:"subnet_id,omitempty"`
   334  
   335  	// Specifies the port IP address. You cannot change the parameter
   336  	// value.
   337  	IpAddress string `json:"ip_address,omitempty"`
   338  }
   339  
   340  type DnsAssignment struct {
   341  	// 功能说明:fqdn
   342  	Fqdn string `json:"fqdn,omitempty"`
   343  
   344  	// 功能说明:hostname
   345  	HostName string `json:"hostname,omitempty"`
   346  
   347  	// 功能说明:ip_address
   348  	IpAddress string `json:"ip_address,omitempty"`
   349  }
   350  
   351  type ExtraDHCPOpt struct {
   352  	// 功能说明:Option名称
   353  	OptName string `json:"opt_name,omitempty"`
   354  
   355  	// 功能说明:Option值
   356  	OptValue string `json:"opt_value,omitempty"`
   357  }
   358  
   359  type AllowedAddressPair struct {
   360  	// Specifies the IP address. You cannot set it to 0.0.0.0.
   361  	// Configure an independent security group for the port if a large CIDR block (subnet
   362  	// mask less than 24) is configured for parameter allowed_address_pairs.
   363  	IpAddress string `json:"ip_address,omitempty"`
   364  
   365  	// Specifies the MAC address.
   366  	MacAddress string `json:"mac_address,omitempty"`
   367  }
   368  
   369  type Bandwidth struct {
   370  	// Specifies the bandwidth ID, which uniquely identifies the
   371  	// bandwidth.
   372  	ID string `json:"id"`
   373  
   374  	// Specifies the bandwidth name. The value is a string of 1 to 64
   375  	// characters that can contain letters, digits, underscores (_), and hyphens (-).
   376  	Name string `json:"name"`
   377  
   378  	// Specifies the bandwidth size. The value ranges from 1 Mbit/s to
   379  	// 300 Mbit/s.
   380  	Size int `json:"size"`
   381  
   382  	// Specifies whether the bandwidth is shared or exclusive. The
   383  	// value can be PER or WHOLE.
   384  	ShareType string `json:"share_type"`
   385  
   386  	// Specifies the elastic IP address of the bandwidth.  The
   387  	// bandwidth, whose type is set to WHOLE, supports up to 20 elastic IP addresses. The
   388  	// bandwidth, whose type is set to PER, supports only one elastic IP address.
   389  	PublicipInfo []PublicIpinfo `json:"publicip_info"`
   390  
   391  	// Specifies the bandwidth type.
   392  	BandwidthType string `json:"bandwidth_type"`
   393  
   394  	// Specifies the charging mode (by traffic or by bandwidth).
   395  	ChargeMode string `json:"charge_mode"`
   396  
   397  	// Specifies the status of bandwidth
   398  	Status string `json:"status"`
   399  
   400  	SiteID string `json:"site_id,omitempty"`
   401  
   402  	CreateTime time.Time `json:"create_time,omitempty"`
   403  
   404  	UpdateTime time.Time `json:"update_time,omitempty"`
   405  
   406  	SiteInfo string `json:"site_info,omitempty"`
   407  
   408  	Operator Operator `json:"operator,omitempty"`
   409  
   410  	PoolID string `json:"pool_id,omitempty"`
   411  }
   412  
   413  type PublicIpinfo struct {
   414  	// Specifies the tenant ID of the user.
   415  	PublicipId string `json:"publicip_id"`
   416  
   417  	// Specifies the elastic IP address.
   418  	PublicipAddress string `json:"publicip_address"`
   419  
   420  	// Specifies the elastic IP version.
   421  	IPVersion int `json:"ip_version"`
   422  
   423  	// Specifies the elastic IP address type. The value can be
   424  	// 5_telcom, 5_union, or 5_bgp.
   425  	PublicipType string `json:"publicip_type"`
   426  }
   427  
   428  // Volume contains all the information associated with an OpenStack Volume.
   429  type Volume struct {
   430  	// Unique identifier for the volume.
   431  	ID string `json:"id"`
   432  	// Current status of the volume.
   433  	Status string `json:"status"`
   434  	// Size of the volume in GB.
   435  	Size int `json:"size"`
   436  	// AvailabilityZone is which availability zone the volume is in.
   437  	AvailabilityZone string `json:"availability_zone"`
   438  	// The date when this volume was created.
   439  	CreatedAt time.Time `json:"-"`
   440  	// The date when this volume was last updated
   441  	UpdatedAt time.Time `json:"-"`
   442  	// Instances onto which the volume is attached.
   443  	Attachments []Attachment `json:"attachments"`
   444  	// Human-readable display name for the volume.
   445  	Name string `json:"name"`
   446  	// Human-readable description for the volume.
   447  	Description string `json:"description"`
   448  	// The type of volume to create, either SATA or SSD.
   449  	VolumeType string `json:"volume_type"`
   450  	// The ID of the snapshot from which the volume was created
   451  	SnapshotID string `json:"snapshot_id"`
   452  	// The ID of another block storage volume from which the current volume was created
   453  	SourceVolID string `json:"source_volid"`
   454  	// Arbitrary key-value pairs defined by the user.
   455  	Metadata map[string]string `json:"metadata"`
   456  	// UserID is the id of the user who created the volume.
   457  	UserID string `json:"user_id"`
   458  	// Indicates whether this is a bootable volume.
   459  	Bootable string `json:"bootable"`
   460  	// Encrypted denotes if the volume is encrypted.
   461  	Encrypted bool `json:"encrypted"`
   462  	// ReplicationStatus is the status of replication.
   463  	ReplicationStatus string `json:"replication_status"`
   464  	// ConsistencyGroupID is the consistency group ID.
   465  	ConsistencyGroupID string `json:"consistencygroup_id"`
   466  	// Multiattach denotes if the volume is multi-attach capable.
   467  	Multiattach bool `json:"multiattach"`
   468  
   469  	//Cloud hard disk uri self-description information.
   470  	Links []map[string]string `json:"links"`
   471  
   472  	//Whether it is a shared cloud drive.
   473  	//Shareable bool `json:"shareable"`
   474  	//Volume image metadata
   475  	VolumeImageMetadata map[string]string `json:"volume_image_metadata"`
   476  
   477  	//The tenant ID to which the cloud drive belongs.
   478  	TenantAttr string `json:"os-vol-tenant-attr:tenant_id"`
   479  
   480  	//The host name to which the cloud drive belongs.
   481  	HostAttr string `json:"os-vol-host-attr:host"`
   482  	//Reserved attribute
   483  	RepAttrDriverData string `json:"os-volume-replication:driver_data"`
   484  	//Reserved attribute
   485  	RepAttrExtendedStatus string `json:"os-volume-replication:extended_status"`
   486  	//Reserved attribute
   487  	MigAttrStat string `json:"os-vol-mig-status-attr:migstat"`
   488  	//Reserved attribute
   489  	MigAttrNameID string `json:"os-vol-mig-status-attr:name_id"`
   490  }
   491  
   492  type Attachment struct {
   493  	AttachedAt   time.Time `json:"-"`
   494  	AttachmentID string    `json:"attachment_id"`
   495  	Device       string    `json:"device"`
   496  	HostName     string    `json:"host_name"`
   497  	ID           string    `json:"id"`
   498  	ServerID     string    `json:"server_id"`
   499  	VolumeID     string    `json:"volume_id"`
   500  }
   501  
   502  // VolumeType 卷类型
   503  type VolumeType struct {
   504  	// Unique identifier for the volume type.
   505  	ID string `json:"id"`
   506  	// Human-readable display name for the volume type.
   507  	Name string `json:"name"`
   508  }
   509  
   510  type Flavor struct {
   511  	// Specifies the ID of ECS specifications.
   512  	ID string `json:"id"`
   513  
   514  	// Specifies the name of the ECS specifications.
   515  	Name string `json:"name"`
   516  
   517  	// Specifies the number of CPU cores in the ECS specifications.
   518  	Vcpus string `json:"vcpus"`
   519  
   520  	// Specifies the memory size (MB) in the ECS specifications.
   521  	Ram int64 `json:"ram"`
   522  
   523  	// Specifies the system disk size in the ECS specifications.
   524  	// The value 0 indicates that the disk size is not limited.
   525  	Disk string `json:"disk"`
   526  
   527  	// Specifies shortcut links for ECS flavors.
   528  	Links []Link `json:"links"`
   529  
   530  	// Specifies extended ECS specifications.
   531  	OsExtraSpecs OsExtraSpecs `json:"os_extra_specs"`
   532  
   533  	// Reserved
   534  	Swap string `json:"swap"`
   535  
   536  	// Reserved
   537  	FlvEphemeral int64 `json:"OS-FLV-EXT-DATA:ephemeral"`
   538  
   539  	// Reserved
   540  	FlvDisabled bool `json:"OS-FLV-DISABLED:disabled"`
   541  
   542  	// Reserved
   543  	RxtxFactor int64 `json:"rxtx_factor"`
   544  
   545  	// Reserved
   546  	RxtxQuota string `json:"rxtx_quota"`
   547  
   548  	// Reserved
   549  	RxtxCap string `json:"rxtx_cap"`
   550  
   551  	// Reserved
   552  	AccessIsPublic bool `json:"os-flavor-access:is_public"`
   553  }
   554  
   555  type Link struct {
   556  	// Specifies the shortcut link marker name.
   557  	Rel string `json:"rel"`
   558  
   559  	// Provides the corresponding shortcut link.
   560  	Href string `json:"href"`
   561  
   562  	// Specifies the shortcut link type.
   563  	Type string `json:"type"`
   564  }
   565  
   566  type OsExtraSpecs struct {
   567  	// Specifies the ECS specifications types
   568  	PerformanceType string `json:"ecs:performancetype"`
   569  
   570  	// Specifies the resource type.
   571  	ResourceType string `json:"resource_type"`
   572  
   573  	// Specifies the generation of an ECS type
   574  	Generation string `json:"ecs:generation"`
   575  
   576  	// Specifies a virtualization type
   577  	VirtualizationEnvTypes string `json:"ecs:virtualization_env_types"`
   578  
   579  	// Indicates whether the GPU is passthrough.
   580  	PciPassthroughEnableGpu string `json:"pci_passthrough:enable_gpu"`
   581  
   582  	// Indicates the technology used on the G1 and G2 ECSs,
   583  	// including GPU virtualization and GPU passthrough.
   584  	PciPassthroughGpuSpecs string `json:"pci_passthrough:gpu_specs"`
   585  
   586  	// Indicates the model and quantity of passthrough-enabled GPUs on P1 ECSs.
   587  	PciPassthroughAlias string `json:"pci_passthrough:alias"`
   588  
   589  	// gpu info.wuzilin add
   590  	InfoGPUName string `json:"info:gpu:name,omitempty"`
   591  
   592  	// cpu
   593  	InfoCpuName string `json:"info:cpu:name,omitempty"`
   594  
   595  	CondOperationStatus string `json:"cond:operation:status"`
   596  
   597  	CondOperationAz string `json:"cond:operation:az"`
   598  
   599  	CondCompute string `json:"cond:compute"`
   600  
   601  	CondImage string `json:"cond:image"`
   602  
   603  	VifMaxNum string `json:"quota:vif_max_num"`
   604  
   605  	PhysicsMaxRate string `json:"quota:physics_max_rate"`
   606  
   607  	VifMultiqueueNum string `json:"quota:vif_multiqueue_num"`
   608  
   609  	MinRate string `json:"quota:min_rate"`
   610  
   611  	MaxRate string `json:"quota:max_rate"`
   612  
   613  	MaxPps string `json:"quota:max_pps"`
   614  
   615  	CPUSockets string `json:"hw:cpu_sockets"`
   616  
   617  	NumaNodes string `json:"hw:numa_nodes"`
   618  
   619  	CPUThreads string `json:"hw:cpu_threads"`
   620  
   621  	MemPageSize string `json:"hw:mem_page_size"`
   622  
   623  	ConnLimitTotal string `json:"quota:conn_limit_total"`
   624  
   625  	CPUCores string `json:"hw:cpu_cores"`
   626  
   627  	SpotExtraSpecs
   628  }
   629  
   630  // SpotExtraSpecs 增加spot属性
   631  type SpotExtraSpecs struct {
   632  	CondSpotBlockOperationAz     string `json:"cond:spot_block:operation:az"`
   633  	CondSpotBlockLdh             string `json:"cond:spot_block:operation:longest_duration_hours"`
   634  	CondSpotBlockLdc             string `json:"cond:spot_block:operation:longest_duration_count"`
   635  	CondSpotBlockInterruptPolicy string `json:"cond:spot_block:operation:interrupt_policy"`
   636  	CondSpotOperationAz          string `json:"cond:spot:operation:az"`
   637  	CondSpotOperationStatus      string `json:"cond:spot:operation:status"`
   638  }
   639  
   640  // EdgeImageInfo 边缘镜像基本字段
   641  type EdgeImageInfo struct {
   642  	ID                    string `json:"id"`
   643  	Name                  string `json:"name"`
   644  	Status                string `json:"status"`
   645  	DiskFormat            string `json:"disk_format"`
   646  	MinDiskGigabytes      int    `json:"min_disk"`
   647  	MinRAMMegabytes       int    `json:"min_ram"`
   648  	Owner                 string `json:"owner"`
   649  	Protected             bool   `json:"protected"`
   650  	Visibility            string `json:"visibility"`
   651  	CreatedAt             string `json:"created_at"`
   652  	UpdatedAt             string `json:"updated_at"`
   653  	Self                  string `json:"self"`
   654  	Deleted               bool   `json:"deleted"`
   655  	VirtualEnvType        string `json:"virtual_env_type"`
   656  	DeletedAt             string `json:"deleted_at"`
   657  	RelatedJobID          string `json:"related_job_id"`
   658  	ImageType             string `json:"__imagetype"`
   659  	Platform              string `json:"__platform"`
   660  	OsType                string `json:"__os_type"`
   661  	OsVersion             string `json:"__os_version"`
   662  	IsRegistered          bool   `json:"__isregistered"`
   663  	SupportKvm            string `json:"__support_kvm,omitempty"`
   664  	SupportKvmGpuType     string `json:"__support_kvm_gpu_type,omitempty"`
   665  	SupportKvmAscend310   string `json:"__support_kvm_ascend_310,omitempty"`
   666  	SupportKvmHi1822Hiovs string `json:"__support_kvm_hi1822_hiovs,omitempty"`
   667  	SupportArm            string `json:"__support_arm,omitempty"`
   668  	HwFirmwareType        string `json:"hw_firmware_type,omitempty"`
   669  }
   670  
   671  // Coverage :Edge Coverage Rule
   672  type Coverage struct {
   673  	CoveragePolicy string         `json:"coverage_policy" required:"true"`
   674  	CoverageLevel  string         `json:"coverage_level" required:"true"`
   675  	CoverageSites  []CoverageSite `json:"coverage_sites,omitempty"`
   676  }
   677  
   678  // CoverageSite :Edge service coverage site
   679  type CoverageSite struct {
   680  	Site    string   `json:"site"`
   681  	Demands []Demand `json:"demands"`
   682  }
   683  
   684  // Demand
   685  type Demand struct {
   686  	Operator string `json:"operator" required:"true"`
   687  	Count    int    `json:"demand_count" required:"true"`
   688  	PoolID   string `json:"pool_id"`
   689  }
   690  
   691  type ResourceOpts struct {
   692  	//Name is the name to assign to the newly launched server.
   693  	Name string `json:"name" required:"true"`
   694  
   695  	// ImageRef [optional; required if ImageName is not provided] is the ID or
   696  	// full URL to the image that contains the server's OS and initial state.
   697  	// Also optional if using the boot-from-volume extension.
   698  	ImageRef string `json:"image_ref" required:"true"`
   699  
   700  	// FlavorRef [optional; required if FlavorName is not provided] is the ID or
   701  	// full URL to the flavor that describes the server's specs.
   702  	FlavorRef string `json:"flavor_ref" required:"true"`
   703  
   704  	// UserData contains configuration information or scripts to use upon launch.
   705  	// Create will base64-encode it for you, if it isn't already.
   706  	UserData string `json:"user_data"`
   707  
   708  	// AdminPass sets the root user password. If not set, a randomly-generated
   709  	// password will be created and returned in the response.
   710  	AdminPass string `json:"admin_pass,omitempty"`
   711  
   712  	//secret for logging in server
   713  	KeyName string `json:"key_name,omitempty"`
   714  
   715  	// Networks dictates how this server will be attached to available networks.
   716  	// By default, the server will be attached to all isolated networks for the
   717  	// tenant.
   718  	NetConfig NetConfig `json:"net_config" required:"true"`
   719  
   720  	//Specifies the EIP bandwidth. If this parameter does not exist, no EIP is bound.
   721  	//If this parameter exists, an EIP is bound.
   722  	BandWidth *BandWidth `json:"bandwidth,omitempty"`
   723  
   724  	//the number of servers created
   725  	Count int `json:"count"`
   726  
   727  	//System disk configuration of the ECS
   728  	RootVolume RootVolume `json:"root_volume"`
   729  
   730  	//Specifies the data disk configuration of the ECS. Each data structure indicates
   731  	//a data disk to be created.
   732  	DataVolumes []DataVolume `json:"data_volumes,omitempty"`
   733  
   734  	//Specifies the security group of the ECS.
   735  	SecurityGroups []SecurityGroup `json:"security_groups,omitempty"`
   736  
   737  	// 边缘场景,待使用
   738  	EdgeScenes string `json:"edge_scenes,omitempty"`
   739  }
   740  
   741  // NetConfig
   742  type NetConfig struct {
   743  	VpcID   string     `json:"vpc_id" required:"true"`
   744  	Subnets []SubnetID `json:"subnets"`
   745  	NicNum  int        `json:"nic_num"`
   746  }
   747  
   748  // Subnet
   749  type SubnetID struct {
   750  	ID                  string `json:"id" required:"true"`
   751  	IPv6BandWidthEnable bool   `json:"ipv6_bandwidth_enable"`
   752  	IPv6Enable          bool   `json:"ipv6_enable"`
   753  	PoolIDV6            string `json:"-"`
   754  }
   755  
   756  type BandWidth struct {
   757  	//BandWidth(Mbit/s)[1,300]。
   758  	Size int `json:"size,omitempty"`
   759  
   760  	//ShareTypde PER indicates exclusive, and WHOLE indicates shared.
   761  	ShareType string `json:"sharetype" required:"true"`
   762  
   763  	//ChargeMode
   764  	ChargeMode string `json:"chargemode,omitempty"`
   765  
   766  	//BandWidthID,When creating an elastic IP address for a bandwidth of the
   767  	//WHOLE type, you can specify the original shared bandwidth.
   768  	Id string `json:"id,omitempty"`
   769  }
   770  
   771  type RootVolume struct {
   772  	//the disk type of the ECS system disk. The disk type must match the disk
   773  	//type provided by the system.
   774  	VolumeType string `json:"volume_type" required:"true"`
   775  
   776  	//the system disk size. The unit is GB. The value ranges from 1 to 1024.
   777  	Size int `json:"size,omitempty"`
   778  }
   779  
   780  type DataVolume struct {
   781  	//the disk type of the ECS data disk. The disk type must match the disk
   782  	//type provided by the system.
   783  	VolumeType string `json:"volume_type" required:"true"`
   784  
   785  	//the data disk size in GB. The value ranges from 10 to 32768.
   786  	Size int `json:"size" required:"true"`
   787  }
   788  
   789  type SecurityGroup struct {
   790  	//云服务器组ID,UUID格式。
   791  	ID string `json:"id" required:"true"`
   792  }
   793  
   794  // KeyPair is an SSH key known to the OpenStack Cloud that is available to be
   795  // injected into servers.
   796  type KeyPair struct {
   797  	// Name is used to refer to this keypair from other services within this
   798  	// region.
   799  	Name string `json:"name"`
   800  
   801  	// Fingerprint is a short sequence of bytes that can be used to authenticate
   802  	// or validate a longer public key.
   803  	Fingerprint string `json:"fingerprint"`
   804  
   805  	// PublicKey is the public key from this pair, in OpenSSH format.
   806  	// "ssh-rsa AAAAB3Nz..."
   807  	PublicKey string `json:"public_key"`
   808  
   809  	// PrivateKey is the private key from this pair, in PEM format.
   810  	// "-----BEGIN RSA PRIVATE KEY-----\nMIICXA..."
   811  	// It is only present if this KeyPair was just returned from a Create call.
   812  	PrivateKey string `json:"private_key,omitempty"`
   813  
   814  	// UserID is the user who owns this KeyPair.
   815  	UserID string `json:"user_id,omitempty"`
   816  }
   817  
   818  // ReqSecurityGroupRuleEntity 创建安全组的规则的结构体
   819  type ReqSecurityGroupRuleEntity struct {
   820  	Description     string      `json:"description,omitempty"`
   821  	SecurityGroupID string      `json:"security_group_id"`
   822  	Direction       string      `json:"direction"`
   823  	EtherType       string      `json:"ethertype,omitempty"`
   824  	Protocol        string      `json:"protocol,omitempty"`
   825  	PortRangeMin    interface{} `json:"port_range_min"`
   826  	PortRangeMax    interface{} `json:"port_range_max"`
   827  	RemoteIPPrefix  string      `json:"remote_ip_prefix,omitempty"`
   828  	RemoteGroupID   string      `json:"remote_group_id,omitempty"`
   829  }
   830  
   831  // RespSecurityGroupRuleEntity 获取安全组安全组的规则的结构体
   832  type RespSecurityGroupRuleEntity struct {
   833  	ID              string      `json:"id"`
   834  	Description     string      `json:"description"`
   835  	SecurityGroupID string      `json:"security_group_id"`
   836  	Direction       string      `json:"direction"`
   837  	EtherType       string      `json:"ethertype"`
   838  	Protocol        string      `json:"protocol"`
   839  	PortRangeMin    interface{} `json:"port_range_min"`
   840  	PortRangeMax    interface{} `json:"port_range_max"`
   841  	RemoteIPPrefix  string      `json:"remote_ip_prefix"`
   842  	RemoteGroupID   string      `json:"remote_group_id"`
   843  }
   844  
   845  // 边缘资源组对象
   846  type Stack struct {
   847  	Name      string         `json:"name"`
   848  	Resources []ResourceOpts `json:"resources"`
   849  }
   850  
   851  type DeploymentEdgecloud struct {
   852  	ID          *string   `json:"id,omitempty"`
   853  	Name        *string   `json:"name,omitempty"`
   854  	Stacks      *Stack    `json:"stacks,omitempty"`
   855  	Description *string   `json:"description,omitempty"`
   856  	Coverage    *Coverage `json:"coverage,omitempty"`
   857  }
   858  
   859  // Distribution 实例分布对象
   860  type Distribution struct {
   861  	Area                string `json:"area,omitempty"`
   862  	City                string `json:"name,omitempty"`
   863  	Operator            string `json:"operator,omitempty"`
   864  	Province            string `json:"province,omitempty"`
   865  	SiteId              string `json:"site_id,omitempty"`
   866  	PoolId              string `json:"pool_id,omitempty"`
   867  	StackCount          int32  `json:"stack_count,omitempty"`
   868  	CityShortName       string `json:"city_count_name,omitempty"`
   869  	IPv6Enable          bool   `json:"ipv6_enable,omitempty"`
   870  	IPv6BandWidthEnable bool   `json:"ipv6_bandwidth_enable,omitempty"`
   871  	PoolIDV6            string `json:"pool_id_v6,omitempty"`
   872  }
   873  
   874  // DeploymentResult 部署计划的查询结果
   875  type DeploymentResult struct {
   876  	ID            string              `json:"id"`
   877  	EdgeCloud     DeploymentEdgecloud `json:"edgecloud"`
   878  	Distributions []Distribution      `json:"distribution"`
   879  }