azure_mgmt_deployment_manager 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager.rb +70 -0
  4. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/artifact_sources.rb +339 -0
  5. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/azure_deployment_manager.rb +157 -0
  6. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/artifact_source.rb +130 -0
  7. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/artifact_source_properties_model.rb +79 -0
  8. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/authentication.rb +46 -0
  9. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/azure_entity_resource.rb +75 -0
  10. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/cloud_error_body.rb +90 -0
  11. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/deployment_mode.rb +16 -0
  12. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/identity.rb +65 -0
  13. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/message.rb +59 -0
  14. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/operation.rb +80 -0
  15. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/operation_detail.rb +80 -0
  16. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/pre_post_step.rb +46 -0
  17. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/proxy_resource.rb +63 -0
  18. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/resource.rb +83 -0
  19. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/resource_operation.rb +111 -0
  20. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/rollout.rb +214 -0
  21. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_operation_info.rb +102 -0
  22. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_properties_model.rb +95 -0
  23. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_request.rb +154 -0
  24. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_step.rb +127 -0
  25. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/sas_authentication.rb +64 -0
  26. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service.rb +83 -0
  27. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_properties.rb +59 -0
  28. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_resource.rb +110 -0
  29. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_topology_properties.rb +47 -0
  30. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_topology_resource.rb +98 -0
  31. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit.rb +92 -0
  32. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_artifacts.rb +83 -0
  33. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_properties.rb +73 -0
  34. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_resource.rb +124 -0
  35. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/step.rb +121 -0
  36. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/step_operation_info.rb +109 -0
  37. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/step_properties.rb +46 -0
  38. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/step_resource.rb +100 -0
  39. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/tracked_resource.rb +92 -0
  40. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/wait_step_attributes.rb +47 -0
  41. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/wait_step_properties.rb +62 -0
  42. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/module_definition.rb +9 -0
  43. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/operations.rb +130 -0
  44. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/rollouts.rb +626 -0
  45. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/service_topologies.rb +340 -0
  46. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb +419 -0
  47. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/services.rb +346 -0
  48. data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/steps.rb +333 -0
  49. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager.rb +84 -0
  50. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/artifact_sources.rb +451 -0
  51. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/azure_deployment_manager.rb +157 -0
  52. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/api_key_authentication.rb +86 -0
  53. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/artifact_source.rb +130 -0
  54. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/artifact_source_properties_model.rb +79 -0
  55. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/authentication.rb +46 -0
  56. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/azure_entity_resource.rb +75 -0
  57. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/cloud_error_body.rb +90 -0
  58. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/deployment_mode.rb +16 -0
  59. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/health_check_step_attributes.rb +86 -0
  60. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/health_check_step_properties.rb +64 -0
  61. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/identity.rb +65 -0
  62. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/message.rb +59 -0
  63. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/operation.rb +80 -0
  64. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/operation_detail.rb +80 -0
  65. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/operations_list.rb +47 -0
  66. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/pre_post_step.rb +46 -0
  67. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/proxy_resource.rb +63 -0
  68. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/resource.rb +83 -0
  69. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/resource_operation.rb +111 -0
  70. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_auth_location.rb +16 -0
  71. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_health_check.rb +72 -0
  72. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_health_check_step_attributes.rb +95 -0
  73. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_match_quantifier.rb +16 -0
  74. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_request.rb +74 -0
  75. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_request_authentication.rb +48 -0
  76. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_request_method.rb +16 -0
  77. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_response.rb +70 -0
  78. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_response_regex.rb +68 -0
  79. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout.rb +214 -0
  80. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_identity_authentication.rb +51 -0
  81. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_operation_info.rb +102 -0
  82. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_properties_model.rb +95 -0
  83. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_request.rb +154 -0
  84. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_step.rb +127 -0
  85. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/sas_authentication.rb +64 -0
  86. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service.rb +83 -0
  87. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_properties.rb +59 -0
  88. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_resource.rb +110 -0
  89. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_topology_properties.rb +47 -0
  90. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_topology_resource.rb +98 -0
  91. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit.rb +92 -0
  92. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_artifacts.rb +83 -0
  93. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_properties.rb +73 -0
  94. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_resource.rb +124 -0
  95. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/step_group.rb +121 -0
  96. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/step_operation_info.rb +109 -0
  97. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/step_properties.rb +47 -0
  98. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/step_resource.rb +100 -0
  99. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/tracked_resource.rb +92 -0
  100. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/wait_step_attributes.rb +47 -0
  101. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/wait_step_properties.rb +62 -0
  102. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/module_definition.rb +9 -0
  103. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/operations.rb +112 -0
  104. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/rollouts.rb +738 -0
  105. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_topologies.rb +452 -0
  106. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb +539 -0
  107. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/services.rb +462 -0
  108. data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/steps.rb +445 -0
  109. data/lib/azure_mgmt_deployment_manager.rb +7 -0
  110. data/lib/module_definition.rb +7 -0
  111. data/lib/profiles/latest/deploymentmanager_latest_profile_client.rb +40 -0
  112. data/lib/profiles/latest/deploymentmanager_module_definition.rb +8 -0
  113. data/lib/profiles/latest/modules/deploymentmanager_profile_module.rb +273 -0
  114. data/lib/version.rb +7 -0
  115. metadata +230 -0
@@ -0,0 +1,445 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::DeploymentManager::Mgmt::V2019_11_01_preview
7
+ #
8
+ # REST APIs for orchestrating deployments using the Azure Deployment Manager
9
+ # (ADM). See
10
+ # https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview
11
+ # for more information.
12
+ #
13
+ class Steps
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Steps class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [AzureDeploymentManager] reference to the AzureDeploymentManager
25
+ attr_reader :client
26
+
27
+ #
28
+ # Creates or updates a rollout step with the given step properties.
29
+ #
30
+ # Synchronously creates a new step or updates an existing step.
31
+ #
32
+ # @param resource_group_name [String] The name of the resource group. The name
33
+ # is case insensitive.
34
+ # @param step_name [String] The name of the deployment step.
35
+ # @param step_info [StepResource] The step object.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [StepResource] operation results.
40
+ #
41
+ def create_or_update(resource_group_name, step_name, step_info:nil, custom_headers:nil)
42
+ response = create_or_update_async(resource_group_name, step_name, step_info:step_info, custom_headers:custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Creates or updates a rollout step with the given step properties.
48
+ #
49
+ # Synchronously creates a new step or updates an existing step.
50
+ #
51
+ # @param resource_group_name [String] The name of the resource group. The name
52
+ # is case insensitive.
53
+ # @param step_name [String] The name of the deployment step.
54
+ # @param step_info [StepResource] The step object.
55
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
56
+ # will be added to the HTTP request.
57
+ #
58
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
59
+ #
60
+ def create_or_update_with_http_info(resource_group_name, step_name, step_info:nil, custom_headers:nil)
61
+ create_or_update_async(resource_group_name, step_name, step_info:step_info, custom_headers:custom_headers).value!
62
+ end
63
+
64
+ #
65
+ # Creates or updates a rollout step with the given step properties.
66
+ #
67
+ # Synchronously creates a new step or updates an existing step.
68
+ #
69
+ # @param resource_group_name [String] The name of the resource group. The name
70
+ # is case insensitive.
71
+ # @param step_name [String] The name of the deployment step.
72
+ # @param step_info [StepResource] The step object.
73
+ # @param [Hash{String => String}] A hash of custom headers that will be added
74
+ # to the HTTP request.
75
+ #
76
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
+ #
78
+ def create_or_update_async(resource_group_name, step_name, step_info:nil, custom_headers:nil)
79
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
80
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
81
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
82
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
83
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
84
+ fail ArgumentError, 'step_name is nil' if step_name.nil?
85
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
86
+
87
+
88
+ request_headers = {}
89
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
90
+
91
+ # Set Headers
92
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
93
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
94
+
95
+ # Serialize Request
96
+ request_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::StepResource.mapper()
97
+ request_content = @client.serialize(request_mapper, step_info)
98
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
99
+
100
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'
101
+
102
+ request_url = @base_url || @client.base_url
103
+
104
+ options = {
105
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
106
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'stepName' => step_name},
107
+ query_params: {'api-version' => @client.api_version},
108
+ body: request_content,
109
+ headers: request_headers.merge(custom_headers || {}),
110
+ base_url: request_url
111
+ }
112
+ promise = @client.make_request_async(:put, path_template, options)
113
+
114
+ promise = promise.then do |result|
115
+ http_response = result.response
116
+ status_code = http_response.status
117
+ response_content = http_response.body
118
+ unless status_code == 201
119
+ error_model = JSON.load(response_content)
120
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
121
+ end
122
+
123
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
124
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
125
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
126
+ # Deserialize Response
127
+ if status_code == 201
128
+ begin
129
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
130
+ result_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::StepResource.mapper()
131
+ result.body = @client.deserialize(result_mapper, parsed_response)
132
+ rescue Exception => e
133
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
134
+ end
135
+ end
136
+
137
+ result
138
+ end
139
+
140
+ promise.execute
141
+ end
142
+
143
+ #
144
+ # Gets the step.
145
+ #
146
+ # @param resource_group_name [String] The name of the resource group. The name
147
+ # is case insensitive.
148
+ # @param step_name [String] The name of the deployment step.
149
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
150
+ # will be added to the HTTP request.
151
+ #
152
+ # @return [StepResource] operation results.
153
+ #
154
+ def get(resource_group_name, step_name, custom_headers:nil)
155
+ response = get_async(resource_group_name, step_name, custom_headers:custom_headers).value!
156
+ response.body unless response.nil?
157
+ end
158
+
159
+ #
160
+ # Gets the step.
161
+ #
162
+ # @param resource_group_name [String] The name of the resource group. The name
163
+ # is case insensitive.
164
+ # @param step_name [String] The name of the deployment step.
165
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
166
+ # will be added to the HTTP request.
167
+ #
168
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
169
+ #
170
+ def get_with_http_info(resource_group_name, step_name, custom_headers:nil)
171
+ get_async(resource_group_name, step_name, custom_headers:custom_headers).value!
172
+ end
173
+
174
+ #
175
+ # Gets the step.
176
+ #
177
+ # @param resource_group_name [String] The name of the resource group. The name
178
+ # is case insensitive.
179
+ # @param step_name [String] The name of the deployment step.
180
+ # @param [Hash{String => String}] A hash of custom headers that will be added
181
+ # to the HTTP request.
182
+ #
183
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
184
+ #
185
+ def get_async(resource_group_name, step_name, custom_headers:nil)
186
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
187
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
188
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
189
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
190
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
191
+ fail ArgumentError, 'step_name is nil' if step_name.nil?
192
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
193
+
194
+
195
+ request_headers = {}
196
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
197
+
198
+ # Set Headers
199
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
200
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
201
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'
202
+
203
+ request_url = @base_url || @client.base_url
204
+
205
+ options = {
206
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
207
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'stepName' => step_name},
208
+ query_params: {'api-version' => @client.api_version},
209
+ headers: request_headers.merge(custom_headers || {}),
210
+ base_url: request_url
211
+ }
212
+ promise = @client.make_request_async(:get, path_template, options)
213
+
214
+ promise = promise.then do |result|
215
+ http_response = result.response
216
+ status_code = http_response.status
217
+ response_content = http_response.body
218
+ unless status_code == 200
219
+ error_model = JSON.load(response_content)
220
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
221
+ end
222
+
223
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
224
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
225
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
226
+ # Deserialize Response
227
+ if status_code == 200
228
+ begin
229
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
230
+ result_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::StepResource.mapper()
231
+ result.body = @client.deserialize(result_mapper, parsed_response)
232
+ rescue Exception => e
233
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
234
+ end
235
+ end
236
+
237
+ result
238
+ end
239
+
240
+ promise.execute
241
+ end
242
+
243
+ #
244
+ # Deletes the step.
245
+ #
246
+ # @param resource_group_name [String] The name of the resource group. The name
247
+ # is case insensitive.
248
+ # @param step_name [String] The name of the deployment step.
249
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
250
+ # will be added to the HTTP request.
251
+ #
252
+ #
253
+ def delete(resource_group_name, step_name, custom_headers:nil)
254
+ response = delete_async(resource_group_name, step_name, custom_headers:custom_headers).value!
255
+ nil
256
+ end
257
+
258
+ #
259
+ # Deletes the step.
260
+ #
261
+ # @param resource_group_name [String] The name of the resource group. The name
262
+ # is case insensitive.
263
+ # @param step_name [String] The name of the deployment step.
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
268
+ #
269
+ def delete_with_http_info(resource_group_name, step_name, custom_headers:nil)
270
+ delete_async(resource_group_name, step_name, custom_headers:custom_headers).value!
271
+ end
272
+
273
+ #
274
+ # Deletes the step.
275
+ #
276
+ # @param resource_group_name [String] The name of the resource group. The name
277
+ # is case insensitive.
278
+ # @param step_name [String] The name of the deployment step.
279
+ # @param [Hash{String => String}] A hash of custom headers that will be added
280
+ # to the HTTP request.
281
+ #
282
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
283
+ #
284
+ def delete_async(resource_group_name, step_name, custom_headers:nil)
285
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
286
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
287
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
288
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
289
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
290
+ fail ArgumentError, 'step_name is nil' if step_name.nil?
291
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
292
+
293
+
294
+ request_headers = {}
295
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
296
+
297
+ # Set Headers
298
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
299
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
300
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps/{stepName}'
301
+
302
+ request_url = @base_url || @client.base_url
303
+
304
+ options = {
305
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
306
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'stepName' => step_name},
307
+ query_params: {'api-version' => @client.api_version},
308
+ headers: request_headers.merge(custom_headers || {}),
309
+ base_url: request_url
310
+ }
311
+ promise = @client.make_request_async(:delete, path_template, options)
312
+
313
+ promise = promise.then do |result|
314
+ http_response = result.response
315
+ status_code = http_response.status
316
+ response_content = http_response.body
317
+ unless status_code == 200 || status_code == 204
318
+ error_model = JSON.load(response_content)
319
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
320
+ end
321
+
322
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
323
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
324
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
325
+
326
+ result
327
+ end
328
+
329
+ promise.execute
330
+ end
331
+
332
+ #
333
+ # Lists the steps in a resource group.
334
+ #
335
+ # @param resource_group_name [String] The name of the resource group. The name
336
+ # is case insensitive.
337
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
338
+ # will be added to the HTTP request.
339
+ #
340
+ # @return [Array] operation results.
341
+ #
342
+ def list(resource_group_name, custom_headers:nil)
343
+ response = list_async(resource_group_name, custom_headers:custom_headers).value!
344
+ response.body unless response.nil?
345
+ end
346
+
347
+ #
348
+ # Lists the steps in a resource group.
349
+ #
350
+ # @param resource_group_name [String] The name of the resource group. The name
351
+ # is case insensitive.
352
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
353
+ # will be added to the HTTP request.
354
+ #
355
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
356
+ #
357
+ def list_with_http_info(resource_group_name, custom_headers:nil)
358
+ list_async(resource_group_name, custom_headers:custom_headers).value!
359
+ end
360
+
361
+ #
362
+ # Lists the steps in a resource group.
363
+ #
364
+ # @param resource_group_name [String] The name of the resource group. The name
365
+ # is case insensitive.
366
+ # @param [Hash{String => String}] A hash of custom headers that will be added
367
+ # to the HTTP request.
368
+ #
369
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
370
+ #
371
+ def list_async(resource_group_name, custom_headers:nil)
372
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
373
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
374
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
375
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
376
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
377
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
378
+
379
+
380
+ request_headers = {}
381
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
382
+
383
+ # Set Headers
384
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
385
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
386
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/steps'
387
+
388
+ request_url = @base_url || @client.base_url
389
+
390
+ options = {
391
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
392
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
393
+ query_params: {'api-version' => @client.api_version},
394
+ headers: request_headers.merge(custom_headers || {}),
395
+ base_url: request_url
396
+ }
397
+ promise = @client.make_request_async(:get, path_template, options)
398
+
399
+ promise = promise.then do |result|
400
+ http_response = result.response
401
+ status_code = http_response.status
402
+ response_content = http_response.body
403
+ unless status_code == 200
404
+ error_model = JSON.load(response_content)
405
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
406
+ end
407
+
408
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
409
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
410
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
411
+ # Deserialize Response
412
+ if status_code == 200
413
+ begin
414
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
415
+ result_mapper = {
416
+ client_side_validation: true,
417
+ required: false,
418
+ serialized_name: 'parsed_response',
419
+ type: {
420
+ name: 'Sequence',
421
+ element: {
422
+ client_side_validation: true,
423
+ required: false,
424
+ serialized_name: 'StepResourceElementType',
425
+ type: {
426
+ name: 'Composite',
427
+ class_name: 'StepResource'
428
+ }
429
+ }
430
+ }
431
+ }
432
+ result.body = @client.deserialize(result_mapper, parsed_response)
433
+ rescue Exception => e
434
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
435
+ end
436
+ end
437
+
438
+ result
439
+ end
440
+
441
+ promise.execute
442
+ end
443
+
444
+ end
445
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require '2018-09-01-preview/generated/azure_mgmt_deployment_manager'
6
+ require '2019-11-01-preview/generated/azure_mgmt_deployment_manager'
7
+ require 'profiles/latest/deploymentmanager_latest_profile_client'