azure_mgmt_azurestack 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-06-01/generated/azure_mgmt_azurestack.rb +58 -0
  4. data/lib/2017-06-01/generated/azure_mgmt_azurestack/azure_stack_management_client.rb +145 -0
  5. data/lib/2017-06-01/generated/azure_mgmt_azurestack/customer_subscriptions.rb +528 -0
  6. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/activation_key_result.rb +46 -0
  7. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/compute_role.rb +17 -0
  8. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/customer_subscription.rb +81 -0
  9. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/customer_subscription_list.rb +98 -0
  10. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/data_disk_image.rb +59 -0
  11. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/display.rb +86 -0
  12. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/error_details.rb +71 -0
  13. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/error_response.rb +48 -0
  14. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/extended_product.rb +184 -0
  15. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/icon_uris.rb +90 -0
  16. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/location.rb +15 -0
  17. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/operating_system.rb +17 -0
  18. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/operation.rb +71 -0
  19. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/operation_list.rb +98 -0
  20. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/os_disk_image.rb +60 -0
  21. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/product.rb +271 -0
  22. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/product_link.rb +57 -0
  23. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/product_list.rb +98 -0
  24. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/product_properties.rb +46 -0
  25. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/provisioning_state.rb +18 -0
  26. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/registration.rb +131 -0
  27. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/registration_list.rb +98 -0
  28. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/registration_parameter.rb +58 -0
  29. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/resource.rb +92 -0
  30. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/tracked_resource.rb +115 -0
  31. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/virtual_machine_extension_product_properties.rb +123 -0
  32. data/lib/2017-06-01/generated/azure_mgmt_azurestack/models/virtual_machine_product_properties.rb +81 -0
  33. data/lib/2017-06-01/generated/azure_mgmt_azurestack/module_definition.rb +9 -0
  34. data/lib/2017-06-01/generated/azure_mgmt_azurestack/operations.rb +218 -0
  35. data/lib/2017-06-01/generated/azure_mgmt_azurestack/products.rb +426 -0
  36. data/lib/2017-06-01/generated/azure_mgmt_azurestack/registrations.rb +717 -0
  37. data/lib/azure_mgmt_azurestack.rb +6 -0
  38. data/lib/module_definition.rb +7 -0
  39. data/lib/profiles/latest/azurestack_latest_profile_client.rb +40 -0
  40. data/lib/profiles/latest/azurestack_module_definition.rb +8 -0
  41. data/lib/profiles/latest/modules/azurestack_profile_module.rb +175 -0
  42. data/lib/version.rb +7 -0
  43. metadata +158 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 568fcf2117804afa36e94ab07a1beb6149f01ec1efd5099db57b4fd4bb469658
4
+ data.tar.gz: 2392c45907051a1696f91bbcfbf7938fc66c59c01dd08cd8c3c0f6f38cd09e81
5
+ SHA512:
6
+ metadata.gz: 1df98ade02942dca0bf8c3ff3cdd671adabf59457f733ee9ba21e6532bb3f94f599aaaa0c3fe50552c9b8c0daa2f0a581a9842430d5e074d06d1787ec528a5a1
7
+ data.tar.gz: f5955b86416cba7b2bf0e62702d6d3370613c11da47743bae4351a320c5752b14514080278845bf80ada477749f1e7af88244d436797bf9e20fccad647ec0c5a
@@ -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,58 @@
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 '2017-06-01/generated/azure_mgmt_azurestack/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::AzureStack::Mgmt::V2017_06_01
23
+ autoload :Operations, '2017-06-01/generated/azure_mgmt_azurestack/operations.rb'
24
+ autoload :Products, '2017-06-01/generated/azure_mgmt_azurestack/products.rb'
25
+ autoload :Registrations, '2017-06-01/generated/azure_mgmt_azurestack/registrations.rb'
26
+ autoload :CustomerSubscriptions, '2017-06-01/generated/azure_mgmt_azurestack/customer_subscriptions.rb'
27
+ autoload :AzureStackManagementClient, '2017-06-01/generated/azure_mgmt_azurestack/azure_stack_management_client.rb'
28
+
29
+ module Models
30
+ autoload :VirtualMachineProductProperties, '2017-06-01/generated/azure_mgmt_azurestack/models/virtual_machine_product_properties.rb'
31
+ autoload :IconUris, '2017-06-01/generated/azure_mgmt_azurestack/models/icon_uris.rb'
32
+ autoload :TrackedResource, '2017-06-01/generated/azure_mgmt_azurestack/models/tracked_resource.rb'
33
+ autoload :ProductLink, '2017-06-01/generated/azure_mgmt_azurestack/models/product_link.rb'
34
+ autoload :Operation, '2017-06-01/generated/azure_mgmt_azurestack/models/operation.rb'
35
+ autoload :ProductProperties, '2017-06-01/generated/azure_mgmt_azurestack/models/product_properties.rb'
36
+ autoload :ErrorDetails, '2017-06-01/generated/azure_mgmt_azurestack/models/error_details.rb'
37
+ autoload :OperationList, '2017-06-01/generated/azure_mgmt_azurestack/models/operation_list.rb'
38
+ autoload :ErrorResponse, '2017-06-01/generated/azure_mgmt_azurestack/models/error_response.rb'
39
+ autoload :DataDiskImage, '2017-06-01/generated/azure_mgmt_azurestack/models/data_disk_image.rb'
40
+ autoload :VirtualMachineExtensionProductProperties, '2017-06-01/generated/azure_mgmt_azurestack/models/virtual_machine_extension_product_properties.rb'
41
+ autoload :ProductList, '2017-06-01/generated/azure_mgmt_azurestack/models/product_list.rb'
42
+ autoload :Display, '2017-06-01/generated/azure_mgmt_azurestack/models/display.rb'
43
+ autoload :CustomerSubscriptionList, '2017-06-01/generated/azure_mgmt_azurestack/models/customer_subscription_list.rb'
44
+ autoload :ExtendedProduct, '2017-06-01/generated/azure_mgmt_azurestack/models/extended_product.rb'
45
+ autoload :RegistrationList, '2017-06-01/generated/azure_mgmt_azurestack/models/registration_list.rb'
46
+ autoload :OsDiskImage, '2017-06-01/generated/azure_mgmt_azurestack/models/os_disk_image.rb'
47
+ autoload :ActivationKeyResult, '2017-06-01/generated/azure_mgmt_azurestack/models/activation_key_result.rb'
48
+ autoload :Resource, '2017-06-01/generated/azure_mgmt_azurestack/models/resource.rb'
49
+ autoload :RegistrationParameter, '2017-06-01/generated/azure_mgmt_azurestack/models/registration_parameter.rb'
50
+ autoload :Product, '2017-06-01/generated/azure_mgmt_azurestack/models/product.rb'
51
+ autoload :Registration, '2017-06-01/generated/azure_mgmt_azurestack/models/registration.rb'
52
+ autoload :CustomerSubscription, '2017-06-01/generated/azure_mgmt_azurestack/models/customer_subscription.rb'
53
+ autoload :ProvisioningState, '2017-06-01/generated/azure_mgmt_azurestack/models/provisioning_state.rb'
54
+ autoload :ComputeRole, '2017-06-01/generated/azure_mgmt_azurestack/models/compute_role.rb'
55
+ autoload :OperatingSystem, '2017-06-01/generated/azure_mgmt_azurestack/models/operating_system.rb'
56
+ autoload :Location, '2017-06-01/generated/azure_mgmt_azurestack/models/location.rb'
57
+ end
58
+ end
@@ -0,0 +1,145 @@
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::AzureStack::Mgmt::V2017_06_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class AzureStackManagementClient < 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] Subscription credentials that uniquely identify
21
+ # Microsoft Azure subscription. The subscription ID forms part of the URI
22
+ # for every service call.
23
+ attr_accessor :subscription_id
24
+
25
+ # @return [String] Client API Version.
26
+ attr_reader :api_version
27
+
28
+ # @return [String] The preferred language for the response.
29
+ attr_accessor :accept_language
30
+
31
+ # @return [Integer] The retry timeout in seconds for Long Running
32
+ # Operations. Default value is 30.
33
+ attr_accessor :long_running_operation_retry_timeout
34
+
35
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
36
+ # generated. When set to true a unique x-ms-client-request-id value is
37
+ # generated and included in each request. Default is true.
38
+ attr_accessor :generate_client_request_id
39
+
40
+ # @return [Operations] operations
41
+ attr_reader :operations
42
+
43
+ # @return [Products] products
44
+ attr_reader :products
45
+
46
+ # @return [Registrations] registrations
47
+ attr_reader :registrations
48
+
49
+ # @return [CustomerSubscriptions] customer_subscriptions
50
+ attr_reader :customer_subscriptions
51
+
52
+ #
53
+ # Creates initializes a new instance of the AzureStackManagementClient class.
54
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
55
+ # @param base_url [String] the base URI of the service.
56
+ # @param options [Array] filters to be applied to the HTTP requests.
57
+ #
58
+ def initialize(credentials = nil, base_url = nil, options = nil)
59
+ super(credentials, options)
60
+ @base_url = base_url || 'https://management.azure.com'
61
+
62
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
63
+ @credentials = credentials
64
+
65
+ @operations = Operations.new(self)
66
+ @products = Products.new(self)
67
+ @registrations = Registrations.new(self)
68
+ @customer_subscriptions = CustomerSubscriptions.new(self)
69
+ @api_version = '2017-06-01'
70
+ @accept_language = 'en-US'
71
+ @long_running_operation_retry_timeout = 30
72
+ @generate_client_request_id = true
73
+ add_telemetry
74
+ end
75
+
76
+ #
77
+ # Makes a request and returns the body of the response.
78
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
79
+ # @param path [String] the path, relative to {base_url}.
80
+ # @param options [Hash{String=>String}] specifying any request options like :body.
81
+ # @return [Hash{String=>String}] containing the body of the response.
82
+ # Example:
83
+ #
84
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
85
+ # path = "/path"
86
+ # options = {
87
+ # body: request_content,
88
+ # query_params: {'api-version' => '2016-02-01'}
89
+ # }
90
+ # result = @client.make_request(:put, path, options)
91
+ #
92
+ def make_request(method, path, options = {})
93
+ result = make_request_with_http_info(method, path, options)
94
+ result.body unless result.nil?
95
+ end
96
+
97
+ #
98
+ # Makes a request and returns the operation response.
99
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
100
+ # @param path [String] the path, relative to {base_url}.
101
+ # @param options [Hash{String=>String}] specifying any request options like :body.
102
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
103
+ #
104
+ def make_request_with_http_info(method, path, options = {})
105
+ result = make_request_async(method, path, options).value!
106
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
107
+ result
108
+ end
109
+
110
+ #
111
+ # Makes a request asynchronously.
112
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
113
+ # @param path [String] the path, relative to {base_url}.
114
+ # @param options [Hash{String=>String}] specifying any request options like :body.
115
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
116
+ #
117
+ def make_request_async(method, path, options = {})
118
+ fail ArgumentError, 'method is nil' if method.nil?
119
+ fail ArgumentError, 'path is nil' if path.nil?
120
+
121
+ request_url = options[:base_url] || @base_url
122
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
123
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
124
+ end
125
+
126
+ request_headers = @request_headers
127
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
128
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
129
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
130
+
131
+ super(request_url, method, path, options)
132
+ end
133
+
134
+
135
+ private
136
+ #
137
+ # Adds telemetry information.
138
+ #
139
+ def add_telemetry
140
+ sdk_information = 'azure_mgmt_azurestack'
141
+ sdk_information = "#{sdk_information}/0.17.0"
142
+ add_user_agent_information(sdk_information)
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,528 @@
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::AzureStack::Mgmt::V2017_06_01
7
+ #
8
+ # Azure Stack
9
+ #
10
+ class CustomerSubscriptions
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the CustomerSubscriptions class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AzureStackManagementClient] reference to the AzureStackManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Returns a list of products.
26
+ #
27
+ # @param resource_group [String] Name of the resource group.
28
+ # @param registration_name [String] Name of the Azure Stack registration.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [Array<CustomerSubscription>] operation results.
33
+ #
34
+ def list(resource_group, registration_name, custom_headers:nil)
35
+ first_page = list_as_lazy(resource_group, registration_name, custom_headers:custom_headers)
36
+ first_page.get_all_items
37
+ end
38
+
39
+ #
40
+ # Returns a list of products.
41
+ #
42
+ # @param resource_group [String] Name of the resource group.
43
+ # @param registration_name [String] Name of the Azure Stack registration.
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_with_http_info(resource_group, registration_name, custom_headers:nil)
50
+ list_async(resource_group, registration_name, custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Returns a list of products.
55
+ #
56
+ # @param resource_group [String] Name of the resource group.
57
+ # @param registration_name [String] Name of the Azure Stack registration.
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_async(resource_group, registration_name, custom_headers:nil)
64
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
65
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
66
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
67
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
68
+
69
+
70
+ request_headers = {}
71
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
72
+
73
+ # Set Headers
74
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
75
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
76
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions'
77
+
78
+ request_url = @base_url || @client.base_url
79
+
80
+ options = {
81
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
82
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name},
83
+ query_params: {'api-version' => @client.api_version},
84
+ headers: request_headers.merge(custom_headers || {}),
85
+ base_url: request_url
86
+ }
87
+ promise = @client.make_request_async(:get, path_template, options)
88
+
89
+ promise = promise.then do |result|
90
+ http_response = result.response
91
+ status_code = http_response.status
92
+ response_content = http_response.body
93
+ unless status_code == 200
94
+ error_model = JSON.load(response_content)
95
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
96
+ end
97
+
98
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
99
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
100
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
101
+ # Deserialize Response
102
+ if status_code == 200
103
+ begin
104
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
105
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::CustomerSubscriptionList.mapper()
106
+ result.body = @client.deserialize(result_mapper, parsed_response)
107
+ rescue Exception => e
108
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
109
+ end
110
+ end
111
+
112
+ result
113
+ end
114
+
115
+ promise.execute
116
+ end
117
+
118
+ #
119
+ # Returns the specified product.
120
+ #
121
+ # @param resource_group [String] Name of the resource group.
122
+ # @param registration_name [String] Name of the Azure Stack registration.
123
+ # @param customer_subscription_name [String] Name of the product.
124
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
125
+ # will be added to the HTTP request.
126
+ #
127
+ # @return [CustomerSubscription] operation results.
128
+ #
129
+ def get(resource_group, registration_name, customer_subscription_name, custom_headers:nil)
130
+ response = get_async(resource_group, registration_name, customer_subscription_name, custom_headers:custom_headers).value!
131
+ response.body unless response.nil?
132
+ end
133
+
134
+ #
135
+ # Returns the specified product.
136
+ #
137
+ # @param resource_group [String] Name of the resource group.
138
+ # @param registration_name [String] Name of the Azure Stack registration.
139
+ # @param customer_subscription_name [String] Name of the product.
140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
141
+ # will be added to the HTTP request.
142
+ #
143
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
144
+ #
145
+ def get_with_http_info(resource_group, registration_name, customer_subscription_name, custom_headers:nil)
146
+ get_async(resource_group, registration_name, customer_subscription_name, custom_headers:custom_headers).value!
147
+ end
148
+
149
+ #
150
+ # Returns the specified product.
151
+ #
152
+ # @param resource_group [String] Name of the resource group.
153
+ # @param registration_name [String] Name of the Azure Stack registration.
154
+ # @param customer_subscription_name [String] Name of the product.
155
+ # @param [Hash{String => String}] A hash of custom headers that will be added
156
+ # to the HTTP request.
157
+ #
158
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
159
+ #
160
+ def get_async(resource_group, registration_name, customer_subscription_name, custom_headers:nil)
161
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
162
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
163
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
164
+ fail ArgumentError, 'customer_subscription_name is nil' if customer_subscription_name.nil?
165
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
166
+
167
+
168
+ request_headers = {}
169
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
170
+
171
+ # Set Headers
172
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
173
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
174
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}'
175
+
176
+ request_url = @base_url || @client.base_url
177
+
178
+ options = {
179
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
180
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name,'customerSubscriptionName' => customer_subscription_name},
181
+ query_params: {'api-version' => @client.api_version},
182
+ headers: request_headers.merge(custom_headers || {}),
183
+ base_url: request_url
184
+ }
185
+ promise = @client.make_request_async(:get, path_template, options)
186
+
187
+ promise = promise.then do |result|
188
+ http_response = result.response
189
+ status_code = http_response.status
190
+ response_content = http_response.body
191
+ unless status_code == 200
192
+ error_model = JSON.load(response_content)
193
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
194
+ end
195
+
196
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
197
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
198
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
199
+ # Deserialize Response
200
+ if status_code == 200
201
+ begin
202
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
203
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::CustomerSubscription.mapper()
204
+ result.body = @client.deserialize(result_mapper, parsed_response)
205
+ rescue Exception => e
206
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
207
+ end
208
+ end
209
+
210
+ result
211
+ end
212
+
213
+ promise.execute
214
+ end
215
+
216
+ #
217
+ # Deletes a customer subscription under a registration.
218
+ #
219
+ # @param resource_group [String] Name of the resource group.
220
+ # @param registration_name [String] Name of the Azure Stack registration.
221
+ # @param customer_subscription_name [String] Name of the product.
222
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
223
+ # will be added to the HTTP request.
224
+ #
225
+ #
226
+ def delete(resource_group, registration_name, customer_subscription_name, custom_headers:nil)
227
+ response = delete_async(resource_group, registration_name, customer_subscription_name, custom_headers:custom_headers).value!
228
+ nil
229
+ end
230
+
231
+ #
232
+ # Deletes a customer subscription under a registration.
233
+ #
234
+ # @param resource_group [String] Name of the resource group.
235
+ # @param registration_name [String] Name of the Azure Stack registration.
236
+ # @param customer_subscription_name [String] Name of the product.
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
239
+ #
240
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
241
+ #
242
+ def delete_with_http_info(resource_group, registration_name, customer_subscription_name, custom_headers:nil)
243
+ delete_async(resource_group, registration_name, customer_subscription_name, custom_headers:custom_headers).value!
244
+ end
245
+
246
+ #
247
+ # Deletes a customer subscription under a registration.
248
+ #
249
+ # @param resource_group [String] Name of the resource group.
250
+ # @param registration_name [String] Name of the Azure Stack registration.
251
+ # @param customer_subscription_name [String] Name of the product.
252
+ # @param [Hash{String => String}] A hash of custom headers that will be added
253
+ # to the HTTP request.
254
+ #
255
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
256
+ #
257
+ def delete_async(resource_group, registration_name, customer_subscription_name, custom_headers:nil)
258
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
259
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
260
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
261
+ fail ArgumentError, 'customer_subscription_name is nil' if customer_subscription_name.nil?
262
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
263
+
264
+
265
+ request_headers = {}
266
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
267
+
268
+ # Set Headers
269
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
270
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
271
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}'
272
+
273
+ request_url = @base_url || @client.base_url
274
+
275
+ options = {
276
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
277
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name,'customerSubscriptionName' => customer_subscription_name},
278
+ query_params: {'api-version' => @client.api_version},
279
+ headers: request_headers.merge(custom_headers || {}),
280
+ base_url: request_url
281
+ }
282
+ promise = @client.make_request_async(:delete, path_template, options)
283
+
284
+ promise = promise.then do |result|
285
+ http_response = result.response
286
+ status_code = http_response.status
287
+ response_content = http_response.body
288
+ unless status_code == 200 || status_code == 204
289
+ error_model = JSON.load(response_content)
290
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
291
+ end
292
+
293
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
294
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
295
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
296
+
297
+ result
298
+ end
299
+
300
+ promise.execute
301
+ end
302
+
303
+ #
304
+ # Creates a new customer subscription under a registration.
305
+ #
306
+ # @param resource_group [String] Name of the resource group.
307
+ # @param registration_name [String] Name of the Azure Stack registration.
308
+ # @param customer_subscription_name [String] Name of the product.
309
+ # @param customer_creation_parameters [CustomerSubscription] Parameters use to
310
+ # create a customer subscription.
311
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
312
+ # will be added to the HTTP request.
313
+ #
314
+ # @return [CustomerSubscription] operation results.
315
+ #
316
+ def create(resource_group, registration_name, customer_subscription_name, customer_creation_parameters, custom_headers:nil)
317
+ response = create_async(resource_group, registration_name, customer_subscription_name, customer_creation_parameters, custom_headers:custom_headers).value!
318
+ response.body unless response.nil?
319
+ end
320
+
321
+ #
322
+ # Creates a new customer subscription under a registration.
323
+ #
324
+ # @param resource_group [String] Name of the resource group.
325
+ # @param registration_name [String] Name of the Azure Stack registration.
326
+ # @param customer_subscription_name [String] Name of the product.
327
+ # @param customer_creation_parameters [CustomerSubscription] Parameters use to
328
+ # create a customer subscription.
329
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
330
+ # will be added to the HTTP request.
331
+ #
332
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
333
+ #
334
+ def create_with_http_info(resource_group, registration_name, customer_subscription_name, customer_creation_parameters, custom_headers:nil)
335
+ create_async(resource_group, registration_name, customer_subscription_name, customer_creation_parameters, custom_headers:custom_headers).value!
336
+ end
337
+
338
+ #
339
+ # Creates a new customer subscription under a registration.
340
+ #
341
+ # @param resource_group [String] Name of the resource group.
342
+ # @param registration_name [String] Name of the Azure Stack registration.
343
+ # @param customer_subscription_name [String] Name of the product.
344
+ # @param customer_creation_parameters [CustomerSubscription] Parameters use to
345
+ # create a customer subscription.
346
+ # @param [Hash{String => String}] A hash of custom headers that will be added
347
+ # to the HTTP request.
348
+ #
349
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
350
+ #
351
+ def create_async(resource_group, registration_name, customer_subscription_name, customer_creation_parameters, custom_headers:nil)
352
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
353
+ fail ArgumentError, 'resource_group is nil' if resource_group.nil?
354
+ fail ArgumentError, 'registration_name is nil' if registration_name.nil?
355
+ fail ArgumentError, 'customer_subscription_name is nil' if customer_subscription_name.nil?
356
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
357
+ fail ArgumentError, 'customer_creation_parameters is nil' if customer_creation_parameters.nil?
358
+
359
+
360
+ request_headers = {}
361
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
362
+
363
+ # Set Headers
364
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
365
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
366
+
367
+ # Serialize Request
368
+ request_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::CustomerSubscription.mapper()
369
+ request_content = @client.serialize(request_mapper, customer_creation_parameters)
370
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
371
+
372
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AzureStack/registrations/{registrationName}/customerSubscriptions/{customerSubscriptionName}'
373
+
374
+ request_url = @base_url || @client.base_url
375
+
376
+ options = {
377
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
378
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroup' => resource_group,'registrationName' => registration_name,'customerSubscriptionName' => customer_subscription_name},
379
+ query_params: {'api-version' => @client.api_version},
380
+ body: request_content,
381
+ headers: request_headers.merge(custom_headers || {}),
382
+ base_url: request_url
383
+ }
384
+ promise = @client.make_request_async(:put, path_template, options)
385
+
386
+ promise = promise.then do |result|
387
+ http_response = result.response
388
+ status_code = http_response.status
389
+ response_content = http_response.body
390
+ unless status_code == 200
391
+ error_model = JSON.load(response_content)
392
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
393
+ end
394
+
395
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
396
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
397
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
398
+ # Deserialize Response
399
+ if status_code == 200
400
+ begin
401
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
402
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::CustomerSubscription.mapper()
403
+ result.body = @client.deserialize(result_mapper, parsed_response)
404
+ rescue Exception => e
405
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
406
+ end
407
+ end
408
+
409
+ result
410
+ end
411
+
412
+ promise.execute
413
+ end
414
+
415
+ #
416
+ # Returns a list of products.
417
+ #
418
+ # @param next_page_link [String] The NextLink from the previous successful call
419
+ # to List operation.
420
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
421
+ # will be added to the HTTP request.
422
+ #
423
+ # @return [CustomerSubscriptionList] operation results.
424
+ #
425
+ def list_next(next_page_link, custom_headers:nil)
426
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
427
+ response.body unless response.nil?
428
+ end
429
+
430
+ #
431
+ # Returns a list of products.
432
+ #
433
+ # @param next_page_link [String] The NextLink from the previous successful call
434
+ # to List operation.
435
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
436
+ # will be added to the HTTP request.
437
+ #
438
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
439
+ #
440
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
441
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
442
+ end
443
+
444
+ #
445
+ # Returns a list of products.
446
+ #
447
+ # @param next_page_link [String] The NextLink from the previous successful call
448
+ # to List operation.
449
+ # @param [Hash{String => String}] A hash of custom headers that will be added
450
+ # to the HTTP request.
451
+ #
452
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
453
+ #
454
+ def list_next_async(next_page_link, custom_headers:nil)
455
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
456
+
457
+
458
+ request_headers = {}
459
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
460
+
461
+ # Set Headers
462
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
463
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
464
+ path_template = '{nextLink}'
465
+
466
+ request_url = @base_url || @client.base_url
467
+
468
+ options = {
469
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
470
+ skip_encoding_path_params: {'nextLink' => next_page_link},
471
+ headers: request_headers.merge(custom_headers || {}),
472
+ base_url: request_url
473
+ }
474
+ promise = @client.make_request_async(:get, path_template, options)
475
+
476
+ promise = promise.then do |result|
477
+ http_response = result.response
478
+ status_code = http_response.status
479
+ response_content = http_response.body
480
+ unless status_code == 200
481
+ error_model = JSON.load(response_content)
482
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
483
+ end
484
+
485
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
486
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
487
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
488
+ # Deserialize Response
489
+ if status_code == 200
490
+ begin
491
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
492
+ result_mapper = Azure::AzureStack::Mgmt::V2017_06_01::Models::CustomerSubscriptionList.mapper()
493
+ result.body = @client.deserialize(result_mapper, parsed_response)
494
+ rescue Exception => e
495
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
496
+ end
497
+ end
498
+
499
+ result
500
+ end
501
+
502
+ promise.execute
503
+ end
504
+
505
+ #
506
+ # Returns a list of products.
507
+ #
508
+ # @param resource_group [String] Name of the resource group.
509
+ # @param registration_name [String] Name of the Azure Stack registration.
510
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
511
+ # will be added to the HTTP request.
512
+ #
513
+ # @return [CustomerSubscriptionList] which provide lazy access to pages of the
514
+ # response.
515
+ #
516
+ def list_as_lazy(resource_group, registration_name, custom_headers:nil)
517
+ response = list_async(resource_group, registration_name, custom_headers:custom_headers).value!
518
+ unless response.nil?
519
+ page = response.body
520
+ page.next_method = Proc.new do |next_page_link|
521
+ list_next_async(next_page_link, custom_headers:custom_headers)
522
+ end
523
+ page
524
+ end
525
+ end
526
+
527
+ end
528
+ end