resourcesku.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Copyright 2019 Yunion
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package azure
  15. /*
  16. {
  17. "capabilities":[
  18. {"name":"MaxResourceVolumeMB","value":"286720"},
  19. {"name":"OSVhdSizeMB","value":"1047552"},
  20. {"name":"vCPUs","value":"20"},
  21. {"name":"MemoryGB","value":"140"},
  22. {"name":"MaxDataDiskCount","value":"64"},
  23. {"name":"LowPriorityCapable","value":"True"},
  24. {"name":"PremiumIO","value":"True"},
  25. {"name":"EphemeralOSDiskSupported","value":"True"}
  26. ],
  27. "family":"standardDSv2Family",
  28. "locations":["CentralUSEUAP"],
  29. "name":"Standard_DS15_v2",
  30. "resourceType":"virtualMachines",
  31. "restrictions":[],
  32. "size":"DS15_v2",
  33. "tier":"Standard"
  34. }
  35. */
  36. type SResourceSkuCapability struct {
  37. Name string
  38. Value string
  39. }
  40. type TResourceSkuCapacityScaleType string
  41. const (
  42. ResourceSkuCapacityScaleTypeAutomatic = TResourceSkuCapacityScaleType("Automatic")
  43. ResourceSkuCapacityScaleTypeManual = TResourceSkuCapacityScaleType("Manual")
  44. ResourceSkuCapacityScaleTypeNone = TResourceSkuCapacityScaleType("None")
  45. )
  46. type SResourceSkuCapacity struct {
  47. Default int
  48. Maximum int
  49. Minimum int
  50. ScaleType TResourceSkuCapacityScaleType
  51. }
  52. type SResourceSkuLocationInfo struct {
  53. Location string
  54. Zones []string
  55. }
  56. type TResourceSkuRestrictionsType string
  57. const (
  58. ResourceSkuRestrictionsTypeLocation = TResourceSkuRestrictionsType("Location")
  59. ResourceSkuRestrictionsTypeZone = TResourceSkuRestrictionsType("Zone")
  60. )
  61. type TResourceSkuRestrictionsReasonCode string
  62. const (
  63. ResourceSkuRestrictionsReasonCodeNotAvailable = TResourceSkuRestrictionsReasonCode("NotAvailableForSubscription")
  64. ResourceSkuRestrictionsReasonCodeQuotaId = TResourceSkuRestrictionsReasonCode("QuotaId")
  65. )
  66. type SResourceSkuRestrictionInfo struct {
  67. Locations []string
  68. Zones []string
  69. }
  70. type SResourceSkuRestrictions struct {
  71. ReasonCode TResourceSkuRestrictionsReasonCode
  72. RestrictionInfo SResourceSkuRestrictionInfo
  73. Type TResourceSkuRestrictionsType
  74. Values []string
  75. }
  76. type SResourceSku struct {
  77. Capabilities []SResourceSkuCapability
  78. Capacity *SResourceSkuCapacity
  79. Family string
  80. Kind string
  81. LocationInfo []SResourceSkuLocationInfo
  82. Locations []string
  83. Name string
  84. ResourceType string
  85. Restrictions []SResourceSkuRestrictions
  86. Size string
  87. Tier string
  88. }
  89. type SResourceSkusResult struct {
  90. NextLink string
  91. Value []SResourceSku
  92. }
  93. func (self *SAzureClient) ListResourceSkus() ([]SResourceSku, error) {
  94. skus := []SResourceSku{}
  95. resource := "Microsoft.Compute/skus"
  96. return skus, self.list(resource, nil, &skus)
  97. }