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,452 @@
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 ServiceTopologies
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the ServiceTopologies 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 service topology.
29
+ #
30
+ # Synchronously creates a new service topology or updates an existing service
31
+ # topology.
32
+ #
33
+ # @param service_topology_info [ServiceTopologyResource] Source topology object
34
+ # defines the resource.
35
+ # @param resource_group_name [String] The name of the resource group. The name
36
+ # is case insensitive.
37
+ # @param service_topology_name [String] The name of the service topology .
38
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
+ # will be added to the HTTP request.
40
+ #
41
+ # @return [ServiceTopologyResource] operation results.
42
+ #
43
+ def create_or_update(service_topology_info, resource_group_name, service_topology_name, custom_headers:nil)
44
+ response = create_or_update_async(service_topology_info, resource_group_name, service_topology_name, custom_headers:custom_headers).value!
45
+ response.body unless response.nil?
46
+ end
47
+
48
+ #
49
+ # Creates or updates a service topology.
50
+ #
51
+ # Synchronously creates a new service topology or updates an existing service
52
+ # topology.
53
+ #
54
+ # @param service_topology_info [ServiceTopologyResource] Source topology object
55
+ # defines the resource.
56
+ # @param resource_group_name [String] The name of the resource group. The name
57
+ # is case insensitive.
58
+ # @param service_topology_name [String] The name of the service topology .
59
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
60
+ # will be added to the HTTP request.
61
+ #
62
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
63
+ #
64
+ def create_or_update_with_http_info(service_topology_info, resource_group_name, service_topology_name, custom_headers:nil)
65
+ create_or_update_async(service_topology_info, resource_group_name, service_topology_name, custom_headers:custom_headers).value!
66
+ end
67
+
68
+ #
69
+ # Creates or updates a service topology.
70
+ #
71
+ # Synchronously creates a new service topology or updates an existing service
72
+ # topology.
73
+ #
74
+ # @param service_topology_info [ServiceTopologyResource] Source topology object
75
+ # defines the resource.
76
+ # @param resource_group_name [String] The name of the resource group. The name
77
+ # is case insensitive.
78
+ # @param service_topology_name [String] The name of the service topology .
79
+ # @param [Hash{String => String}] A hash of custom headers that will be added
80
+ # to the HTTP request.
81
+ #
82
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
83
+ #
84
+ def create_or_update_async(service_topology_info, resource_group_name, service_topology_name, custom_headers:nil)
85
+ fail ArgumentError, 'service_topology_info is nil' if service_topology_info.nil?
86
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
87
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
88
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
89
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
90
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
91
+ fail ArgumentError, 'service_topology_name is nil' if service_topology_name.nil?
92
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
93
+
94
+
95
+ request_headers = {}
96
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
97
+
98
+ # Set Headers
99
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
100
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
101
+
102
+ # Serialize Request
103
+ request_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::ServiceTopologyResource.mapper()
104
+ request_content = @client.serialize(request_mapper, service_topology_info)
105
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
106
+
107
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'
108
+
109
+ request_url = @base_url || @client.base_url
110
+
111
+ options = {
112
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
113
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serviceTopologyName' => service_topology_name},
114
+ query_params: {'api-version' => @client.api_version},
115
+ body: request_content,
116
+ headers: request_headers.merge(custom_headers || {}),
117
+ base_url: request_url
118
+ }
119
+ promise = @client.make_request_async(:put, path_template, options)
120
+
121
+ promise = promise.then do |result|
122
+ http_response = result.response
123
+ status_code = http_response.status
124
+ response_content = http_response.body
125
+ unless status_code == 201
126
+ error_model = JSON.load(response_content)
127
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
128
+ end
129
+
130
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
131
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
132
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
133
+ # Deserialize Response
134
+ if status_code == 201
135
+ begin
136
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
137
+ result_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::ServiceTopologyResource.mapper()
138
+ result.body = @client.deserialize(result_mapper, parsed_response)
139
+ rescue Exception => e
140
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
141
+ end
142
+ end
143
+
144
+ result
145
+ end
146
+
147
+ promise.execute
148
+ end
149
+
150
+ #
151
+ # Gets the service topology.
152
+ #
153
+ # @param resource_group_name [String] The name of the resource group. The name
154
+ # is case insensitive.
155
+ # @param service_topology_name [String] The name of the service topology .
156
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
157
+ # will be added to the HTTP request.
158
+ #
159
+ # @return [ServiceTopologyResource] operation results.
160
+ #
161
+ def get(resource_group_name, service_topology_name, custom_headers:nil)
162
+ response = get_async(resource_group_name, service_topology_name, custom_headers:custom_headers).value!
163
+ response.body unless response.nil?
164
+ end
165
+
166
+ #
167
+ # Gets the service topology.
168
+ #
169
+ # @param resource_group_name [String] The name of the resource group. The name
170
+ # is case insensitive.
171
+ # @param service_topology_name [String] The name of the service topology .
172
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
173
+ # will be added to the HTTP request.
174
+ #
175
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
176
+ #
177
+ def get_with_http_info(resource_group_name, service_topology_name, custom_headers:nil)
178
+ get_async(resource_group_name, service_topology_name, custom_headers:custom_headers).value!
179
+ end
180
+
181
+ #
182
+ # Gets the service topology.
183
+ #
184
+ # @param resource_group_name [String] The name of the resource group. The name
185
+ # is case insensitive.
186
+ # @param service_topology_name [String] The name of the service topology .
187
+ # @param [Hash{String => String}] A hash of custom headers that will be added
188
+ # to the HTTP request.
189
+ #
190
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
191
+ #
192
+ def get_async(resource_group_name, service_topology_name, custom_headers:nil)
193
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
194
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
195
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
196
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
197
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
198
+ fail ArgumentError, 'service_topology_name is nil' if service_topology_name.nil?
199
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
200
+
201
+
202
+ request_headers = {}
203
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
204
+
205
+ # Set Headers
206
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
207
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
208
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'
209
+
210
+ request_url = @base_url || @client.base_url
211
+
212
+ options = {
213
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
214
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serviceTopologyName' => service_topology_name},
215
+ query_params: {'api-version' => @client.api_version},
216
+ headers: request_headers.merge(custom_headers || {}),
217
+ base_url: request_url
218
+ }
219
+ promise = @client.make_request_async(:get, path_template, options)
220
+
221
+ promise = promise.then do |result|
222
+ http_response = result.response
223
+ status_code = http_response.status
224
+ response_content = http_response.body
225
+ unless status_code == 200
226
+ error_model = JSON.load(response_content)
227
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
228
+ end
229
+
230
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
231
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
232
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
233
+ # Deserialize Response
234
+ if status_code == 200
235
+ begin
236
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
237
+ result_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::ServiceTopologyResource.mapper()
238
+ result.body = @client.deserialize(result_mapper, parsed_response)
239
+ rescue Exception => e
240
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
241
+ end
242
+ end
243
+
244
+ result
245
+ end
246
+
247
+ promise.execute
248
+ end
249
+
250
+ #
251
+ # Deletes the service topology.
252
+ #
253
+ # @param resource_group_name [String] The name of the resource group. The name
254
+ # is case insensitive.
255
+ # @param service_topology_name [String] The name of the service topology .
256
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
257
+ # will be added to the HTTP request.
258
+ #
259
+ #
260
+ def delete(resource_group_name, service_topology_name, custom_headers:nil)
261
+ response = delete_async(resource_group_name, service_topology_name, custom_headers:custom_headers).value!
262
+ nil
263
+ end
264
+
265
+ #
266
+ # Deletes the service topology.
267
+ #
268
+ # @param resource_group_name [String] The name of the resource group. The name
269
+ # is case insensitive.
270
+ # @param service_topology_name [String] The name of the service topology .
271
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
272
+ # will be added to the HTTP request.
273
+ #
274
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
275
+ #
276
+ def delete_with_http_info(resource_group_name, service_topology_name, custom_headers:nil)
277
+ delete_async(resource_group_name, service_topology_name, custom_headers:custom_headers).value!
278
+ end
279
+
280
+ #
281
+ # Deletes the service topology.
282
+ #
283
+ # @param resource_group_name [String] The name of the resource group. The name
284
+ # is case insensitive.
285
+ # @param service_topology_name [String] The name of the service topology .
286
+ # @param [Hash{String => String}] A hash of custom headers that will be added
287
+ # to the HTTP request.
288
+ #
289
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
290
+ #
291
+ def delete_async(resource_group_name, service_topology_name, custom_headers:nil)
292
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
293
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
294
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
295
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
296
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
297
+ fail ArgumentError, 'service_topology_name is nil' if service_topology_name.nil?
298
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
299
+
300
+
301
+ request_headers = {}
302
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
303
+
304
+ # Set Headers
305
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
306
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
307
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}'
308
+
309
+ request_url = @base_url || @client.base_url
310
+
311
+ options = {
312
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
313
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serviceTopologyName' => service_topology_name},
314
+ query_params: {'api-version' => @client.api_version},
315
+ headers: request_headers.merge(custom_headers || {}),
316
+ base_url: request_url
317
+ }
318
+ promise = @client.make_request_async(:delete, path_template, options)
319
+
320
+ promise = promise.then do |result|
321
+ http_response = result.response
322
+ status_code = http_response.status
323
+ response_content = http_response.body
324
+ unless status_code == 200 || status_code == 204
325
+ error_model = JSON.load(response_content)
326
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
327
+ end
328
+
329
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
330
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
331
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
332
+
333
+ result
334
+ end
335
+
336
+ promise.execute
337
+ end
338
+
339
+ #
340
+ # Lists the service topologies in the resource group.
341
+ #
342
+ # @param resource_group_name [String] The name of the resource group. The name
343
+ # is case insensitive.
344
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
345
+ # will be added to the HTTP request.
346
+ #
347
+ # @return [Array] operation results.
348
+ #
349
+ def list(resource_group_name, custom_headers:nil)
350
+ response = list_async(resource_group_name, custom_headers:custom_headers).value!
351
+ response.body unless response.nil?
352
+ end
353
+
354
+ #
355
+ # Lists the service topologies in the resource group.
356
+ #
357
+ # @param resource_group_name [String] The name of the resource group. The name
358
+ # is case insensitive.
359
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
360
+ # will be added to the HTTP request.
361
+ #
362
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
363
+ #
364
+ def list_with_http_info(resource_group_name, custom_headers:nil)
365
+ list_async(resource_group_name, custom_headers:custom_headers).value!
366
+ end
367
+
368
+ #
369
+ # Lists the service topologies in the resource group.
370
+ #
371
+ # @param resource_group_name [String] The name of the resource group. The name
372
+ # is case insensitive.
373
+ # @param [Hash{String => String}] A hash of custom headers that will be added
374
+ # to the HTTP request.
375
+ #
376
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
377
+ #
378
+ def list_async(resource_group_name, custom_headers:nil)
379
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
380
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
381
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
382
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
383
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
384
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
385
+
386
+
387
+ request_headers = {}
388
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
389
+
390
+ # Set Headers
391
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
392
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
393
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies'
394
+
395
+ request_url = @base_url || @client.base_url
396
+
397
+ options = {
398
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
399
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
400
+ query_params: {'api-version' => @client.api_version},
401
+ headers: request_headers.merge(custom_headers || {}),
402
+ base_url: request_url
403
+ }
404
+ promise = @client.make_request_async(:get, path_template, options)
405
+
406
+ promise = promise.then do |result|
407
+ http_response = result.response
408
+ status_code = http_response.status
409
+ response_content = http_response.body
410
+ unless status_code == 200
411
+ error_model = JSON.load(response_content)
412
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
413
+ end
414
+
415
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
416
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
417
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
418
+ # Deserialize Response
419
+ if status_code == 200
420
+ begin
421
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
422
+ result_mapper = {
423
+ client_side_validation: true,
424
+ required: false,
425
+ serialized_name: 'parsed_response',
426
+ type: {
427
+ name: 'Sequence',
428
+ element: {
429
+ client_side_validation: true,
430
+ required: false,
431
+ serialized_name: 'ServiceTopologyResourceElementType',
432
+ type: {
433
+ name: 'Composite',
434
+ class_name: 'ServiceTopologyResource'
435
+ }
436
+ }
437
+ }
438
+ }
439
+ result.body = @client.deserialize(result_mapper, parsed_response)
440
+ rescue Exception => e
441
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
442
+ end
443
+ end
444
+
445
+ result
446
+ end
447
+
448
+ promise.execute
449
+ end
450
+
451
+ end
452
+ end
@@ -0,0 +1,539 @@
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 ServiceUnits
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the ServiceUnits 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 service unit under the service in the service topology.
29
+ #
30
+ # This is an asynchronous operation and can be polled to completion using the
31
+ # operation resource returned by this operation.
32
+ #
33
+ # @param resource_group_name [String] The name of the resource group. The name
34
+ # is case insensitive.
35
+ # @param service_topology_name [String] The name of the service topology .
36
+ # @param service_name [String] The name of the service resource.
37
+ # @param service_unit_name [String] The name of the service unit resource.
38
+ # @param service_unit_info [ServiceUnitResource] The service unit resource
39
+ # object.
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [ServiceUnitResource] operation results.
44
+ #
45
+ def create_or_update(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
46
+ response = create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:custom_headers).value!
47
+ response.body unless response.nil?
48
+ end
49
+
50
+ #
51
+ # @param resource_group_name [String] The name of the resource group. The name
52
+ # is case insensitive.
53
+ # @param service_topology_name [String] The name of the service topology .
54
+ # @param service_name [String] The name of the service resource.
55
+ # @param service_unit_name [String] The name of the service unit resource.
56
+ # @param service_unit_info [ServiceUnitResource] The service unit resource
57
+ # object.
58
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
59
+ # will be added to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] promise which provides async access to http
62
+ # response.
63
+ #
64
+ def create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
65
+ # Send request
66
+ promise = begin_create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:custom_headers)
67
+
68
+ promise = promise.then do |response|
69
+ # Defining deserialization method.
70
+ deserialize_method = lambda do |parsed_response|
71
+ result_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::ServiceUnitResource.mapper()
72
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
73
+ end
74
+
75
+ # Waiting for response.
76
+ @client.get_long_running_operation_result(response, deserialize_method)
77
+ end
78
+
79
+ promise
80
+ end
81
+
82
+ #
83
+ # Gets the service unit.
84
+ #
85
+ # @param resource_group_name [String] The name of the resource group. The name
86
+ # is case insensitive.
87
+ # @param service_topology_name [String] The name of the service topology .
88
+ # @param service_name [String] The name of the service resource.
89
+ # @param service_unit_name [String] The name of the service unit resource.
90
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
91
+ # will be added to the HTTP request.
92
+ #
93
+ # @return [ServiceUnitResource] operation results.
94
+ #
95
+ def get(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:nil)
96
+ response = get_async(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:custom_headers).value!
97
+ response.body unless response.nil?
98
+ end
99
+
100
+ #
101
+ # Gets the service unit.
102
+ #
103
+ # @param resource_group_name [String] The name of the resource group. The name
104
+ # is case insensitive.
105
+ # @param service_topology_name [String] The name of the service topology .
106
+ # @param service_name [String] The name of the service resource.
107
+ # @param service_unit_name [String] The name of the service unit resource.
108
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
109
+ # will be added to the HTTP request.
110
+ #
111
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
112
+ #
113
+ def get_with_http_info(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:nil)
114
+ get_async(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:custom_headers).value!
115
+ end
116
+
117
+ #
118
+ # Gets the service unit.
119
+ #
120
+ # @param resource_group_name [String] The name of the resource group. The name
121
+ # is case insensitive.
122
+ # @param service_topology_name [String] The name of the service topology .
123
+ # @param service_name [String] The name of the service resource.
124
+ # @param service_unit_name [String] The name of the service unit resource.
125
+ # @param [Hash{String => String}] A hash of custom headers that will be added
126
+ # to the HTTP request.
127
+ #
128
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
129
+ #
130
+ def get_async(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:nil)
131
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
132
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
133
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
134
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
135
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
136
+ fail ArgumentError, 'service_topology_name is nil' if service_topology_name.nil?
137
+ fail ArgumentError, 'service_name is nil' if service_name.nil?
138
+ fail ArgumentError, 'service_unit_name is nil' if service_unit_name.nil?
139
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
140
+
141
+
142
+ request_headers = {}
143
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
144
+
145
+ # Set Headers
146
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
147
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
148
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'
149
+
150
+ request_url = @base_url || @client.base_url
151
+
152
+ options = {
153
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
154
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serviceTopologyName' => service_topology_name,'serviceName' => service_name,'serviceUnitName' => service_unit_name},
155
+ query_params: {'api-version' => @client.api_version},
156
+ headers: request_headers.merge(custom_headers || {}),
157
+ base_url: request_url
158
+ }
159
+ promise = @client.make_request_async(:get, path_template, options)
160
+
161
+ promise = promise.then do |result|
162
+ http_response = result.response
163
+ status_code = http_response.status
164
+ response_content = http_response.body
165
+ unless status_code == 200
166
+ error_model = JSON.load(response_content)
167
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
168
+ end
169
+
170
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
171
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
172
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
173
+ # Deserialize Response
174
+ if status_code == 200
175
+ begin
176
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
177
+ result_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::ServiceUnitResource.mapper()
178
+ result.body = @client.deserialize(result_mapper, parsed_response)
179
+ rescue Exception => e
180
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
181
+ end
182
+ end
183
+
184
+ result
185
+ end
186
+
187
+ promise.execute
188
+ end
189
+
190
+ #
191
+ # Deletes the service unit.
192
+ #
193
+ # @param resource_group_name [String] The name of the resource group. The name
194
+ # is case insensitive.
195
+ # @param service_topology_name [String] The name of the service topology .
196
+ # @param service_name [String] The name of the service resource.
197
+ # @param service_unit_name [String] The name of the service unit resource.
198
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
199
+ # will be added to the HTTP request.
200
+ #
201
+ #
202
+ def delete(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:nil)
203
+ response = delete_async(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:custom_headers).value!
204
+ nil
205
+ end
206
+
207
+ #
208
+ # Deletes the service unit.
209
+ #
210
+ # @param resource_group_name [String] The name of the resource group. The name
211
+ # is case insensitive.
212
+ # @param service_topology_name [String] The name of the service topology .
213
+ # @param service_name [String] The name of the service resource.
214
+ # @param service_unit_name [String] The name of the service unit resource.
215
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
216
+ # will be added to the HTTP request.
217
+ #
218
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
219
+ #
220
+ def delete_with_http_info(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:nil)
221
+ delete_async(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:custom_headers).value!
222
+ end
223
+
224
+ #
225
+ # Deletes the service unit.
226
+ #
227
+ # @param resource_group_name [String] The name of the resource group. The name
228
+ # is case insensitive.
229
+ # @param service_topology_name [String] The name of the service topology .
230
+ # @param service_name [String] The name of the service resource.
231
+ # @param service_unit_name [String] The name of the service unit resource.
232
+ # @param [Hash{String => String}] A hash of custom headers that will be added
233
+ # to the HTTP request.
234
+ #
235
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
236
+ #
237
+ def delete_async(resource_group_name, service_topology_name, service_name, service_unit_name, custom_headers:nil)
238
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
239
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
240
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
241
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
242
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
243
+ fail ArgumentError, 'service_topology_name is nil' if service_topology_name.nil?
244
+ fail ArgumentError, 'service_name is nil' if service_name.nil?
245
+ fail ArgumentError, 'service_unit_name is nil' if service_unit_name.nil?
246
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
247
+
248
+
249
+ request_headers = {}
250
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
251
+
252
+ # Set Headers
253
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
254
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
255
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'
256
+
257
+ request_url = @base_url || @client.base_url
258
+
259
+ options = {
260
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
261
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serviceTopologyName' => service_topology_name,'serviceName' => service_name,'serviceUnitName' => service_unit_name},
262
+ query_params: {'api-version' => @client.api_version},
263
+ headers: request_headers.merge(custom_headers || {}),
264
+ base_url: request_url
265
+ }
266
+ promise = @client.make_request_async(:delete, path_template, options)
267
+
268
+ promise = promise.then do |result|
269
+ http_response = result.response
270
+ status_code = http_response.status
271
+ response_content = http_response.body
272
+ unless status_code == 200 || status_code == 204
273
+ error_model = JSON.load(response_content)
274
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
275
+ end
276
+
277
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
278
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
279
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
280
+
281
+ result
282
+ end
283
+
284
+ promise.execute
285
+ end
286
+
287
+ #
288
+ # Lists the service units under a service in the service topology.
289
+ #
290
+ # @param resource_group_name [String] The name of the resource group. The name
291
+ # is case insensitive.
292
+ # @param service_topology_name [String] The name of the service topology .
293
+ # @param service_name [String] The name of the service resource.
294
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
295
+ # will be added to the HTTP request.
296
+ #
297
+ # @return [Array] operation results.
298
+ #
299
+ def list(resource_group_name, service_topology_name, service_name, custom_headers:nil)
300
+ response = list_async(resource_group_name, service_topology_name, service_name, custom_headers:custom_headers).value!
301
+ response.body unless response.nil?
302
+ end
303
+
304
+ #
305
+ # Lists the service units under a service in the service topology.
306
+ #
307
+ # @param resource_group_name [String] The name of the resource group. The name
308
+ # is case insensitive.
309
+ # @param service_topology_name [String] The name of the service topology .
310
+ # @param service_name [String] The name of the service resource.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
315
+ #
316
+ def list_with_http_info(resource_group_name, service_topology_name, service_name, custom_headers:nil)
317
+ list_async(resource_group_name, service_topology_name, service_name, custom_headers:custom_headers).value!
318
+ end
319
+
320
+ #
321
+ # Lists the service units under a service in the service topology.
322
+ #
323
+ # @param resource_group_name [String] The name of the resource group. The name
324
+ # is case insensitive.
325
+ # @param service_topology_name [String] The name of the service topology .
326
+ # @param service_name [String] The name of the service resource.
327
+ # @param [Hash{String => String}] A hash of custom headers that will be added
328
+ # to the HTTP request.
329
+ #
330
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
331
+ #
332
+ def list_async(resource_group_name, service_topology_name, service_name, custom_headers:nil)
333
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
334
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
335
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
336
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
337
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
338
+ fail ArgumentError, 'service_topology_name is nil' if service_topology_name.nil?
339
+ fail ArgumentError, 'service_name is nil' if service_name.nil?
340
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
341
+
342
+
343
+ request_headers = {}
344
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
345
+
346
+ # Set Headers
347
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
348
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
349
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits'
350
+
351
+ request_url = @base_url || @client.base_url
352
+
353
+ options = {
354
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
355
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serviceTopologyName' => service_topology_name,'serviceName' => service_name},
356
+ query_params: {'api-version' => @client.api_version},
357
+ headers: request_headers.merge(custom_headers || {}),
358
+ base_url: request_url
359
+ }
360
+ promise = @client.make_request_async(:get, path_template, options)
361
+
362
+ promise = promise.then do |result|
363
+ http_response = result.response
364
+ status_code = http_response.status
365
+ response_content = http_response.body
366
+ unless status_code == 200
367
+ error_model = JSON.load(response_content)
368
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
369
+ end
370
+
371
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
372
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
373
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
374
+ # Deserialize Response
375
+ if status_code == 200
376
+ begin
377
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
378
+ result_mapper = {
379
+ client_side_validation: true,
380
+ required: false,
381
+ serialized_name: 'parsed_response',
382
+ type: {
383
+ name: 'Sequence',
384
+ element: {
385
+ client_side_validation: true,
386
+ required: false,
387
+ serialized_name: 'ServiceUnitResourceElementType',
388
+ type: {
389
+ name: 'Composite',
390
+ class_name: 'ServiceUnitResource'
391
+ }
392
+ }
393
+ }
394
+ }
395
+ result.body = @client.deserialize(result_mapper, parsed_response)
396
+ rescue Exception => e
397
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
398
+ end
399
+ end
400
+
401
+ result
402
+ end
403
+
404
+ promise.execute
405
+ end
406
+
407
+ #
408
+ # Creates or updates a service unit under the service in the service topology.
409
+ #
410
+ # This is an asynchronous operation and can be polled to completion using the
411
+ # operation resource returned by this operation.
412
+ #
413
+ # @param resource_group_name [String] The name of the resource group. The name
414
+ # is case insensitive.
415
+ # @param service_topology_name [String] The name of the service topology .
416
+ # @param service_name [String] The name of the service resource.
417
+ # @param service_unit_name [String] The name of the service unit resource.
418
+ # @param service_unit_info [ServiceUnitResource] The service unit resource
419
+ # object.
420
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
421
+ # will be added to the HTTP request.
422
+ #
423
+ # @return [ServiceUnitResource] operation results.
424
+ #
425
+ def begin_create_or_update(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
426
+ response = begin_create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:custom_headers).value!
427
+ response.body unless response.nil?
428
+ end
429
+
430
+ #
431
+ # Creates or updates a service unit under the service in the service topology.
432
+ #
433
+ # This is an asynchronous operation and can be polled to completion using the
434
+ # operation resource returned by this operation.
435
+ #
436
+ # @param resource_group_name [String] The name of the resource group. The name
437
+ # is case insensitive.
438
+ # @param service_topology_name [String] The name of the service topology .
439
+ # @param service_name [String] The name of the service resource.
440
+ # @param service_unit_name [String] The name of the service unit resource.
441
+ # @param service_unit_info [ServiceUnitResource] The service unit resource
442
+ # object.
443
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
444
+ # will be added to the HTTP request.
445
+ #
446
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
447
+ #
448
+ def begin_create_or_update_with_http_info(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
449
+ begin_create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:custom_headers).value!
450
+ end
451
+
452
+ #
453
+ # Creates or updates a service unit under the service in the service topology.
454
+ #
455
+ # This is an asynchronous operation and can be polled to completion using the
456
+ # operation resource returned by this operation.
457
+ #
458
+ # @param resource_group_name [String] The name of the resource group. The name
459
+ # is case insensitive.
460
+ # @param service_topology_name [String] The name of the service topology .
461
+ # @param service_name [String] The name of the service resource.
462
+ # @param service_unit_name [String] The name of the service unit resource.
463
+ # @param service_unit_info [ServiceUnitResource] The service unit resource
464
+ # object.
465
+ # @param [Hash{String => String}] A hash of custom headers that will be added
466
+ # to the HTTP request.
467
+ #
468
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
469
+ #
470
+ def begin_create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
471
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
472
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
473
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
474
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
475
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
476
+ fail ArgumentError, 'service_topology_name is nil' if service_topology_name.nil?
477
+ fail ArgumentError, 'service_name is nil' if service_name.nil?
478
+ fail ArgumentError, 'service_unit_name is nil' if service_unit_name.nil?
479
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
480
+ fail ArgumentError, 'service_unit_info is nil' if service_unit_info.nil?
481
+
482
+
483
+ request_headers = {}
484
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
485
+
486
+ # Set Headers
487
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
488
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
489
+
490
+ # Serialize Request
491
+ request_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::ServiceUnitResource.mapper()
492
+ request_content = @client.serialize(request_mapper, service_unit_info)
493
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
494
+
495
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'
496
+
497
+ request_url = @base_url || @client.base_url
498
+
499
+ options = {
500
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
501
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serviceTopologyName' => service_topology_name,'serviceName' => service_name,'serviceUnitName' => service_unit_name},
502
+ query_params: {'api-version' => @client.api_version},
503
+ body: request_content,
504
+ headers: request_headers.merge(custom_headers || {}),
505
+ base_url: request_url
506
+ }
507
+ promise = @client.make_request_async(:put, path_template, options)
508
+
509
+ promise = promise.then do |result|
510
+ http_response = result.response
511
+ status_code = http_response.status
512
+ response_content = http_response.body
513
+ unless status_code == 201
514
+ error_model = JSON.load(response_content)
515
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
516
+ end
517
+
518
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
519
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
520
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
521
+ # Deserialize Response
522
+ if status_code == 201
523
+ begin
524
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
525
+ result_mapper = Azure::DeploymentManager::Mgmt::V2019_11_01_preview::Models::ServiceUnitResource.mapper()
526
+ result.body = @client.deserialize(result_mapper, parsed_response)
527
+ rescue Exception => e
528
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
529
+ end
530
+ end
531
+
532
+ result
533
+ end
534
+
535
+ promise.execute
536
+ end
537
+
538
+ end
539
+ end