azure_mgmt_attestation 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation.rb +40 -0
  4. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/attestation_management_client.rb +135 -0
  5. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/attestation_providers.rb +525 -0
  6. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/attestation_provider.rb +85 -0
  7. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/attestation_provider_list_result.rb +55 -0
  8. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/attestation_service_creation_params.rb +46 -0
  9. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/attestation_service_status.rb +17 -0
  10. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/azure_entity_resource.rb +75 -0
  11. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/operation_list.rb +55 -0
  12. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/operations_definition.rb +59 -0
  13. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/operations_display_definition.rb +79 -0
  14. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/proxy_resource.rb +63 -0
  15. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/resource.rb +83 -0
  16. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/models/tracked_resource.rb +92 -0
  17. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/module_definition.rb +9 -0
  18. data/lib/2018-09-01-preview/generated/azure_mgmt_attestation/operations.rb +110 -0
  19. data/lib/azure_mgmt_attestation.rb +6 -0
  20. data/lib/module_definition.rb +7 -0
  21. data/lib/profiles/latest/attestation_latest_profile_client.rb +40 -0
  22. data/lib/profiles/latest/attestation_module_definition.rb +8 -0
  23. data/lib/profiles/latest/modules/attestation_profile_module.rb +107 -0
  24. data/lib/version.rb +7 -0
  25. metadata +140 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2a3ba1518e7256e06f9e59961e583c1ab2dcdea1588da999196482d318d9166d
4
+ data.tar.gz: 777a2e0eca7f044262cf76db501dcabbdabdbb189182e49d25e5243171e44d3c
5
+ SHA512:
6
+ metadata.gz: 29459bb25ccd581120762f4a0de68b93398f9aa4aaa0e9bd209323325577372c2c31e5feeac877857c039062fc2183ee89e039940481fdf08bdf676679ed148a
7
+ data.tar.gz: 696e108409d704530896857f3e42c3f424b25dde7941b5f8432b6d10e123a3b0a67eb364fabdc83008fdeec5596977d5ef5973ea9e22f11f524e68e24a7c1af8
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,40 @@
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-09-01-preview/generated/azure_mgmt_attestation/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Attestation::Mgmt::V2018_09_01_preview
23
+ autoload :Operations, '2018-09-01-preview/generated/azure_mgmt_attestation/operations.rb'
24
+ autoload :AttestationProviders, '2018-09-01-preview/generated/azure_mgmt_attestation/attestation_providers.rb'
25
+ autoload :AttestationManagementClient, '2018-09-01-preview/generated/azure_mgmt_attestation/attestation_management_client.rb'
26
+
27
+ module Models
28
+ autoload :AttestationProviderListResult, '2018-09-01-preview/generated/azure_mgmt_attestation/models/attestation_provider_list_result.rb'
29
+ autoload :OperationsDefinition, '2018-09-01-preview/generated/azure_mgmt_attestation/models/operations_definition.rb'
30
+ autoload :AttestationServiceCreationParams, '2018-09-01-preview/generated/azure_mgmt_attestation/models/attestation_service_creation_params.rb'
31
+ autoload :OperationsDisplayDefinition, '2018-09-01-preview/generated/azure_mgmt_attestation/models/operations_display_definition.rb'
32
+ autoload :OperationList, '2018-09-01-preview/generated/azure_mgmt_attestation/models/operation_list.rb'
33
+ autoload :Resource, '2018-09-01-preview/generated/azure_mgmt_attestation/models/resource.rb'
34
+ autoload :AttestationProvider, '2018-09-01-preview/generated/azure_mgmt_attestation/models/attestation_provider.rb'
35
+ autoload :ProxyResource, '2018-09-01-preview/generated/azure_mgmt_attestation/models/proxy_resource.rb'
36
+ autoload :TrackedResource, '2018-09-01-preview/generated/azure_mgmt_attestation/models/tracked_resource.rb'
37
+ autoload :AzureEntityResource, '2018-09-01-preview/generated/azure_mgmt_attestation/models/azure_entity_resource.rb'
38
+ autoload :AttestationServiceStatus, '2018-09-01-preview/generated/azure_mgmt_attestation/models/attestation_service_status.rb'
39
+ end
40
+ 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::Attestation::Mgmt::V2018_09_01_preview
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class AttestationManagementClient < 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] Client API version.
21
+ attr_reader :api_version
22
+
23
+ # @return [String] The ID of the target subscription.
24
+ attr_accessor :subscription_id
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 [Operations] operations
39
+ attr_reader :operations
40
+
41
+ # @return [AttestationProviders] attestation_providers
42
+ attr_reader :attestation_providers
43
+
44
+ #
45
+ # Creates initializes a new instance of the AttestationManagementClient 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
+ @operations = Operations.new(self)
58
+ @attestation_providers = AttestationProviders.new(self)
59
+ @api_version = '2018-09-01-preview'
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_attestation'
131
+ sdk_information = "#{sdk_information}/0.17.0"
132
+ add_user_agent_information(sdk_information)
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,525 @@
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::Attestation::Mgmt::V2018_09_01_preview
7
+ #
8
+ # Various APIs for managing resources in attestation service. This primarily
9
+ # encompasses per-tenant instance management.
10
+ #
11
+ class AttestationProviders
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the AttestationProviders class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [AttestationManagementClient] reference to the AttestationManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Get the status of Attestation Provider.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group. The name
29
+ # is case insensitive.
30
+ # @param provider_name [String] Name of the attestation service instance
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [AttestationProvider] operation results.
35
+ #
36
+ def get(resource_group_name, provider_name, custom_headers:nil)
37
+ response = get_async(resource_group_name, provider_name, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Get the status of Attestation Provider.
43
+ #
44
+ # @param resource_group_name [String] The name of the resource group. The name
45
+ # is case insensitive.
46
+ # @param provider_name [String] Name of the attestation service instance
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
51
+ #
52
+ def get_with_http_info(resource_group_name, provider_name, custom_headers:nil)
53
+ get_async(resource_group_name, provider_name, custom_headers:custom_headers).value!
54
+ end
55
+
56
+ #
57
+ # Get the status of Attestation Provider.
58
+ #
59
+ # @param resource_group_name [String] The name of the resource group. The name
60
+ # is case insensitive.
61
+ # @param provider_name [String] Name of the attestation service instance
62
+ # @param [Hash{String => String}] A hash of custom headers that will be added
63
+ # to the HTTP request.
64
+ #
65
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
66
+ #
67
+ def get_async(resource_group_name, provider_name, custom_headers:nil)
68
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
69
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
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, 'provider_name is nil' if provider_name.nil?
75
+ @client.api_version = '2018-09-01-preview'
76
+
77
+
78
+ request_headers = {}
79
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
80
+
81
+ # Set Headers
82
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
83
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
84
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'
85
+
86
+ request_url = @base_url || @client.base_url
87
+
88
+ options = {
89
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
90
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerName' => provider_name},
91
+ query_params: {'api-version' => @client.api_version},
92
+ headers: request_headers.merge(custom_headers || {}),
93
+ base_url: request_url
94
+ }
95
+ promise = @client.make_request_async(:get, path_template, options)
96
+
97
+ promise = promise.then do |result|
98
+ http_response = result.response
99
+ status_code = http_response.status
100
+ response_content = http_response.body
101
+ unless status_code == 200
102
+ error_model = JSON.load(response_content)
103
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
104
+ end
105
+
106
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
107
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
108
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
109
+ # Deserialize Response
110
+ if status_code == 200
111
+ begin
112
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
113
+ result_mapper = Azure::Attestation::Mgmt::V2018_09_01_preview::Models::AttestationProvider.mapper()
114
+ result.body = @client.deserialize(result_mapper, parsed_response)
115
+ rescue Exception => e
116
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
117
+ end
118
+ end
119
+
120
+ result
121
+ end
122
+
123
+ promise.execute
124
+ end
125
+
126
+ #
127
+ # Creates or updates the Attestation Provider.
128
+ #
129
+ # @param resource_group_name [String] The name of the resource group. The name
130
+ # is case insensitive.
131
+ # @param provider_name [String] Name of the attestation service
132
+ # @param creation_params [AttestationServiceCreationParams] Client supplied
133
+ # parameters.
134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
135
+ # will be added to the HTTP request.
136
+ #
137
+ # @return [AttestationProvider] operation results.
138
+ #
139
+ def create(resource_group_name, provider_name, creation_params:nil, custom_headers:nil)
140
+ response = create_async(resource_group_name, provider_name, creation_params:creation_params, custom_headers:custom_headers).value!
141
+ response.body unless response.nil?
142
+ end
143
+
144
+ #
145
+ # Creates or updates the Attestation Provider.
146
+ #
147
+ # @param resource_group_name [String] The name of the resource group. The name
148
+ # is case insensitive.
149
+ # @param provider_name [String] Name of the attestation service
150
+ # @param creation_params [AttestationServiceCreationParams] Client supplied
151
+ # parameters.
152
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
153
+ # will be added to the HTTP request.
154
+ #
155
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
156
+ #
157
+ def create_with_http_info(resource_group_name, provider_name, creation_params:nil, custom_headers:nil)
158
+ create_async(resource_group_name, provider_name, creation_params:creation_params, custom_headers:custom_headers).value!
159
+ end
160
+
161
+ #
162
+ # Creates or updates the Attestation Provider.
163
+ #
164
+ # @param resource_group_name [String] The name of the resource group. The name
165
+ # is case insensitive.
166
+ # @param provider_name [String] Name of the attestation service
167
+ # @param creation_params [AttestationServiceCreationParams] Client supplied
168
+ # parameters.
169
+ # @param [Hash{String => String}] A hash of custom headers that will be added
170
+ # to the HTTP request.
171
+ #
172
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
173
+ #
174
+ def create_async(resource_group_name, provider_name, creation_params:nil, custom_headers:nil)
175
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
176
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
177
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
178
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
179
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
180
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
181
+ fail ArgumentError, 'provider_name is nil' if provider_name.nil?
182
+ @client.api_version = '2018-09-01-preview'
183
+
184
+
185
+ request_headers = {}
186
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
187
+
188
+ # Set Headers
189
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
190
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
191
+
192
+ # Serialize Request
193
+ request_mapper = Azure::Attestation::Mgmt::V2018_09_01_preview::Models::AttestationServiceCreationParams.mapper()
194
+ request_content = @client.serialize(request_mapper, creation_params)
195
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
196
+
197
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'
198
+
199
+ request_url = @base_url || @client.base_url
200
+
201
+ options = {
202
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
203
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerName' => provider_name},
204
+ query_params: {'api-version' => @client.api_version},
205
+ body: request_content,
206
+ headers: request_headers.merge(custom_headers || {}),
207
+ base_url: request_url
208
+ }
209
+ promise = @client.make_request_async(:put, path_template, options)
210
+
211
+ promise = promise.then do |result|
212
+ http_response = result.response
213
+ status_code = http_response.status
214
+ response_content = http_response.body
215
+ unless status_code == 200 || status_code == 201
216
+ error_model = JSON.load(response_content)
217
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
218
+ end
219
+
220
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
221
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
222
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
223
+ # Deserialize Response
224
+ if status_code == 200
225
+ begin
226
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
227
+ result_mapper = Azure::Attestation::Mgmt::V2018_09_01_preview::Models::AttestationProvider.mapper()
228
+ result.body = @client.deserialize(result_mapper, parsed_response)
229
+ rescue Exception => e
230
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
231
+ end
232
+ end
233
+ # Deserialize Response
234
+ if status_code == 201
235
+ begin
236
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
237
+ result_mapper = Azure::Attestation::Mgmt::V2018_09_01_preview::Models::AttestationProvider.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
+ # Delete Attestation Service.
252
+ #
253
+ # @param resource_group_name [String] The name of the resource group. The name
254
+ # is case insensitive.
255
+ # @param provider_name [String] Name of the attestation service
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, provider_name, custom_headers:nil)
261
+ response = delete_async(resource_group_name, provider_name, custom_headers:custom_headers).value!
262
+ nil
263
+ end
264
+
265
+ #
266
+ # Delete Attestation Service.
267
+ #
268
+ # @param resource_group_name [String] The name of the resource group. The name
269
+ # is case insensitive.
270
+ # @param provider_name [String] Name of the attestation service
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, provider_name, custom_headers:nil)
277
+ delete_async(resource_group_name, provider_name, custom_headers:custom_headers).value!
278
+ end
279
+
280
+ #
281
+ # Delete Attestation Service.
282
+ #
283
+ # @param resource_group_name [String] The name of the resource group. The name
284
+ # is case insensitive.
285
+ # @param provider_name [String] Name of the attestation service
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, provider_name, custom_headers:nil)
292
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
293
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
294
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
295
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
296
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
297
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
298
+ fail ArgumentError, 'provider_name is nil' if provider_name.nil?
299
+ @client.api_version = '2018-09-01-preview'
300
+
301
+
302
+ request_headers = {}
303
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
304
+
305
+ # Set Headers
306
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
307
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
308
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'
309
+
310
+ request_url = @base_url || @client.base_url
311
+
312
+ options = {
313
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
314
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'providerName' => provider_name},
315
+ query_params: {'api-version' => @client.api_version},
316
+ headers: request_headers.merge(custom_headers || {}),
317
+ base_url: request_url
318
+ }
319
+ promise = @client.make_request_async(:delete, path_template, options)
320
+
321
+ promise = promise.then do |result|
322
+ http_response = result.response
323
+ status_code = http_response.status
324
+ response_content = http_response.body
325
+ unless status_code == 200 || status_code == 202 || status_code == 204
326
+ error_model = JSON.load(response_content)
327
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
328
+ end
329
+
330
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
331
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
332
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
333
+
334
+ result
335
+ end
336
+
337
+ promise.execute
338
+ end
339
+
340
+ #
341
+ # Returns a list of attestation providers in a subscription.
342
+ #
343
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
344
+ # will be added to the HTTP request.
345
+ #
346
+ # @return [AttestationProviderListResult] operation results.
347
+ #
348
+ def list(custom_headers:nil)
349
+ response = list_async(custom_headers:custom_headers).value!
350
+ response.body unless response.nil?
351
+ end
352
+
353
+ #
354
+ # Returns a list of attestation providers in a subscription.
355
+ #
356
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
357
+ # will be added to the HTTP request.
358
+ #
359
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
360
+ #
361
+ def list_with_http_info(custom_headers:nil)
362
+ list_async(custom_headers:custom_headers).value!
363
+ end
364
+
365
+ #
366
+ # Returns a list of attestation providers in a subscription.
367
+ #
368
+ # @param [Hash{String => String}] A hash of custom headers that will be added
369
+ # to the HTTP request.
370
+ #
371
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
372
+ #
373
+ def list_async(custom_headers:nil)
374
+ @client.api_version = '2018-09-01-preview'
375
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
376
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
377
+
378
+
379
+ request_headers = {}
380
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
381
+
382
+ # Set Headers
383
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
384
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
385
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders'
386
+
387
+ request_url = @base_url || @client.base_url
388
+
389
+ options = {
390
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
391
+ path_params: {'subscriptionId' => @client.subscription_id},
392
+ query_params: {'api-version' => @client.api_version},
393
+ headers: request_headers.merge(custom_headers || {}),
394
+ base_url: request_url
395
+ }
396
+ promise = @client.make_request_async(:get, path_template, options)
397
+
398
+ promise = promise.then do |result|
399
+ http_response = result.response
400
+ status_code = http_response.status
401
+ response_content = http_response.body
402
+ unless status_code == 200
403
+ error_model = JSON.load(response_content)
404
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
405
+ end
406
+
407
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
408
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
409
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
410
+ # Deserialize Response
411
+ if status_code == 200
412
+ begin
413
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
414
+ result_mapper = Azure::Attestation::Mgmt::V2018_09_01_preview::Models::AttestationProviderListResult.mapper()
415
+ result.body = @client.deserialize(result_mapper, parsed_response)
416
+ rescue Exception => e
417
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
418
+ end
419
+ end
420
+
421
+ result
422
+ end
423
+
424
+ promise.execute
425
+ end
426
+
427
+ #
428
+ # Returns attestation providers list in a resource group.
429
+ #
430
+ # @param resource_group_name [String] The name of the resource group. The name
431
+ # is case insensitive.
432
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
433
+ # will be added to the HTTP request.
434
+ #
435
+ # @return [AttestationProviderListResult] operation results.
436
+ #
437
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
438
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
439
+ response.body unless response.nil?
440
+ end
441
+
442
+ #
443
+ # Returns attestation providers list in a resource group.
444
+ #
445
+ # @param resource_group_name [String] The name of the resource group. The name
446
+ # is case insensitive.
447
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
448
+ # will be added to the HTTP request.
449
+ #
450
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
451
+ #
452
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
453
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
454
+ end
455
+
456
+ #
457
+ # Returns attestation providers list in a resource group.
458
+ #
459
+ # @param resource_group_name [String] The name of the resource group. The name
460
+ # is case insensitive.
461
+ # @param [Hash{String => String}] A hash of custom headers that will be added
462
+ # to the HTTP request.
463
+ #
464
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
465
+ #
466
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
467
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
468
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
469
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
470
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
471
+ @client.api_version = '2018-09-01-preview'
472
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
473
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
474
+
475
+
476
+ request_headers = {}
477
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
478
+
479
+ # Set Headers
480
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
481
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
482
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders'
483
+
484
+ request_url = @base_url || @client.base_url
485
+
486
+ options = {
487
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
488
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
489
+ query_params: {'api-version' => @client.api_version},
490
+ headers: request_headers.merge(custom_headers || {}),
491
+ base_url: request_url
492
+ }
493
+ promise = @client.make_request_async(:get, path_template, options)
494
+
495
+ promise = promise.then do |result|
496
+ http_response = result.response
497
+ status_code = http_response.status
498
+ response_content = http_response.body
499
+ unless status_code == 200
500
+ error_model = JSON.load(response_content)
501
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
502
+ end
503
+
504
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
505
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
506
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
507
+ # Deserialize Response
508
+ if status_code == 200
509
+ begin
510
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
511
+ result_mapper = Azure::Attestation::Mgmt::V2018_09_01_preview::Models::AttestationProviderListResult.mapper()
512
+ result.body = @client.deserialize(result_mapper, parsed_response)
513
+ rescue Exception => e
514
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
515
+ end
516
+ end
517
+
518
+ result
519
+ end
520
+
521
+ promise.execute
522
+ end
523
+
524
+ end
525
+ end