azure_mgmt_subscriptions 0.17.3 → 0.18.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.
- checksums.yaml +4 -4
- data/lib/2016-06-01/generated/azure_mgmt_subscriptions/operations.rb +4 -0
- data/lib/2016-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
- data/lib/2016-06-01/generated/azure_mgmt_subscriptions/subscriptions.rb +8 -0
- data/lib/2016-06-01/generated/azure_mgmt_subscriptions/tenants.rb +4 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_subscriptions/subscription_definitions.rb +10 -0
- data/lib/2017-11-01-preview/generated/azure_mgmt_subscriptions/subscription_definitions_client.rb +1 -1
- data/lib/2017-11-01-preview/generated/azure_mgmt_subscriptions/subscription_definitions_operation_metadata.rb +4 -0
- data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions.rb +3 -7
- data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/models/ad_principal.rb +2 -1
- data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/models/subscription_creation_result.rb +2 -1
- data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -5
- data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/subscription_factory.rb +2 -0
- data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/subscription_operations.rb +2 -0
- data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions.rb +38 -0
- data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/ad_principal.rb +47 -0
- data/lib/{2015-11-01/generated/azure_mgmt_subscriptions/models/tenant_id_description.rb → 2018-11-01-preview/generated/azure_mgmt_subscriptions/models/error_response.rb} +14 -14
- data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/modern_subscription_creation_parameters.rb +129 -0
- data/lib/{2018-03-01-preview → 2018-11-01-preview}/generated/azure_mgmt_subscriptions/models/operation.rb +1 -1
- data/lib/{2018-03-01-preview → 2018-11-01-preview}/generated/azure_mgmt_subscriptions/models/operation_display.rb +1 -1
- data/lib/{2018-03-01-preview → 2018-11-01-preview}/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +1 -1
- data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/subscription_creation_result.rb +47 -0
- data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/subscription_operation.rb +69 -0
- data/lib/{2015-11-01/generated/azure_mgmt_subscriptions/models/location_list_result.rb → 2018-11-01-preview/generated/azure_mgmt_subscriptions/models/subscription_operation_list_result.rb} +10 -9
- data/lib/{2015-11-01 → 2018-11-01-preview}/generated/azure_mgmt_subscriptions/module_definition.rb +1 -1
- data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +134 -0
- data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/subscription_factory.rb +189 -0
- data/lib/{2018-03-01-preview/generated/azure_mgmt_subscriptions/operations.rb → 2018-11-01-preview/generated/azure_mgmt_subscriptions/subscription_operation_operations.rb} +26 -16
- data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions.rb +35 -0
- data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/canceled_subscription_id.rb +47 -0
- data/lib/{2015-11-01/generated/azure_mgmt_subscriptions/models/subscription_policies.rb → 2019-03-01-preview/generated/azure_mgmt_subscriptions/models/error_response.rb} +14 -14
- data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
- data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/operation_display.rb +69 -0
- data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +68 -0
- data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/renamed_subscription_id.rb +47 -0
- data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/subscription_name.rb +46 -0
- data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
- data/lib/{2015-11-01 → 2019-03-01-preview}/generated/azure_mgmt_subscriptions/subscription_client.rb +5 -8
- data/lib/{2015-11-01/generated/azure_mgmt_subscriptions/tenants.rb → 2019-03-01-preview/generated/azure_mgmt_subscriptions/subscriptions.rb} +59 -59
- data/lib/azure_mgmt_subscriptions.rb +4 -3
- data/lib/profiles/latest/modules/subscriptions_profile_module.rb +110 -16
- data/lib/version.rb +1 -1
- metadata +30 -21
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions.rb +0 -36
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/location.rb +0 -102
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/subscription.rb +0 -92
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/subscription_list_result.rb +0 -98
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/models/tenant_list_result.rb +0 -98
- data/lib/2015-11-01/generated/azure_mgmt_subscriptions/subscriptions.rb +0 -389
@@ -3,7 +3,7 @@
|
|
3
3
|
# Changes may cause incorrect behavior and will be lost if the code is
|
4
4
|
# regenerated.
|
5
5
|
|
6
|
-
module Azure::Subscriptions::Mgmt::
|
6
|
+
module Azure::Subscriptions::Mgmt::V2018_11_01_preview
|
7
7
|
module Models
|
8
8
|
#
|
9
9
|
# The object that represents the operation.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Changes may cause incorrect behavior and will be lost if the code is
|
4
4
|
# regenerated.
|
5
5
|
|
6
|
-
module Azure::Subscriptions::Mgmt::
|
6
|
+
module Azure::Subscriptions::Mgmt::V2018_11_01_preview
|
7
7
|
module Models
|
8
8
|
#
|
9
9
|
# Result of the request to list operations. It contains a list of
|
@@ -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
|
+
module Azure::Subscriptions::Mgmt::V2018_11_01_preview
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# The created subscription object.
|
10
|
+
#
|
11
|
+
class SubscriptionCreationResult
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] The link to the new subscription. Use this link to
|
16
|
+
# check the status of subscription creation operation.
|
17
|
+
attr_accessor :subscription_link
|
18
|
+
|
19
|
+
|
20
|
+
#
|
21
|
+
# Mapper for SubscriptionCreationResult class as Ruby Hash.
|
22
|
+
# This will be used for serialization/deserialization.
|
23
|
+
#
|
24
|
+
def self.mapper()
|
25
|
+
{
|
26
|
+
client_side_validation: true,
|
27
|
+
required: false,
|
28
|
+
serialized_name: 'SubscriptionCreationResult',
|
29
|
+
type: {
|
30
|
+
name: 'Composite',
|
31
|
+
class_name: 'SubscriptionCreationResult',
|
32
|
+
model_properties: {
|
33
|
+
subscription_link: {
|
34
|
+
client_side_validation: true,
|
35
|
+
required: false,
|
36
|
+
serialized_name: 'subscriptionLink',
|
37
|
+
type: {
|
38
|
+
name: 'String'
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/subscription_operation.rb
ADDED
@@ -0,0 +1,69 @@
|
|
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::Subscriptions::Mgmt::V2018_11_01_preview
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# status of the subscription POST operation.
|
10
|
+
#
|
11
|
+
class SubscriptionOperation
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] The operation Id.
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# @return [String] Status of the pending subscription
|
19
|
+
attr_accessor :status
|
20
|
+
|
21
|
+
# @return [String] Status Detail of the pending subscription
|
22
|
+
attr_accessor :status_detail
|
23
|
+
|
24
|
+
|
25
|
+
#
|
26
|
+
# Mapper for SubscriptionOperation class as Ruby Hash.
|
27
|
+
# This will be used for serialization/deserialization.
|
28
|
+
#
|
29
|
+
def self.mapper()
|
30
|
+
{
|
31
|
+
client_side_validation: true,
|
32
|
+
required: false,
|
33
|
+
serialized_name: 'SubscriptionOperation',
|
34
|
+
type: {
|
35
|
+
name: 'Composite',
|
36
|
+
class_name: 'SubscriptionOperation',
|
37
|
+
model_properties: {
|
38
|
+
id: {
|
39
|
+
client_side_validation: true,
|
40
|
+
required: false,
|
41
|
+
read_only: true,
|
42
|
+
serialized_name: 'id',
|
43
|
+
type: {
|
44
|
+
name: 'String'
|
45
|
+
}
|
46
|
+
},
|
47
|
+
status: {
|
48
|
+
client_side_validation: true,
|
49
|
+
required: false,
|
50
|
+
serialized_name: 'status',
|
51
|
+
type: {
|
52
|
+
name: 'String'
|
53
|
+
}
|
54
|
+
},
|
55
|
+
status_detail: {
|
56
|
+
client_side_validation: true,
|
57
|
+
required: false,
|
58
|
+
serialized_name: 'statusDetail',
|
59
|
+
type: {
|
60
|
+
name: 'String'
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -3,31 +3,32 @@
|
|
3
3
|
# Changes may cause incorrect behavior and will be lost if the code is
|
4
4
|
# regenerated.
|
5
5
|
|
6
|
-
module Azure::Subscriptions::Mgmt::
|
6
|
+
module Azure::Subscriptions::Mgmt::V2018_11_01_preview
|
7
7
|
module Models
|
8
8
|
#
|
9
|
-
#
|
9
|
+
# A list of pending subscription operations.
|
10
10
|
#
|
11
|
-
class
|
11
|
+
class SubscriptionOperationListResult
|
12
12
|
|
13
13
|
include MsRestAzure
|
14
14
|
|
15
|
-
# @return [Array<
|
15
|
+
# @return [Array<SubscriptionOperation>] A list of pending
|
16
|
+
# SubscriptionOperations
|
16
17
|
attr_accessor :value
|
17
18
|
|
18
19
|
|
19
20
|
#
|
20
|
-
# Mapper for
|
21
|
+
# Mapper for SubscriptionOperationListResult class as Ruby Hash.
|
21
22
|
# This will be used for serialization/deserialization.
|
22
23
|
#
|
23
24
|
def self.mapper()
|
24
25
|
{
|
25
26
|
client_side_validation: true,
|
26
27
|
required: false,
|
27
|
-
serialized_name: '
|
28
|
+
serialized_name: 'SubscriptionOperationListResult',
|
28
29
|
type: {
|
29
30
|
name: 'Composite',
|
30
|
-
class_name: '
|
31
|
+
class_name: 'SubscriptionOperationListResult',
|
31
32
|
model_properties: {
|
32
33
|
value: {
|
33
34
|
client_side_validation: true,
|
@@ -38,10 +39,10 @@ module Azure::Subscriptions::Mgmt::V2015_11_01
|
|
38
39
|
element: {
|
39
40
|
client_side_validation: true,
|
40
41
|
required: false,
|
41
|
-
serialized_name: '
|
42
|
+
serialized_name: 'SubscriptionOperationElementType',
|
42
43
|
type: {
|
43
44
|
name: 'Composite',
|
44
|
-
class_name: '
|
45
|
+
class_name: 'SubscriptionOperation'
|
45
46
|
}
|
46
47
|
}
|
47
48
|
}
|
@@ -0,0 +1,134 @@
|
|
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::Subscriptions::Mgmt::V2018_11_01_preview
|
7
|
+
#
|
8
|
+
# A service client - single point of access to the REST API.
|
9
|
+
#
|
10
|
+
class SubscriptionClient < 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] Version of the API to be used with the client request.
|
21
|
+
# Current version is 2018-11-01-preview
|
22
|
+
attr_reader :api_version
|
23
|
+
|
24
|
+
# @return [String] The preferred language for the response.
|
25
|
+
attr_accessor :accept_language
|
26
|
+
|
27
|
+
# @return [Integer] The retry timeout in seconds for Long Running
|
28
|
+
# Operations. Default value is 30.
|
29
|
+
attr_accessor :long_running_operation_retry_timeout
|
30
|
+
|
31
|
+
# @return [Boolean] Whether a unique x-ms-client-request-id should be
|
32
|
+
# generated. When set to true a unique x-ms-client-request-id value is
|
33
|
+
# generated and included in each request. Default is true.
|
34
|
+
attr_accessor :generate_client_request_id
|
35
|
+
|
36
|
+
# @return [SubscriptionOperationOperations]
|
37
|
+
# subscription_operation_operations
|
38
|
+
attr_reader :subscription_operation_operations
|
39
|
+
|
40
|
+
# @return [SubscriptionFactory] subscription_factory
|
41
|
+
attr_reader :subscription_factory
|
42
|
+
|
43
|
+
#
|
44
|
+
# Creates initializes a new instance of the SubscriptionClient class.
|
45
|
+
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
|
46
|
+
# @param base_url [String] the base URI of the service.
|
47
|
+
# @param options [Array] filters to be applied to the HTTP requests.
|
48
|
+
#
|
49
|
+
def initialize(credentials = nil, base_url = nil, options = nil)
|
50
|
+
super(credentials, options)
|
51
|
+
@base_url = base_url || 'https://management.azure.com'
|
52
|
+
|
53
|
+
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
|
54
|
+
@credentials = credentials
|
55
|
+
|
56
|
+
@subscription_operation_operations = SubscriptionOperationOperations.new(self)
|
57
|
+
@subscription_factory = SubscriptionFactory.new(self)
|
58
|
+
@api_version = '2018-11-01-preview'
|
59
|
+
@accept_language = 'en-US'
|
60
|
+
@long_running_operation_retry_timeout = 30
|
61
|
+
@generate_client_request_id = true
|
62
|
+
add_telemetry
|
63
|
+
end
|
64
|
+
|
65
|
+
#
|
66
|
+
# Makes a request and returns the body of the response.
|
67
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
68
|
+
# @param path [String] the path, relative to {base_url}.
|
69
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
70
|
+
# @return [Hash{String=>String}] containing the body of the response.
|
71
|
+
# Example:
|
72
|
+
#
|
73
|
+
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
|
74
|
+
# path = "/path"
|
75
|
+
# options = {
|
76
|
+
# body: request_content,
|
77
|
+
# query_params: {'api-version' => '2016-02-01'}
|
78
|
+
# }
|
79
|
+
# result = @client.make_request(:put, path, options)
|
80
|
+
#
|
81
|
+
def make_request(method, path, options = {})
|
82
|
+
result = make_request_with_http_info(method, path, options)
|
83
|
+
result.body unless result.nil?
|
84
|
+
end
|
85
|
+
|
86
|
+
#
|
87
|
+
# Makes a request and returns the operation response.
|
88
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
89
|
+
# @param path [String] the path, relative to {base_url}.
|
90
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
91
|
+
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
|
92
|
+
#
|
93
|
+
def make_request_with_http_info(method, path, options = {})
|
94
|
+
result = make_request_async(method, path, options).value!
|
95
|
+
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
|
96
|
+
result
|
97
|
+
end
|
98
|
+
|
99
|
+
#
|
100
|
+
# Makes a request asynchronously.
|
101
|
+
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
|
102
|
+
# @param path [String] the path, relative to {base_url}.
|
103
|
+
# @param options [Hash{String=>String}] specifying any request options like :body.
|
104
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
105
|
+
#
|
106
|
+
def make_request_async(method, path, options = {})
|
107
|
+
fail ArgumentError, 'method is nil' if method.nil?
|
108
|
+
fail ArgumentError, 'path is nil' if path.nil?
|
109
|
+
|
110
|
+
request_url = options[:base_url] || @base_url
|
111
|
+
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
|
112
|
+
@request_headers['Content-Type'] = options[:headers]['Content-Type']
|
113
|
+
end
|
114
|
+
|
115
|
+
request_headers = @request_headers
|
116
|
+
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
|
117
|
+
options.merge!({headers: request_headers.merge(options[:headers] || {})})
|
118
|
+
options.merge!({credentials: @credentials}) unless @credentials.nil?
|
119
|
+
|
120
|
+
super(request_url, method, path, options)
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
private
|
125
|
+
#
|
126
|
+
# Adds telemetry information.
|
127
|
+
#
|
128
|
+
def add_telemetry
|
129
|
+
sdk_information = 'azure_mgmt_subscriptions'
|
130
|
+
sdk_information = "#{sdk_information}/0.18.0"
|
131
|
+
add_user_agent_information(sdk_information)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,189 @@
|
|
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::Subscriptions::Mgmt::V2018_11_01_preview
|
7
|
+
#
|
8
|
+
# Subscription client provides an interface to create and manage Azure
|
9
|
+
# subscriptions programmatically.
|
10
|
+
#
|
11
|
+
class SubscriptionFactory
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the SubscriptionFactory class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [SubscriptionClient] reference to the SubscriptionClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# The operation to create a new Azure subscription
|
27
|
+
#
|
28
|
+
# @param billing_account_name [String] The name of the Microsoft Customer
|
29
|
+
# Agreement billing account for which you want to create the subscription.
|
30
|
+
# @param invoice_section_name [String] The name of the invoice section in the
|
31
|
+
# billing account for which you want to create the subscription.
|
32
|
+
# @param body [ModernSubscriptionCreationParameters] The subscription creation
|
33
|
+
# parameters.
|
34
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
35
|
+
# will be added to the HTTP request.
|
36
|
+
#
|
37
|
+
# @return [SubscriptionCreationResult] operation results.
|
38
|
+
#
|
39
|
+
def create_subscription(billing_account_name, invoice_section_name, body, custom_headers:nil)
|
40
|
+
response = create_subscription_async(billing_account_name, invoice_section_name, body, custom_headers:custom_headers).value!
|
41
|
+
response.body unless response.nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
# @param billing_account_name [String] The name of the Microsoft Customer
|
46
|
+
# Agreement billing account for which you want to create the subscription.
|
47
|
+
# @param invoice_section_name [String] The name of the invoice section in the
|
48
|
+
# billing account for which you want to create the subscription.
|
49
|
+
# @param body [ModernSubscriptionCreationParameters] The subscription creation
|
50
|
+
# parameters.
|
51
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
52
|
+
# will be added to the HTTP request.
|
53
|
+
#
|
54
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
55
|
+
# response.
|
56
|
+
#
|
57
|
+
def create_subscription_async(billing_account_name, invoice_section_name, body, custom_headers:nil)
|
58
|
+
# Send request
|
59
|
+
promise = begin_create_subscription_async(billing_account_name, invoice_section_name, body, custom_headers:custom_headers)
|
60
|
+
|
61
|
+
promise = promise.then do |response|
|
62
|
+
# Defining deserialization method.
|
63
|
+
deserialize_method = lambda do |parsed_response|
|
64
|
+
result_mapper = Azure::Subscriptions::Mgmt::V2018_11_01_preview::Models::SubscriptionCreationResult.mapper()
|
65
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Waiting for response.
|
69
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
70
|
+
end
|
71
|
+
|
72
|
+
promise
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# The operation to create a new Azure subscription
|
77
|
+
#
|
78
|
+
# @param billing_account_name [String] The name of the Microsoft Customer
|
79
|
+
# Agreement billing account for which you want to create the subscription.
|
80
|
+
# @param invoice_section_name [String] The name of the invoice section in the
|
81
|
+
# billing account for which you want to create the subscription.
|
82
|
+
# @param body [ModernSubscriptionCreationParameters] The subscription creation
|
83
|
+
# parameters.
|
84
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
85
|
+
# will be added to the HTTP request.
|
86
|
+
#
|
87
|
+
# @return [SubscriptionCreationResult] operation results.
|
88
|
+
#
|
89
|
+
def begin_create_subscription(billing_account_name, invoice_section_name, body, custom_headers:nil)
|
90
|
+
response = begin_create_subscription_async(billing_account_name, invoice_section_name, body, custom_headers:custom_headers).value!
|
91
|
+
response.body unless response.nil?
|
92
|
+
end
|
93
|
+
|
94
|
+
#
|
95
|
+
# The operation to create a new Azure subscription
|
96
|
+
#
|
97
|
+
# @param billing_account_name [String] The name of the Microsoft Customer
|
98
|
+
# Agreement billing account for which you want to create the subscription.
|
99
|
+
# @param invoice_section_name [String] The name of the invoice section in the
|
100
|
+
# billing account for which you want to create the subscription.
|
101
|
+
# @param body [ModernSubscriptionCreationParameters] The subscription creation
|
102
|
+
# parameters.
|
103
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
104
|
+
# will be added to the HTTP request.
|
105
|
+
#
|
106
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
107
|
+
#
|
108
|
+
def begin_create_subscription_with_http_info(billing_account_name, invoice_section_name, body, custom_headers:nil)
|
109
|
+
begin_create_subscription_async(billing_account_name, invoice_section_name, body, custom_headers:custom_headers).value!
|
110
|
+
end
|
111
|
+
|
112
|
+
#
|
113
|
+
# The operation to create a new Azure subscription
|
114
|
+
#
|
115
|
+
# @param billing_account_name [String] The name of the Microsoft Customer
|
116
|
+
# Agreement billing account for which you want to create the subscription.
|
117
|
+
# @param invoice_section_name [String] The name of the invoice section in the
|
118
|
+
# billing account for which you want to create the subscription.
|
119
|
+
# @param body [ModernSubscriptionCreationParameters] The subscription creation
|
120
|
+
# parameters.
|
121
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
122
|
+
# to the HTTP request.
|
123
|
+
#
|
124
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
125
|
+
#
|
126
|
+
def begin_create_subscription_async(billing_account_name, invoice_section_name, body, custom_headers:nil)
|
127
|
+
fail ArgumentError, 'billing_account_name is nil' if billing_account_name.nil?
|
128
|
+
fail ArgumentError, 'invoice_section_name is nil' if invoice_section_name.nil?
|
129
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
130
|
+
fail ArgumentError, 'body is nil' if body.nil?
|
131
|
+
|
132
|
+
|
133
|
+
request_headers = {}
|
134
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
135
|
+
|
136
|
+
# Set Headers
|
137
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
138
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
139
|
+
|
140
|
+
# Serialize Request
|
141
|
+
request_mapper = Azure::Subscriptions::Mgmt::V2018_11_01_preview::Models::ModernSubscriptionCreationParameters.mapper()
|
142
|
+
request_content = @client.serialize(request_mapper, body)
|
143
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
144
|
+
|
145
|
+
path_template = 'providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription'
|
146
|
+
|
147
|
+
request_url = @base_url || @client.base_url
|
148
|
+
|
149
|
+
options = {
|
150
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
151
|
+
path_params: {'billingAccountName' => billing_account_name,'invoiceSectionName' => invoice_section_name},
|
152
|
+
query_params: {'api-version' => @client.api_version},
|
153
|
+
body: request_content,
|
154
|
+
headers: request_headers.merge(custom_headers || {}),
|
155
|
+
base_url: request_url
|
156
|
+
}
|
157
|
+
promise = @client.make_request_async(:post, path_template, options)
|
158
|
+
|
159
|
+
promise = promise.then do |result|
|
160
|
+
http_response = result.response
|
161
|
+
status_code = http_response.status
|
162
|
+
response_content = http_response.body
|
163
|
+
unless status_code == 200 || status_code == 202
|
164
|
+
error_model = JSON.load(response_content)
|
165
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
166
|
+
end
|
167
|
+
|
168
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
169
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
170
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
171
|
+
# Deserialize Response
|
172
|
+
if status_code == 200
|
173
|
+
begin
|
174
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
175
|
+
result_mapper = Azure::Subscriptions::Mgmt::V2018_11_01_preview::Models::SubscriptionCreationResult.mapper()
|
176
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
177
|
+
rescue Exception => e
|
178
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
result
|
183
|
+
end
|
184
|
+
|
185
|
+
promise.execute
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
end
|