azure_mgmt_deployment_manager 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager.rb +70 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/artifact_sources.rb +339 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/azure_deployment_manager.rb +157 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/artifact_source.rb +130 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/artifact_source_properties_model.rb +79 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/authentication.rb +46 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/azure_entity_resource.rb +75 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/cloud_error_body.rb +90 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/deployment_mode.rb +16 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/identity.rb +65 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/message.rb +59 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/operation.rb +80 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/operation_detail.rb +80 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/pre_post_step.rb +46 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/proxy_resource.rb +63 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/resource.rb +83 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/resource_operation.rb +111 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/rollout.rb +214 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_operation_info.rb +102 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_properties_model.rb +95 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_request.rb +154 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_step.rb +127 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/sas_authentication.rb +64 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service.rb +83 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_properties.rb +59 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_resource.rb +110 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_topology_properties.rb +47 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_topology_resource.rb +98 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit.rb +92 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_artifacts.rb +83 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_properties.rb +73 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_resource.rb +124 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/step.rb +121 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/step_operation_info.rb +109 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/step_properties.rb +46 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/step_resource.rb +100 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/tracked_resource.rb +92 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/wait_step_attributes.rb +47 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/models/wait_step_properties.rb +62 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/module_definition.rb +9 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/operations.rb +130 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/rollouts.rb +626 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/service_topologies.rb +340 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb +419 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/services.rb +346 -0
- data/lib/2018-09-01-preview/generated/azure_mgmt_deployment_manager/steps.rb +333 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager.rb +84 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/artifact_sources.rb +451 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/azure_deployment_manager.rb +157 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/api_key_authentication.rb +86 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/artifact_source.rb +130 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/artifact_source_properties_model.rb +79 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/authentication.rb +46 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/azure_entity_resource.rb +75 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/cloud_error_body.rb +90 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/deployment_mode.rb +16 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/health_check_step_attributes.rb +86 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/health_check_step_properties.rb +64 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/identity.rb +65 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/message.rb +59 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/operation.rb +80 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/operation_detail.rb +80 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/operations_list.rb +47 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/pre_post_step.rb +46 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/proxy_resource.rb +63 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/resource.rb +83 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/resource_operation.rb +111 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_auth_location.rb +16 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_health_check.rb +72 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_health_check_step_attributes.rb +95 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_match_quantifier.rb +16 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_request.rb +74 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_request_authentication.rb +48 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_request_method.rb +16 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_response.rb +70 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rest_response_regex.rb +68 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout.rb +214 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_identity_authentication.rb +51 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_operation_info.rb +102 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_properties_model.rb +95 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_request.rb +154 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/rollout_step.rb +127 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/sas_authentication.rb +64 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service.rb +83 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_properties.rb +59 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_resource.rb +110 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_topology_properties.rb +47 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_topology_resource.rb +98 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit.rb +92 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_artifacts.rb +83 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_properties.rb +73 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/service_unit_resource.rb +124 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/step_group.rb +121 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/step_operation_info.rb +109 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/step_properties.rb +47 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/step_resource.rb +100 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/tracked_resource.rb +92 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/wait_step_attributes.rb +47 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/models/wait_step_properties.rb +62 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/module_definition.rb +9 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/operations.rb +112 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/rollouts.rb +738 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_topologies.rb +452 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/service_units.rb +539 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/services.rb +462 -0
- data/lib/2019-11-01-preview/generated/azure_mgmt_deployment_manager/steps.rb +445 -0
- data/lib/azure_mgmt_deployment_manager.rb +7 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/deploymentmanager_latest_profile_client.rb +40 -0
- data/lib/profiles/latest/deploymentmanager_module_definition.rb +8 -0
- data/lib/profiles/latest/modules/deploymentmanager_profile_module.rb +273 -0
- data/lib/version.rb +7 -0
- metadata +230 -0
@@ -0,0 +1,340 @@
|
|
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::V2018_09_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::V2018_09_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::V2018_09_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::V2018_09_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
|
+
end
|
340
|
+
end
|
@@ -0,0 +1,419 @@
|
|
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::V2018_09_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::V2018_09_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::V2018_09_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
|
+
# Creates or updates a service unit under the service in the service topology.
|
289
|
+
#
|
290
|
+
# This is an asynchronous operation and can be polled to completion using the
|
291
|
+
# operation resource returned by this operation.
|
292
|
+
#
|
293
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
294
|
+
# is case insensitive.
|
295
|
+
# @param service_topology_name [String] The name of the service topology .
|
296
|
+
# @param service_name [String] The name of the service resource.
|
297
|
+
# @param service_unit_name [String] The name of the service unit resource.
|
298
|
+
# @param service_unit_info [ServiceUnitResource] The service unit resource
|
299
|
+
# object.
|
300
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
301
|
+
# will be added to the HTTP request.
|
302
|
+
#
|
303
|
+
# @return [ServiceUnitResource] operation results.
|
304
|
+
#
|
305
|
+
def begin_create_or_update(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
|
306
|
+
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!
|
307
|
+
response.body unless response.nil?
|
308
|
+
end
|
309
|
+
|
310
|
+
#
|
311
|
+
# Creates or updates a service unit under the service in the service topology.
|
312
|
+
#
|
313
|
+
# This is an asynchronous operation and can be polled to completion using the
|
314
|
+
# operation resource returned by this operation.
|
315
|
+
#
|
316
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
317
|
+
# is case insensitive.
|
318
|
+
# @param service_topology_name [String] The name of the service topology .
|
319
|
+
# @param service_name [String] The name of the service resource.
|
320
|
+
# @param service_unit_name [String] The name of the service unit resource.
|
321
|
+
# @param service_unit_info [ServiceUnitResource] The service unit resource
|
322
|
+
# object.
|
323
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
324
|
+
# will be added to the HTTP request.
|
325
|
+
#
|
326
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
327
|
+
#
|
328
|
+
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)
|
329
|
+
begin_create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:custom_headers).value!
|
330
|
+
end
|
331
|
+
|
332
|
+
#
|
333
|
+
# Creates or updates a service unit under the service in the service topology.
|
334
|
+
#
|
335
|
+
# This is an asynchronous operation and can be polled to completion using the
|
336
|
+
# operation resource returned by this operation.
|
337
|
+
#
|
338
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
339
|
+
# is case insensitive.
|
340
|
+
# @param service_topology_name [String] The name of the service topology .
|
341
|
+
# @param service_name [String] The name of the service resource.
|
342
|
+
# @param service_unit_name [String] The name of the service unit resource.
|
343
|
+
# @param service_unit_info [ServiceUnitResource] The service unit resource
|
344
|
+
# object.
|
345
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
346
|
+
# to the HTTP request.
|
347
|
+
#
|
348
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
349
|
+
#
|
350
|
+
def begin_create_or_update_async(resource_group_name, service_topology_name, service_name, service_unit_name, service_unit_info, custom_headers:nil)
|
351
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
352
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
353
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
354
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
355
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
356
|
+
fail ArgumentError, 'service_topology_name is nil' if service_topology_name.nil?
|
357
|
+
fail ArgumentError, 'service_name is nil' if service_name.nil?
|
358
|
+
fail ArgumentError, 'service_unit_name is nil' if service_unit_name.nil?
|
359
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
360
|
+
fail ArgumentError, 'service_unit_info is nil' if service_unit_info.nil?
|
361
|
+
|
362
|
+
|
363
|
+
request_headers = {}
|
364
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
365
|
+
|
366
|
+
# Set Headers
|
367
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
368
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
369
|
+
|
370
|
+
# Serialize Request
|
371
|
+
request_mapper = Azure::DeploymentManager::Mgmt::V2018_09_01_preview::Models::ServiceUnitResource.mapper()
|
372
|
+
request_content = @client.serialize(request_mapper, service_unit_info)
|
373
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
374
|
+
|
375
|
+
path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}'
|
376
|
+
|
377
|
+
request_url = @base_url || @client.base_url
|
378
|
+
|
379
|
+
options = {
|
380
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
381
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'serviceTopologyName' => service_topology_name,'serviceName' => service_name,'serviceUnitName' => service_unit_name},
|
382
|
+
query_params: {'api-version' => @client.api_version},
|
383
|
+
body: request_content,
|
384
|
+
headers: request_headers.merge(custom_headers || {}),
|
385
|
+
base_url: request_url
|
386
|
+
}
|
387
|
+
promise = @client.make_request_async(:put, path_template, options)
|
388
|
+
|
389
|
+
promise = promise.then do |result|
|
390
|
+
http_response = result.response
|
391
|
+
status_code = http_response.status
|
392
|
+
response_content = http_response.body
|
393
|
+
unless status_code == 201
|
394
|
+
error_model = JSON.load(response_content)
|
395
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
396
|
+
end
|
397
|
+
|
398
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
399
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
400
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
401
|
+
# Deserialize Response
|
402
|
+
if status_code == 201
|
403
|
+
begin
|
404
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
405
|
+
result_mapper = Azure::DeploymentManager::Mgmt::V2018_09_01_preview::Models::ServiceUnitResource.mapper()
|
406
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
407
|
+
rescue Exception => e
|
408
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
409
|
+
end
|
410
|
+
end
|
411
|
+
|
412
|
+
result
|
413
|
+
end
|
414
|
+
|
415
|
+
promise.execute
|
416
|
+
end
|
417
|
+
|
418
|
+
end
|
419
|
+
end
|