azure_mgmt_managed_applications 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-09-01-preview/generated/azure_mgmt_managed_applications/managed_application_client.rb +7 -6
  3. data/lib/2017-09-01/generated/azure_mgmt_managed_applications/application_client.rb +7 -6
  4. data/lib/2018-06-01/generated/azure_mgmt_managed_applications.rb +47 -0
  5. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/application_client.rb +135 -0
  6. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/application_definitions.rb +1036 -0
  7. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/applications.rb +1443 -0
  8. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/application.rb +202 -0
  9. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/application_artifact.rb +70 -0
  10. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/application_artifact_type.rb +16 -0
  11. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/application_definition.rb +240 -0
  12. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/application_definition_list_result.rb +99 -0
  13. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/application_list_result.rb +98 -0
  14. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/application_lock_level.rb +17 -0
  15. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/application_patchable.rb +202 -0
  16. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/application_provider_authorization.rb +62 -0
  17. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/error_response.rb +69 -0
  18. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/generic_resource.rb +121 -0
  19. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/identity.rb +72 -0
  20. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/plan.rb +90 -0
  21. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/plan_patchable.rb +90 -0
  22. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/provisioning_state.rb +25 -0
  23. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/resource.rb +101 -0
  24. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/resource_identity_type.rb +15 -0
  25. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/models/sku.rb +101 -0
  26. data/lib/2018-06-01/generated/azure_mgmt_managed_applications/module_definition.rb +9 -0
  27. data/lib/azure_mgmt_managed_applications.rb +1 -0
  28. data/lib/profiles/latest/modules/managedapplications_profile_module.rb +39 -39
  29. data/lib/version.rb +1 -1
  30. metadata +28 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ac5b4bbd8ab2f0af4ce15715720d9460a892f18
4
- data.tar.gz: 34465eca9b2908e579af0a5e20a63e4248b1e2e4
3
+ metadata.gz: 20fe099fcfe512118d2fddb77d5d3b94cc294719
4
+ data.tar.gz: f9ad3b7cc39e97dc5ce852adef04b860f86fec44
5
5
  SHA512:
6
- metadata.gz: aa49b8846e58741c3ea158c469d31f480c5a0c8585eb3687946902ca566b176091d331203c205ba2f36f2fbf65bf77ea6aca8d8d7f3b7f7daab7f2edcb7e64f0
7
- data.tar.gz: 3a1898aa10dae5a68836edd303057b1e141dfce697165644ec24e371ba07c37c8eb796aeed82d34dfa3268433b11c442ca5c30788a82b5611421024ca922203d
6
+ metadata.gz: 73f544dda29074ef6e057096d0616009c7dd9abc3470026bdfcecde9fc2c05771388118c791e8102ec9148569d22f520167f8b47289b3aa1bef10b3496fde34d
7
+ data.tar.gz: 8524f8a77af69151db7eb89213fb624aac8857e0d1812462271e7ab546dbe0ea4f30be2f543cce15c4ae6763f2d752e2fc589e4f57ed7cf335052909ae62ee8e
@@ -23,15 +23,16 @@ module Azure::ManagedApplications::Mgmt::V2016_09_01_preview
23
23
  # @return [String] The API version to use for this operation.
24
24
  attr_reader :api_version
25
25
 
26
- # @return [String] Gets or sets the preferred language for the response.
26
+ # @return [String] The preferred language for the response.
27
27
  attr_accessor :accept_language
28
28
 
29
- # @return [Integer] Gets or sets the retry timeout in seconds for Long
30
- # Running Operations. Default value is 30.
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
31
  attr_accessor :long_running_operation_retry_timeout
32
32
 
33
- # @return [Boolean] When set to true a unique x-ms-client-request-id value
34
- # is generated and included in each request. Default is true.
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
35
36
  attr_accessor :generate_client_request_id
36
37
 
37
38
  # @return [Appliances] appliances
@@ -127,7 +128,7 @@ module Azure::ManagedApplications::Mgmt::V2016_09_01_preview
127
128
  #
128
129
  def add_telemetry
129
130
  sdk_information = 'azure_mgmt_managed_applications'
130
- sdk_information = "#{sdk_information}/0.16.0"
131
+ sdk_information = "#{sdk_information}/0.17.0"
131
132
  add_user_agent_information(sdk_information)
132
133
  end
133
134
  end
@@ -23,15 +23,16 @@ module Azure::ManagedApplications::Mgmt::V2017_09_01
23
23
  # @return [String] The API version to use for this operation.
24
24
  attr_reader :api_version
25
25
 
26
- # @return [String] Gets or sets the preferred language for the response.
26
+ # @return [String] The preferred language for the response.
27
27
  attr_accessor :accept_language
28
28
 
29
- # @return [Integer] Gets or sets the retry timeout in seconds for Long
30
- # Running Operations. Default value is 30.
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
31
  attr_accessor :long_running_operation_retry_timeout
32
32
 
33
- # @return [Boolean] When set to true a unique x-ms-client-request-id value
34
- # is generated and included in each request. Default is true.
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
35
36
  attr_accessor :generate_client_request_id
36
37
 
37
38
  # @return [Applications] applications
@@ -127,7 +128,7 @@ module Azure::ManagedApplications::Mgmt::V2017_09_01
127
128
  #
128
129
  def add_telemetry
129
130
  sdk_information = 'azure_mgmt_managed_applications'
130
- sdk_information = "#{sdk_information}/0.16.0"
131
+ sdk_information = "#{sdk_information}/0.17.0"
131
132
  add_user_agent_information(sdk_information)
132
133
  end
133
134
  end
@@ -0,0 +1,47 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2018-06-01/generated/azure_mgmt_managed_applications/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ManagedApplications::Mgmt::V2018_06_01
23
+ autoload :Applications, '2018-06-01/generated/azure_mgmt_managed_applications/applications.rb'
24
+ autoload :ApplicationDefinitions, '2018-06-01/generated/azure_mgmt_managed_applications/application_definitions.rb'
25
+ autoload :ApplicationClient, '2018-06-01/generated/azure_mgmt_managed_applications/application_client.rb'
26
+
27
+ module Models
28
+ autoload :Sku, '2018-06-01/generated/azure_mgmt_managed_applications/models/sku.rb'
29
+ autoload :Plan, '2018-06-01/generated/azure_mgmt_managed_applications/models/plan.rb'
30
+ autoload :Identity, '2018-06-01/generated/azure_mgmt_managed_applications/models/identity.rb'
31
+ autoload :PlanPatchable, '2018-06-01/generated/azure_mgmt_managed_applications/models/plan_patchable.rb'
32
+ autoload :ErrorResponse, '2018-06-01/generated/azure_mgmt_managed_applications/models/error_response.rb'
33
+ autoload :ApplicationProviderAuthorization, '2018-06-01/generated/azure_mgmt_managed_applications/models/application_provider_authorization.rb'
34
+ autoload :ApplicationDefinitionListResult, '2018-06-01/generated/azure_mgmt_managed_applications/models/application_definition_list_result.rb'
35
+ autoload :ApplicationListResult, '2018-06-01/generated/azure_mgmt_managed_applications/models/application_list_result.rb'
36
+ autoload :ApplicationArtifact, '2018-06-01/generated/azure_mgmt_managed_applications/models/application_artifact.rb'
37
+ autoload :Resource, '2018-06-01/generated/azure_mgmt_managed_applications/models/resource.rb'
38
+ autoload :GenericResource, '2018-06-01/generated/azure_mgmt_managed_applications/models/generic_resource.rb'
39
+ autoload :Application, '2018-06-01/generated/azure_mgmt_managed_applications/models/application.rb'
40
+ autoload :ApplicationPatchable, '2018-06-01/generated/azure_mgmt_managed_applications/models/application_patchable.rb'
41
+ autoload :ApplicationDefinition, '2018-06-01/generated/azure_mgmt_managed_applications/models/application_definition.rb'
42
+ autoload :ProvisioningState, '2018-06-01/generated/azure_mgmt_managed_applications/models/provisioning_state.rb'
43
+ autoload :ApplicationLockLevel, '2018-06-01/generated/azure_mgmt_managed_applications/models/application_lock_level.rb'
44
+ autoload :ApplicationArtifactType, '2018-06-01/generated/azure_mgmt_managed_applications/models/application_artifact_type.rb'
45
+ autoload :ResourceIdentityType, '2018-06-01/generated/azure_mgmt_managed_applications/models/resource_identity_type.rb'
46
+ end
47
+ end
@@ -0,0 +1,135 @@
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::ManagedApplications::Mgmt::V2018_06_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class ApplicationClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The ID of the target subscription.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] The API version to use for this operation.
24
+ attr_reader :api_version
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [Applications] applications
39
+ attr_reader :applications
40
+
41
+ # @return [ApplicationDefinitions] application_definitions
42
+ attr_reader :application_definitions
43
+
44
+ #
45
+ # Creates initializes a new instance of the ApplicationClient class.
46
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
47
+ # @param base_url [String] the base URI of the service.
48
+ # @param options [Array] filters to be applied to the HTTP requests.
49
+ #
50
+ def initialize(credentials = nil, base_url = nil, options = nil)
51
+ super(credentials, options)
52
+ @base_url = base_url || 'https://management.azure.com'
53
+
54
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
55
+ @credentials = credentials
56
+
57
+ @applications = Applications.new(self)
58
+ @application_definitions = ApplicationDefinitions.new(self)
59
+ @api_version = '2018-06-01'
60
+ @accept_language = 'en-US'
61
+ @long_running_operation_retry_timeout = 30
62
+ @generate_client_request_id = true
63
+ add_telemetry
64
+ end
65
+
66
+ #
67
+ # Makes a request and returns the body of the response.
68
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
69
+ # @param path [String] the path, relative to {base_url}.
70
+ # @param options [Hash{String=>String}] specifying any request options like :body.
71
+ # @return [Hash{String=>String}] containing the body of the response.
72
+ # Example:
73
+ #
74
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
75
+ # path = "/path"
76
+ # options = {
77
+ # body: request_content,
78
+ # query_params: {'api-version' => '2016-02-01'}
79
+ # }
80
+ # result = @client.make_request(:put, path, options)
81
+ #
82
+ def make_request(method, path, options = {})
83
+ result = make_request_with_http_info(method, path, options)
84
+ result.body unless result.nil?
85
+ end
86
+
87
+ #
88
+ # Makes a request and returns the operation response.
89
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
90
+ # @param path [String] the path, relative to {base_url}.
91
+ # @param options [Hash{String=>String}] specifying any request options like :body.
92
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
93
+ #
94
+ def make_request_with_http_info(method, path, options = {})
95
+ result = make_request_async(method, path, options).value!
96
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
97
+ result
98
+ end
99
+
100
+ #
101
+ # Makes a request asynchronously.
102
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
103
+ # @param path [String] the path, relative to {base_url}.
104
+ # @param options [Hash{String=>String}] specifying any request options like :body.
105
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
106
+ #
107
+ def make_request_async(method, path, options = {})
108
+ fail ArgumentError, 'method is nil' if method.nil?
109
+ fail ArgumentError, 'path is nil' if path.nil?
110
+
111
+ request_url = options[:base_url] || @base_url
112
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
113
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
114
+ end
115
+
116
+ request_headers = @request_headers
117
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
118
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
119
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
120
+
121
+ super(request_url, method, path, options)
122
+ end
123
+
124
+
125
+ private
126
+ #
127
+ # Adds telemetry information.
128
+ #
129
+ def add_telemetry
130
+ sdk_information = 'azure_mgmt_managed_applications'
131
+ sdk_information = "#{sdk_information}/0.17.0"
132
+ add_user_agent_information(sdk_information)
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,1036 @@
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::ManagedApplications::Mgmt::V2018_06_01
7
+ #
8
+ # ARM applications
9
+ #
10
+ class ApplicationDefinitions
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the ApplicationDefinitions class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ApplicationClient] reference to the ApplicationClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets the managed application definition.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group. The name
28
+ # is case insensitive.
29
+ # @param application_definition_name [String] The name of the managed
30
+ # application definition.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [ApplicationDefinition] operation results.
35
+ #
36
+ def get(resource_group_name, application_definition_name, custom_headers:nil)
37
+ response = get_async(resource_group_name, application_definition_name, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Gets the managed application definition.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group. The name
45
+ # is case insensitive.
46
+ # @param application_definition_name [String] The name of the managed
47
+ # application definition.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def get_with_http_info(resource_group_name, application_definition_name, custom_headers:nil)
54
+ get_async(resource_group_name, application_definition_name, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Gets the managed application definition.
59
+ #
60
+ # @param resource_group_name [String] The name of the resource group. The name
61
+ # is case insensitive.
62
+ # @param application_definition_name [String] The name of the managed
63
+ # application definition.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def get_async(resource_group_name, application_definition_name, custom_headers:nil)
70
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
71
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
72
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
73
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
74
+ fail ArgumentError, 'application_definition_name is nil' if application_definition_name.nil?
75
+ fail ArgumentError, "'application_definition_name' should satisfy the constraint - 'MaxLength': '64'" if !application_definition_name.nil? && application_definition_name.length > 64
76
+ fail ArgumentError, "'application_definition_name' should satisfy the constraint - 'MinLength': '3'" if !application_definition_name.nil? && application_definition_name.length < 3
77
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
78
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
79
+
80
+
81
+ request_headers = {}
82
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
83
+
84
+ # Set Headers
85
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
86
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
87
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'
88
+
89
+ request_url = @base_url || @client.base_url
90
+
91
+ options = {
92
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
93
+ path_params: {'resourceGroupName' => resource_group_name,'applicationDefinitionName' => application_definition_name,'subscriptionId' => @client.subscription_id},
94
+ query_params: {'api-version' => @client.api_version},
95
+ headers: request_headers.merge(custom_headers || {}),
96
+ base_url: request_url
97
+ }
98
+ promise = @client.make_request_async(:get, path_template, options)
99
+
100
+ promise = promise.then do |result|
101
+ http_response = result.response
102
+ status_code = http_response.status
103
+ response_content = http_response.body
104
+ unless status_code == 200 || status_code == 404
105
+ error_model = JSON.load(response_content)
106
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
107
+ end
108
+
109
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
110
+ # Deserialize Response
111
+ if status_code == 200
112
+ begin
113
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
114
+ result_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinition.mapper()
115
+ result.body = @client.deserialize(result_mapper, parsed_response)
116
+ rescue Exception => e
117
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
118
+ end
119
+ end
120
+
121
+ result
122
+ end
123
+
124
+ promise.execute
125
+ end
126
+
127
+ #
128
+ # Deletes the managed application definition.
129
+ #
130
+ # @param resource_group_name [String] The name of the resource group. The name
131
+ # is case insensitive.
132
+ # @param application_definition_name [String] The name of the managed
133
+ # application definition to delete.
134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
135
+ # will be added to the HTTP request.
136
+ #
137
+ def delete(resource_group_name, application_definition_name, custom_headers:nil)
138
+ response = delete_async(resource_group_name, application_definition_name, custom_headers:custom_headers).value!
139
+ nil
140
+ end
141
+
142
+ #
143
+ # @param resource_group_name [String] The name of the resource group. The name
144
+ # is case insensitive.
145
+ # @param application_definition_name [String] The name of the managed
146
+ # application definition to delete.
147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
148
+ # will be added to the HTTP request.
149
+ #
150
+ # @return [Concurrent::Promise] promise which provides async access to http
151
+ # response.
152
+ #
153
+ def delete_async(resource_group_name, application_definition_name, custom_headers:nil)
154
+ # Send request
155
+ promise = begin_delete_async(resource_group_name, application_definition_name, custom_headers:custom_headers)
156
+
157
+ promise = promise.then do |response|
158
+ # Defining deserialization method.
159
+ deserialize_method = lambda do |parsed_response|
160
+ end
161
+
162
+ # Waiting for response.
163
+ @client.get_long_running_operation_result(response, deserialize_method)
164
+ end
165
+
166
+ promise
167
+ end
168
+
169
+ #
170
+ # Creates a new managed application definition.
171
+ #
172
+ # @param resource_group_name [String] The name of the resource group. The name
173
+ # is case insensitive.
174
+ # @param application_definition_name [String] The name of the managed
175
+ # application definition.
176
+ # @param parameters [ApplicationDefinition] Parameters supplied to the create
177
+ # or update an managed application definition.
178
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
179
+ # will be added to the HTTP request.
180
+ #
181
+ # @return [ApplicationDefinition] operation results.
182
+ #
183
+ def create_or_update(resource_group_name, application_definition_name, parameters, custom_headers:nil)
184
+ response = create_or_update_async(resource_group_name, application_definition_name, parameters, custom_headers:custom_headers).value!
185
+ response.body unless response.nil?
186
+ end
187
+
188
+ #
189
+ # @param resource_group_name [String] The name of the resource group. The name
190
+ # is case insensitive.
191
+ # @param application_definition_name [String] The name of the managed
192
+ # application definition.
193
+ # @param parameters [ApplicationDefinition] Parameters supplied to the create
194
+ # or update an managed application definition.
195
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
196
+ # will be added to the HTTP request.
197
+ #
198
+ # @return [Concurrent::Promise] promise which provides async access to http
199
+ # response.
200
+ #
201
+ def create_or_update_async(resource_group_name, application_definition_name, parameters, custom_headers:nil)
202
+ # Send request
203
+ promise = begin_create_or_update_async(resource_group_name, application_definition_name, parameters, custom_headers:custom_headers)
204
+
205
+ promise = promise.then do |response|
206
+ # Defining deserialization method.
207
+ deserialize_method = lambda do |parsed_response|
208
+ result_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinition.mapper()
209
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
210
+ end
211
+
212
+ # Waiting for response.
213
+ @client.get_long_running_operation_result(response, deserialize_method)
214
+ end
215
+
216
+ promise
217
+ end
218
+
219
+ #
220
+ # Lists the managed application definitions in a resource group.
221
+ #
222
+ # @param resource_group_name [String] The name of the resource group. The name
223
+ # is case insensitive.
224
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
225
+ # will be added to the HTTP request.
226
+ #
227
+ # @return [Array<ApplicationDefinition>] operation results.
228
+ #
229
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
230
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
231
+ first_page.get_all_items
232
+ end
233
+
234
+ #
235
+ # Lists the managed application definitions in a resource group.
236
+ #
237
+ # @param resource_group_name [String] The name of the resource group. The name
238
+ # is case insensitive.
239
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
240
+ # will be added to the HTTP request.
241
+ #
242
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
243
+ #
244
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
245
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
246
+ end
247
+
248
+ #
249
+ # Lists the managed application definitions in a resource group.
250
+ #
251
+ # @param resource_group_name [String] The name of the resource group. The name
252
+ # is case insensitive.
253
+ # @param [Hash{String => String}] A hash of custom headers that will be added
254
+ # to the HTTP request.
255
+ #
256
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
257
+ #
258
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
259
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
260
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
261
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
262
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
263
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
264
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
265
+
266
+
267
+ request_headers = {}
268
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
269
+
270
+ # Set Headers
271
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
272
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
273
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions'
274
+
275
+ request_url = @base_url || @client.base_url
276
+
277
+ options = {
278
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
279
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
280
+ query_params: {'api-version' => @client.api_version},
281
+ headers: request_headers.merge(custom_headers || {}),
282
+ base_url: request_url
283
+ }
284
+ promise = @client.make_request_async(:get, path_template, options)
285
+
286
+ promise = promise.then do |result|
287
+ http_response = result.response
288
+ status_code = http_response.status
289
+ response_content = http_response.body
290
+ unless status_code == 200
291
+ error_model = JSON.load(response_content)
292
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
293
+ end
294
+
295
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
296
+ # Deserialize Response
297
+ if status_code == 200
298
+ begin
299
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
300
+ result_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinitionListResult.mapper()
301
+ result.body = @client.deserialize(result_mapper, parsed_response)
302
+ rescue Exception => e
303
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
304
+ end
305
+ end
306
+
307
+ result
308
+ end
309
+
310
+ promise.execute
311
+ end
312
+
313
+ #
314
+ # Gets the managed application definition.
315
+ #
316
+ # @param application_definition_id [String] The fully qualified ID of the
317
+ # managed application definition, including the managed application name and
318
+ # the managed application definition resource type. Use the format,
319
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
320
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
321
+ # will be added to the HTTP request.
322
+ #
323
+ # @return [ApplicationDefinition] operation results.
324
+ #
325
+ def get_by_id(application_definition_id, custom_headers:nil)
326
+ response = get_by_id_async(application_definition_id, custom_headers:custom_headers).value!
327
+ response.body unless response.nil?
328
+ end
329
+
330
+ #
331
+ # Gets the managed application definition.
332
+ #
333
+ # @param application_definition_id [String] The fully qualified ID of the
334
+ # managed application definition, including the managed application name and
335
+ # the managed application definition resource type. Use the format,
336
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
337
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
338
+ # will be added to the HTTP request.
339
+ #
340
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
341
+ #
342
+ def get_by_id_with_http_info(application_definition_id, custom_headers:nil)
343
+ get_by_id_async(application_definition_id, custom_headers:custom_headers).value!
344
+ end
345
+
346
+ #
347
+ # Gets the managed application definition.
348
+ #
349
+ # @param application_definition_id [String] The fully qualified ID of the
350
+ # managed application definition, including the managed application name and
351
+ # the managed application definition resource type. Use the format,
352
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
353
+ # @param [Hash{String => String}] A hash of custom headers that will be added
354
+ # to the HTTP request.
355
+ #
356
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
357
+ #
358
+ def get_by_id_async(application_definition_id, custom_headers:nil)
359
+ fail ArgumentError, 'application_definition_id is nil' if application_definition_id.nil?
360
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.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
+ path_template = '{applicationDefinitionId}'
370
+
371
+ request_url = @base_url || @client.base_url
372
+
373
+ options = {
374
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
375
+ skip_encoding_path_params: {'applicationDefinitionId' => application_definition_id},
376
+ query_params: {'api-version' => @client.api_version},
377
+ headers: request_headers.merge(custom_headers || {}),
378
+ base_url: request_url
379
+ }
380
+ promise = @client.make_request_async(:get, path_template, options)
381
+
382
+ promise = promise.then do |result|
383
+ http_response = result.response
384
+ status_code = http_response.status
385
+ response_content = http_response.body
386
+ unless status_code == 200 || status_code == 404
387
+ error_model = JSON.load(response_content)
388
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
389
+ end
390
+
391
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
392
+ # Deserialize Response
393
+ if status_code == 200
394
+ begin
395
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
396
+ result_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinition.mapper()
397
+ result.body = @client.deserialize(result_mapper, parsed_response)
398
+ rescue Exception => e
399
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
400
+ end
401
+ end
402
+
403
+ result
404
+ end
405
+
406
+ promise.execute
407
+ end
408
+
409
+ #
410
+ # Deletes the managed application definition.
411
+ #
412
+ # @param application_definition_id [String] The fully qualified ID of the
413
+ # managed application definition, including the managed application name and
414
+ # the managed application definition resource type. Use the format,
415
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
416
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
417
+ # will be added to the HTTP request.
418
+ #
419
+ def delete_by_id(application_definition_id, custom_headers:nil)
420
+ response = delete_by_id_async(application_definition_id, custom_headers:custom_headers).value!
421
+ nil
422
+ end
423
+
424
+ #
425
+ # @param application_definition_id [String] The fully qualified ID of the
426
+ # managed application definition, including the managed application name and
427
+ # the managed application definition resource type. Use the format,
428
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
429
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
430
+ # will be added to the HTTP request.
431
+ #
432
+ # @return [Concurrent::Promise] promise which provides async access to http
433
+ # response.
434
+ #
435
+ def delete_by_id_async(application_definition_id, custom_headers:nil)
436
+ # Send request
437
+ promise = begin_delete_by_id_async(application_definition_id, custom_headers:custom_headers)
438
+
439
+ promise = promise.then do |response|
440
+ # Defining deserialization method.
441
+ deserialize_method = lambda do |parsed_response|
442
+ end
443
+
444
+ # Waiting for response.
445
+ @client.get_long_running_operation_result(response, deserialize_method)
446
+ end
447
+
448
+ promise
449
+ end
450
+
451
+ #
452
+ # Creates a new managed application definition.
453
+ #
454
+ # @param application_definition_id [String] The fully qualified ID of the
455
+ # managed application definition, including the managed application name and
456
+ # the managed application definition resource type. Use the format,
457
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
458
+ # @param parameters [ApplicationDefinition] Parameters supplied to the create
459
+ # or update a managed application definition.
460
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
461
+ # will be added to the HTTP request.
462
+ #
463
+ # @return [ApplicationDefinition] operation results.
464
+ #
465
+ def create_or_update_by_id(application_definition_id, parameters, custom_headers:nil)
466
+ response = create_or_update_by_id_async(application_definition_id, parameters, custom_headers:custom_headers).value!
467
+ response.body unless response.nil?
468
+ end
469
+
470
+ #
471
+ # @param application_definition_id [String] The fully qualified ID of the
472
+ # managed application definition, including the managed application name and
473
+ # the managed application definition resource type. Use the format,
474
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
475
+ # @param parameters [ApplicationDefinition] Parameters supplied to the create
476
+ # or update a managed application definition.
477
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
478
+ # will be added to the HTTP request.
479
+ #
480
+ # @return [Concurrent::Promise] promise which provides async access to http
481
+ # response.
482
+ #
483
+ def create_or_update_by_id_async(application_definition_id, parameters, custom_headers:nil)
484
+ # Send request
485
+ promise = begin_create_or_update_by_id_async(application_definition_id, parameters, custom_headers:custom_headers)
486
+
487
+ promise = promise.then do |response|
488
+ # Defining deserialization method.
489
+ deserialize_method = lambda do |parsed_response|
490
+ result_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinition.mapper()
491
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
492
+ end
493
+
494
+ # Waiting for response.
495
+ @client.get_long_running_operation_result(response, deserialize_method)
496
+ end
497
+
498
+ promise
499
+ end
500
+
501
+ #
502
+ # Deletes the managed application definition.
503
+ #
504
+ # @param resource_group_name [String] The name of the resource group. The name
505
+ # is case insensitive.
506
+ # @param application_definition_name [String] The name of the managed
507
+ # application definition to delete.
508
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
509
+ # will be added to the HTTP request.
510
+ #
511
+ #
512
+ def begin_delete(resource_group_name, application_definition_name, custom_headers:nil)
513
+ response = begin_delete_async(resource_group_name, application_definition_name, custom_headers:custom_headers).value!
514
+ nil
515
+ end
516
+
517
+ #
518
+ # Deletes the managed application definition.
519
+ #
520
+ # @param resource_group_name [String] The name of the resource group. The name
521
+ # is case insensitive.
522
+ # @param application_definition_name [String] The name of the managed
523
+ # application definition to delete.
524
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
525
+ # will be added to the HTTP request.
526
+ #
527
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
528
+ #
529
+ def begin_delete_with_http_info(resource_group_name, application_definition_name, custom_headers:nil)
530
+ begin_delete_async(resource_group_name, application_definition_name, custom_headers:custom_headers).value!
531
+ end
532
+
533
+ #
534
+ # Deletes the managed application definition.
535
+ #
536
+ # @param resource_group_name [String] The name of the resource group. The name
537
+ # is case insensitive.
538
+ # @param application_definition_name [String] The name of the managed
539
+ # application definition to delete.
540
+ # @param [Hash{String => String}] A hash of custom headers that will be added
541
+ # to the HTTP request.
542
+ #
543
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
544
+ #
545
+ def begin_delete_async(resource_group_name, application_definition_name, custom_headers:nil)
546
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
547
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
548
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
549
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
550
+ fail ArgumentError, 'application_definition_name is nil' if application_definition_name.nil?
551
+ fail ArgumentError, "'application_definition_name' should satisfy the constraint - 'MaxLength': '64'" if !application_definition_name.nil? && application_definition_name.length > 64
552
+ fail ArgumentError, "'application_definition_name' should satisfy the constraint - 'MinLength': '3'" if !application_definition_name.nil? && application_definition_name.length < 3
553
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
554
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
555
+
556
+
557
+ request_headers = {}
558
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
559
+
560
+ # Set Headers
561
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
562
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
563
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'
564
+
565
+ request_url = @base_url || @client.base_url
566
+
567
+ options = {
568
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
569
+ path_params: {'resourceGroupName' => resource_group_name,'applicationDefinitionName' => application_definition_name,'subscriptionId' => @client.subscription_id},
570
+ query_params: {'api-version' => @client.api_version},
571
+ headers: request_headers.merge(custom_headers || {}),
572
+ base_url: request_url
573
+ }
574
+ promise = @client.make_request_async(:delete, path_template, options)
575
+
576
+ promise = promise.then do |result|
577
+ http_response = result.response
578
+ status_code = http_response.status
579
+ response_content = http_response.body
580
+ unless status_code == 204 || status_code == 200 || status_code == 202
581
+ error_model = JSON.load(response_content)
582
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
583
+ end
584
+
585
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
586
+
587
+ result
588
+ end
589
+
590
+ promise.execute
591
+ end
592
+
593
+ #
594
+ # Creates a new managed application definition.
595
+ #
596
+ # @param resource_group_name [String] The name of the resource group. The name
597
+ # is case insensitive.
598
+ # @param application_definition_name [String] The name of the managed
599
+ # application definition.
600
+ # @param parameters [ApplicationDefinition] Parameters supplied to the create
601
+ # or update an managed application definition.
602
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
603
+ # will be added to the HTTP request.
604
+ #
605
+ # @return [ApplicationDefinition] operation results.
606
+ #
607
+ def begin_create_or_update(resource_group_name, application_definition_name, parameters, custom_headers:nil)
608
+ response = begin_create_or_update_async(resource_group_name, application_definition_name, parameters, custom_headers:custom_headers).value!
609
+ response.body unless response.nil?
610
+ end
611
+
612
+ #
613
+ # Creates a new managed application definition.
614
+ #
615
+ # @param resource_group_name [String] The name of the resource group. The name
616
+ # is case insensitive.
617
+ # @param application_definition_name [String] The name of the managed
618
+ # application definition.
619
+ # @param parameters [ApplicationDefinition] Parameters supplied to the create
620
+ # or update an managed application definition.
621
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
622
+ # will be added to the HTTP request.
623
+ #
624
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
625
+ #
626
+ def begin_create_or_update_with_http_info(resource_group_name, application_definition_name, parameters, custom_headers:nil)
627
+ begin_create_or_update_async(resource_group_name, application_definition_name, parameters, custom_headers:custom_headers).value!
628
+ end
629
+
630
+ #
631
+ # Creates a new managed application definition.
632
+ #
633
+ # @param resource_group_name [String] The name of the resource group. The name
634
+ # is case insensitive.
635
+ # @param application_definition_name [String] The name of the managed
636
+ # application definition.
637
+ # @param parameters [ApplicationDefinition] Parameters supplied to the create
638
+ # or update an managed application definition.
639
+ # @param [Hash{String => String}] A hash of custom headers that will be added
640
+ # to the HTTP request.
641
+ #
642
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
643
+ #
644
+ def begin_create_or_update_async(resource_group_name, application_definition_name, parameters, custom_headers:nil)
645
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
646
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
647
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
648
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
649
+ fail ArgumentError, 'application_definition_name is nil' if application_definition_name.nil?
650
+ fail ArgumentError, "'application_definition_name' should satisfy the constraint - 'MaxLength': '64'" if !application_definition_name.nil? && application_definition_name.length > 64
651
+ fail ArgumentError, "'application_definition_name' should satisfy the constraint - 'MinLength': '3'" if !application_definition_name.nil? && application_definition_name.length < 3
652
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
653
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
654
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
655
+
656
+
657
+ request_headers = {}
658
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
659
+
660
+ # Set Headers
661
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
662
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
663
+
664
+ # Serialize Request
665
+ request_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinition.mapper()
666
+ request_content = @client.serialize(request_mapper, parameters)
667
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
668
+
669
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}'
670
+
671
+ request_url = @base_url || @client.base_url
672
+
673
+ options = {
674
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
675
+ path_params: {'resourceGroupName' => resource_group_name,'applicationDefinitionName' => application_definition_name,'subscriptionId' => @client.subscription_id},
676
+ query_params: {'api-version' => @client.api_version},
677
+ body: request_content,
678
+ headers: request_headers.merge(custom_headers || {}),
679
+ base_url: request_url
680
+ }
681
+ promise = @client.make_request_async(:put, path_template, options)
682
+
683
+ promise = promise.then do |result|
684
+ http_response = result.response
685
+ status_code = http_response.status
686
+ response_content = http_response.body
687
+ unless status_code == 200 || status_code == 201
688
+ error_model = JSON.load(response_content)
689
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
690
+ end
691
+
692
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
693
+ # Deserialize Response
694
+ if status_code == 200
695
+ begin
696
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
697
+ result_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinition.mapper()
698
+ result.body = @client.deserialize(result_mapper, parsed_response)
699
+ rescue Exception => e
700
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
701
+ end
702
+ end
703
+ # Deserialize Response
704
+ if status_code == 201
705
+ begin
706
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
707
+ result_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinition.mapper()
708
+ result.body = @client.deserialize(result_mapper, parsed_response)
709
+ rescue Exception => e
710
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
711
+ end
712
+ end
713
+
714
+ result
715
+ end
716
+
717
+ promise.execute
718
+ end
719
+
720
+ #
721
+ # Deletes the managed application definition.
722
+ #
723
+ # @param application_definition_id [String] The fully qualified ID of the
724
+ # managed application definition, including the managed application name and
725
+ # the managed application definition resource type. Use the format,
726
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
727
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
728
+ # will be added to the HTTP request.
729
+ #
730
+ #
731
+ def begin_delete_by_id(application_definition_id, custom_headers:nil)
732
+ response = begin_delete_by_id_async(application_definition_id, custom_headers:custom_headers).value!
733
+ nil
734
+ end
735
+
736
+ #
737
+ # Deletes the managed application definition.
738
+ #
739
+ # @param application_definition_id [String] The fully qualified ID of the
740
+ # managed application definition, including the managed application name and
741
+ # the managed application definition resource type. Use the format,
742
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
743
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
744
+ # will be added to the HTTP request.
745
+ #
746
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
747
+ #
748
+ def begin_delete_by_id_with_http_info(application_definition_id, custom_headers:nil)
749
+ begin_delete_by_id_async(application_definition_id, custom_headers:custom_headers).value!
750
+ end
751
+
752
+ #
753
+ # Deletes the managed application definition.
754
+ #
755
+ # @param application_definition_id [String] The fully qualified ID of the
756
+ # managed application definition, including the managed application name and
757
+ # the managed application definition resource type. Use the format,
758
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
759
+ # @param [Hash{String => String}] A hash of custom headers that will be added
760
+ # to the HTTP request.
761
+ #
762
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
763
+ #
764
+ def begin_delete_by_id_async(application_definition_id, custom_headers:nil)
765
+ fail ArgumentError, 'application_definition_id is nil' if application_definition_id.nil?
766
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
767
+
768
+
769
+ request_headers = {}
770
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
771
+
772
+ # Set Headers
773
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
774
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
775
+ path_template = '{applicationDefinitionId}'
776
+
777
+ request_url = @base_url || @client.base_url
778
+
779
+ options = {
780
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
781
+ skip_encoding_path_params: {'applicationDefinitionId' => application_definition_id},
782
+ query_params: {'api-version' => @client.api_version},
783
+ headers: request_headers.merge(custom_headers || {}),
784
+ base_url: request_url
785
+ }
786
+ promise = @client.make_request_async(:delete, path_template, options)
787
+
788
+ promise = promise.then do |result|
789
+ http_response = result.response
790
+ status_code = http_response.status
791
+ response_content = http_response.body
792
+ unless status_code == 204 || status_code == 200 || status_code == 202
793
+ error_model = JSON.load(response_content)
794
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
795
+ end
796
+
797
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
798
+
799
+ result
800
+ end
801
+
802
+ promise.execute
803
+ end
804
+
805
+ #
806
+ # Creates a new managed application definition.
807
+ #
808
+ # @param application_definition_id [String] The fully qualified ID of the
809
+ # managed application definition, including the managed application name and
810
+ # the managed application definition resource type. Use the format,
811
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
812
+ # @param parameters [ApplicationDefinition] Parameters supplied to the create
813
+ # or update a managed application definition.
814
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
815
+ # will be added to the HTTP request.
816
+ #
817
+ # @return [ApplicationDefinition] operation results.
818
+ #
819
+ def begin_create_or_update_by_id(application_definition_id, parameters, custom_headers:nil)
820
+ response = begin_create_or_update_by_id_async(application_definition_id, parameters, custom_headers:custom_headers).value!
821
+ response.body unless response.nil?
822
+ end
823
+
824
+ #
825
+ # Creates a new managed application definition.
826
+ #
827
+ # @param application_definition_id [String] The fully qualified ID of the
828
+ # managed application definition, including the managed application name and
829
+ # the managed application definition resource type. Use the format,
830
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
831
+ # @param parameters [ApplicationDefinition] Parameters supplied to the create
832
+ # or update a managed application definition.
833
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
834
+ # will be added to the HTTP request.
835
+ #
836
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
837
+ #
838
+ def begin_create_or_update_by_id_with_http_info(application_definition_id, parameters, custom_headers:nil)
839
+ begin_create_or_update_by_id_async(application_definition_id, parameters, custom_headers:custom_headers).value!
840
+ end
841
+
842
+ #
843
+ # Creates a new managed application definition.
844
+ #
845
+ # @param application_definition_id [String] The fully qualified ID of the
846
+ # managed application definition, including the managed application name and
847
+ # the managed application definition resource type. Use the format,
848
+ # /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applicationDefinitions/{applicationDefinition-name}
849
+ # @param parameters [ApplicationDefinition] Parameters supplied to the create
850
+ # or update a managed application definition.
851
+ # @param [Hash{String => String}] A hash of custom headers that will be added
852
+ # to the HTTP request.
853
+ #
854
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
855
+ #
856
+ def begin_create_or_update_by_id_async(application_definition_id, parameters, custom_headers:nil)
857
+ fail ArgumentError, 'application_definition_id is nil' if application_definition_id.nil?
858
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
859
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
860
+
861
+
862
+ request_headers = {}
863
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
864
+
865
+ # Set Headers
866
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
867
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
868
+
869
+ # Serialize Request
870
+ request_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinition.mapper()
871
+ request_content = @client.serialize(request_mapper, parameters)
872
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
873
+
874
+ path_template = '{applicationDefinitionId}'
875
+
876
+ request_url = @base_url || @client.base_url
877
+
878
+ options = {
879
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
880
+ skip_encoding_path_params: {'applicationDefinitionId' => application_definition_id},
881
+ query_params: {'api-version' => @client.api_version},
882
+ body: request_content,
883
+ headers: request_headers.merge(custom_headers || {}),
884
+ base_url: request_url
885
+ }
886
+ promise = @client.make_request_async(:put, path_template, options)
887
+
888
+ promise = promise.then do |result|
889
+ http_response = result.response
890
+ status_code = http_response.status
891
+ response_content = http_response.body
892
+ unless status_code == 200 || status_code == 201
893
+ error_model = JSON.load(response_content)
894
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
895
+ end
896
+
897
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
898
+ # Deserialize Response
899
+ if status_code == 200
900
+ begin
901
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
902
+ result_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinition.mapper()
903
+ result.body = @client.deserialize(result_mapper, parsed_response)
904
+ rescue Exception => e
905
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
906
+ end
907
+ end
908
+ # Deserialize Response
909
+ if status_code == 201
910
+ begin
911
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
912
+ result_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinition.mapper()
913
+ result.body = @client.deserialize(result_mapper, parsed_response)
914
+ rescue Exception => e
915
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
916
+ end
917
+ end
918
+
919
+ result
920
+ end
921
+
922
+ promise.execute
923
+ end
924
+
925
+ #
926
+ # Lists the managed application definitions in a resource group.
927
+ #
928
+ # @param next_page_link [String] The NextLink from the previous successful call
929
+ # to List operation.
930
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
931
+ # will be added to the HTTP request.
932
+ #
933
+ # @return [ApplicationDefinitionListResult] operation results.
934
+ #
935
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
936
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
937
+ response.body unless response.nil?
938
+ end
939
+
940
+ #
941
+ # Lists the managed application definitions in a resource group.
942
+ #
943
+ # @param next_page_link [String] The NextLink from the previous successful call
944
+ # to List operation.
945
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
946
+ # will be added to the HTTP request.
947
+ #
948
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
949
+ #
950
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
951
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
952
+ end
953
+
954
+ #
955
+ # Lists the managed application definitions in a resource group.
956
+ #
957
+ # @param next_page_link [String] The NextLink from the previous successful call
958
+ # to List operation.
959
+ # @param [Hash{String => String}] A hash of custom headers that will be added
960
+ # to the HTTP request.
961
+ #
962
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
963
+ #
964
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
965
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
966
+
967
+
968
+ request_headers = {}
969
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
970
+
971
+ # Set Headers
972
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
973
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
974
+ path_template = '{nextLink}'
975
+
976
+ request_url = @base_url || @client.base_url
977
+
978
+ options = {
979
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
980
+ skip_encoding_path_params: {'nextLink' => next_page_link},
981
+ headers: request_headers.merge(custom_headers || {}),
982
+ base_url: request_url
983
+ }
984
+ promise = @client.make_request_async(:get, path_template, options)
985
+
986
+ promise = promise.then do |result|
987
+ http_response = result.response
988
+ status_code = http_response.status
989
+ response_content = http_response.body
990
+ unless status_code == 200
991
+ error_model = JSON.load(response_content)
992
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
993
+ end
994
+
995
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
996
+ # Deserialize Response
997
+ if status_code == 200
998
+ begin
999
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1000
+ result_mapper = Azure::ManagedApplications::Mgmt::V2018_06_01::Models::ApplicationDefinitionListResult.mapper()
1001
+ result.body = @client.deserialize(result_mapper, parsed_response)
1002
+ rescue Exception => e
1003
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1004
+ end
1005
+ end
1006
+
1007
+ result
1008
+ end
1009
+
1010
+ promise.execute
1011
+ end
1012
+
1013
+ #
1014
+ # Lists the managed application definitions in a resource group.
1015
+ #
1016
+ # @param resource_group_name [String] The name of the resource group. The name
1017
+ # is case insensitive.
1018
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1019
+ # will be added to the HTTP request.
1020
+ #
1021
+ # @return [ApplicationDefinitionListResult] which provide lazy access to pages
1022
+ # of the response.
1023
+ #
1024
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
1025
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
1026
+ unless response.nil?
1027
+ page = response.body
1028
+ page.next_method = Proc.new do |next_page_link|
1029
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
1030
+ end
1031
+ page
1032
+ end
1033
+ end
1034
+
1035
+ end
1036
+ end