ImportImageRequest.py 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # Licensed to the Apache Software Foundation (ASF) under one
  2. # or more contributor license agreements. See the NOTICE file
  3. # distributed with this work for additional information
  4. # regarding copyright ownership. The ASF licenses this file
  5. # to you under the Apache License, Version 2.0 (the
  6. # "License"); you may not use this file except in compliance
  7. # with the License. You may obtain a copy of the License at
  8. #
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. #
  13. # Unless required by applicable law or agreed to in writing,
  14. # software distributed under the License is distributed on an
  15. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. # KIND, either express or implied. See the License for the
  17. # specific language governing permissions and limitations
  18. # under the License.
  19. from aliyunsdkcore.request import RpcRequest
  20. from aliyunsdkecs.endpoint import endpoint_data
  21. class ImportImageRequest(RpcRequest):
  22. def __init__(self):
  23. RpcRequest.__init__(self, 'Ecs', '2014-05-26', 'ImportImage','ecs')
  24. self.set_method('POST')
  25. if hasattr(self, "endpoint_map"):
  26. setattr(self, "endpoint_map", endpoint_data.getEndpointMap())
  27. if hasattr(self, "endpoint_regional"):
  28. setattr(self, "endpoint_regional", endpoint_data.getEndpointRegional())
  29. def get_DiskDeviceMappings(self):
  30. return self.get_query_params().get('DiskDeviceMappings')
  31. def set_DiskDeviceMappings(self, DiskDeviceMappings):
  32. for depth1 in range(len(DiskDeviceMappings)):
  33. if DiskDeviceMappings[depth1].get('OSSBucket') is not None:
  34. self.add_query_param('DiskDeviceMapping.' + str(depth1 + 1) + '.OSSBucket', DiskDeviceMappings[depth1].get('OSSBucket'))
  35. if DiskDeviceMappings[depth1].get('DiskImSize') is not None:
  36. self.add_query_param('DiskDeviceMapping.' + str(depth1 + 1) + '.DiskImSize', DiskDeviceMappings[depth1].get('DiskImSize'))
  37. if DiskDeviceMappings[depth1].get('Format') is not None:
  38. self.add_query_param('DiskDeviceMapping.' + str(depth1 + 1) + '.Format', DiskDeviceMappings[depth1].get('Format'))
  39. if DiskDeviceMappings[depth1].get('Device') is not None:
  40. self.add_query_param('DiskDeviceMapping.' + str(depth1 + 1) + '.Device', DiskDeviceMappings[depth1].get('Device'))
  41. if DiskDeviceMappings[depth1].get('OSSObject') is not None:
  42. self.add_query_param('DiskDeviceMapping.' + str(depth1 + 1) + '.OSSObject', DiskDeviceMappings[depth1].get('OSSObject'))
  43. if DiskDeviceMappings[depth1].get('DiskImageSize') is not None:
  44. self.add_query_param('DiskDeviceMapping.' + str(depth1 + 1) + '.DiskImageSize', DiskDeviceMappings[depth1].get('DiskImageSize'))
  45. def get_ResourceOwnerId(self):
  46. return self.get_query_params().get('ResourceOwnerId')
  47. def set_ResourceOwnerId(self,ResourceOwnerId):
  48. self.add_query_param('ResourceOwnerId',ResourceOwnerId)
  49. def get_Description(self):
  50. return self.get_query_params().get('Description')
  51. def set_Description(self,Description):
  52. self.add_query_param('Description',Description)
  53. def get_Platform(self):
  54. return self.get_query_params().get('Platform')
  55. def set_Platform(self,Platform):
  56. self.add_query_param('Platform',Platform)
  57. def get_ResourceGroupId(self):
  58. return self.get_query_params().get('ResourceGroupId')
  59. def set_ResourceGroupId(self,ResourceGroupId):
  60. self.add_query_param('ResourceGroupId',ResourceGroupId)
  61. def get_BootMode(self):
  62. return self.get_query_params().get('BootMode')
  63. def set_BootMode(self,BootMode):
  64. self.add_query_param('BootMode',BootMode)
  65. def get_ImageName(self):
  66. return self.get_query_params().get('ImageName')
  67. def set_ImageName(self,ImageName):
  68. self.add_query_param('ImageName',ImageName)
  69. def get_Tags(self):
  70. return self.get_query_params().get('Tags')
  71. def set_Tags(self, Tags):
  72. for depth1 in range(len(Tags)):
  73. if Tags[depth1].get('Value') is not None:
  74. self.add_query_param('Tag.' + str(depth1 + 1) + '.Value', Tags[depth1].get('Value'))
  75. if Tags[depth1].get('Key') is not None:
  76. self.add_query_param('Tag.' + str(depth1 + 1) + '.Key', Tags[depth1].get('Key'))
  77. def get_Architecture(self):
  78. return self.get_query_params().get('Architecture')
  79. def set_Architecture(self,Architecture):
  80. self.add_query_param('Architecture',Architecture)
  81. def get_LicenseType(self):
  82. return self.get_query_params().get('LicenseType')
  83. def set_LicenseType(self,LicenseType):
  84. self.add_query_param('LicenseType',LicenseType)
  85. def get_ResourceOwnerAccount(self):
  86. return self.get_query_params().get('ResourceOwnerAccount')
  87. def set_ResourceOwnerAccount(self,ResourceOwnerAccount):
  88. self.add_query_param('ResourceOwnerAccount',ResourceOwnerAccount)
  89. def get_RoleName(self):
  90. return self.get_query_params().get('RoleName')
  91. def set_RoleName(self,RoleName):
  92. self.add_query_param('RoleName',RoleName)
  93. def get_OSType(self):
  94. return self.get_query_params().get('OSType')
  95. def set_OSType(self,OSType):
  96. self.add_query_param('OSType',OSType)
  97. def get_OwnerId(self):
  98. return self.get_query_params().get('OwnerId')
  99. def set_OwnerId(self,OwnerId):
  100. self.add_query_param('OwnerId',OwnerId)