azure_mgmt_reservations 0.19.2 → 0.20.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/2017-11-01/generated/azure_mgmt_reservations/reservations_management_client.rb +1 -1
- data/lib/2018-06-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +1 -1
- data/lib/2019-04-01-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +1 -1
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations.rb +15 -19
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/auto_quota_increase.rb +0 -18
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/{on_failure.rb → actions.rb} +6 -20
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/auto_quota_increase_detail.rb +4 -4
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/current_quota_limit.rb +3 -76
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/current_quota_limit_base.rb +3 -76
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/email_actions.rb +4 -5
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_properties.rb +120 -0
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/quota_request_one_resource_submit_response.rb +3 -76
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/{current_quota_limit_base_name.rb → resource_name.rb} +4 -4
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/sub_request.rb +2 -2
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/support_request_action.rb +0 -11
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quota.rb +692 -31
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/{quota_requests.rb → quota_request_status.rb} +30 -74
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/reservations_management_client.rb +5 -13
- data/lib/profiles/latest/modules/reservations_profile_module.rb +47 -59
- data/lib/version.rb +1 -1
- metadata +6 -10
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/on_failure_email_actions.rb +0 -55
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/on_failure_phone_actions.rb +0 -55
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/sub_request_name.rb +0 -59
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quota_request.rb +0 -519
- data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/quotas.rb +0 -269
@@ -0,0 +1,120 @@
|
|
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::Reservations::Mgmt::V2019_07_19_preview
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Quota properties for the resource.
|
10
|
+
#
|
11
|
+
class QuotaProperties
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [Integer] The quota limit.
|
16
|
+
attr_accessor :limit
|
17
|
+
|
18
|
+
# @return [Integer] The current resource usages information.
|
19
|
+
attr_accessor :current_value
|
20
|
+
|
21
|
+
# @return [String] The units of the limit, such as - Count, Bytes, etc.
|
22
|
+
# Use the unit field provided in the Get quota response.
|
23
|
+
attr_accessor :unit
|
24
|
+
|
25
|
+
# @return [ResourceName] Name of the resource provide by the resource
|
26
|
+
# Provider. Please use this name property for quotaRequests.
|
27
|
+
attr_accessor :name
|
28
|
+
|
29
|
+
# @return The Resource Type Name.
|
30
|
+
attr_accessor :resource_type
|
31
|
+
|
32
|
+
# @return [String] The quota period over which the usage values are
|
33
|
+
# summarized, such as - P1D (Per one day), PT1M (Per one minute), PT1S
|
34
|
+
# (Per one second). This parameter is optional because, for some
|
35
|
+
# resources like compute, the period doesn’t matter.
|
36
|
+
attr_accessor :quota_period
|
37
|
+
|
38
|
+
# @return Additional properties for the specific resource provider.
|
39
|
+
attr_accessor :properties
|
40
|
+
|
41
|
+
|
42
|
+
#
|
43
|
+
# Mapper for QuotaProperties class as Ruby Hash.
|
44
|
+
# This will be used for serialization/deserialization.
|
45
|
+
#
|
46
|
+
def self.mapper()
|
47
|
+
{
|
48
|
+
client_side_validation: true,
|
49
|
+
required: false,
|
50
|
+
serialized_name: 'QuotaProperties',
|
51
|
+
type: {
|
52
|
+
name: 'Composite',
|
53
|
+
class_name: 'QuotaProperties',
|
54
|
+
model_properties: {
|
55
|
+
limit: {
|
56
|
+
client_side_validation: true,
|
57
|
+
required: false,
|
58
|
+
serialized_name: 'limit',
|
59
|
+
type: {
|
60
|
+
name: 'Number'
|
61
|
+
}
|
62
|
+
},
|
63
|
+
current_value: {
|
64
|
+
client_side_validation: true,
|
65
|
+
required: false,
|
66
|
+
read_only: true,
|
67
|
+
serialized_name: 'currentValue',
|
68
|
+
type: {
|
69
|
+
name: 'Number'
|
70
|
+
}
|
71
|
+
},
|
72
|
+
unit: {
|
73
|
+
client_side_validation: true,
|
74
|
+
required: false,
|
75
|
+
serialized_name: 'unit',
|
76
|
+
type: {
|
77
|
+
name: 'String'
|
78
|
+
}
|
79
|
+
},
|
80
|
+
name: {
|
81
|
+
client_side_validation: true,
|
82
|
+
required: false,
|
83
|
+
serialized_name: 'name',
|
84
|
+
type: {
|
85
|
+
name: 'Composite',
|
86
|
+
class_name: 'ResourceName'
|
87
|
+
}
|
88
|
+
},
|
89
|
+
resource_type: {
|
90
|
+
client_side_validation: true,
|
91
|
+
required: false,
|
92
|
+
serialized_name: 'resourceType',
|
93
|
+
type: {
|
94
|
+
name: 'Object'
|
95
|
+
}
|
96
|
+
},
|
97
|
+
quota_period: {
|
98
|
+
client_side_validation: true,
|
99
|
+
required: false,
|
100
|
+
read_only: true,
|
101
|
+
serialized_name: 'quotaPeriod',
|
102
|
+
type: {
|
103
|
+
name: 'String'
|
104
|
+
}
|
105
|
+
},
|
106
|
+
properties: {
|
107
|
+
client_side_validation: true,
|
108
|
+
required: false,
|
109
|
+
serialized_name: 'properties',
|
110
|
+
type: {
|
111
|
+
name: 'Object'
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -32,30 +32,7 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
32
32
|
# standard.
|
33
33
|
attr_accessor :request_submit_time
|
34
34
|
|
35
|
-
# @return [
|
36
|
-
attr_accessor :limit
|
37
|
-
|
38
|
-
# @return [Integer] The current resource usages information.
|
39
|
-
attr_accessor :current_value
|
40
|
-
|
41
|
-
# @return [String] The units of the limit, such as - Count, Bytes, etc.
|
42
|
-
# Use the unit field provided in the Get quota response.
|
43
|
-
attr_accessor :unit
|
44
|
-
|
45
|
-
# @return [CurrentQuotaLimitBaseName] Name of the resource provide by the
|
46
|
-
# resource Provider. Please use this name property for quotaRequests.
|
47
|
-
attr_accessor :name1
|
48
|
-
|
49
|
-
# @return The Resource Type Name.
|
50
|
-
attr_accessor :resource_type
|
51
|
-
|
52
|
-
# @return [String] The quota period over which the usage values are
|
53
|
-
# summarized, such as - P1D (Per one day), PT1M (Per one minute), PT1S
|
54
|
-
# (Per one second). This parameter is optional because, for some
|
55
|
-
# resources like compute, the period doesn’t matter.
|
56
|
-
attr_accessor :quota_period
|
57
|
-
|
58
|
-
# @return Additional properties for the specific resource provider.
|
35
|
+
# @return [QuotaProperties] Quota properties for the resource.
|
59
36
|
attr_accessor :properties
|
60
37
|
|
61
38
|
|
@@ -126,63 +103,13 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
126
103
|
name: 'DateTime'
|
127
104
|
}
|
128
105
|
},
|
129
|
-
limit: {
|
130
|
-
client_side_validation: true,
|
131
|
-
required: false,
|
132
|
-
serialized_name: 'properties.properties.limit',
|
133
|
-
type: {
|
134
|
-
name: 'Number'
|
135
|
-
}
|
136
|
-
},
|
137
|
-
current_value: {
|
138
|
-
client_side_validation: true,
|
139
|
-
required: false,
|
140
|
-
read_only: true,
|
141
|
-
serialized_name: 'properties.properties.currentValue',
|
142
|
-
type: {
|
143
|
-
name: 'Number'
|
144
|
-
}
|
145
|
-
},
|
146
|
-
unit: {
|
147
|
-
client_side_validation: true,
|
148
|
-
required: false,
|
149
|
-
serialized_name: 'properties.properties.unit',
|
150
|
-
type: {
|
151
|
-
name: 'String'
|
152
|
-
}
|
153
|
-
},
|
154
|
-
name1: {
|
155
|
-
client_side_validation: true,
|
156
|
-
required: false,
|
157
|
-
serialized_name: 'properties.properties.name',
|
158
|
-
type: {
|
159
|
-
name: 'Composite',
|
160
|
-
class_name: 'CurrentQuotaLimitBaseName'
|
161
|
-
}
|
162
|
-
},
|
163
|
-
resource_type: {
|
164
|
-
client_side_validation: true,
|
165
|
-
required: false,
|
166
|
-
serialized_name: 'properties.properties.resourceType',
|
167
|
-
type: {
|
168
|
-
name: 'Object'
|
169
|
-
}
|
170
|
-
},
|
171
|
-
quota_period: {
|
172
|
-
client_side_validation: true,
|
173
|
-
required: false,
|
174
|
-
read_only: true,
|
175
|
-
serialized_name: 'properties.properties.quotaPeriod',
|
176
|
-
type: {
|
177
|
-
name: 'String'
|
178
|
-
}
|
179
|
-
},
|
180
106
|
properties: {
|
181
107
|
client_side_validation: true,
|
182
108
|
required: false,
|
183
109
|
serialized_name: 'properties.properties.properties',
|
184
110
|
type: {
|
185
|
-
name: '
|
111
|
+
name: 'Composite',
|
112
|
+
class_name: 'QuotaProperties'
|
186
113
|
}
|
187
114
|
}
|
188
115
|
}
|
@@ -9,7 +9,7 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
9
9
|
# Name of the resource provide by the resource Provider. Please use this
|
10
10
|
# name property for quotaRequests.
|
11
11
|
#
|
12
|
-
class
|
12
|
+
class ResourceName
|
13
13
|
|
14
14
|
include MsRestAzure
|
15
15
|
|
@@ -21,17 +21,17 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
21
21
|
|
22
22
|
|
23
23
|
#
|
24
|
-
# Mapper for
|
24
|
+
# Mapper for ResourceName class as Ruby Hash.
|
25
25
|
# This will be used for serialization/deserialization.
|
26
26
|
#
|
27
27
|
def self.mapper()
|
28
28
|
{
|
29
29
|
client_side_validation: true,
|
30
30
|
required: false,
|
31
|
-
serialized_name: '
|
31
|
+
serialized_name: 'ResourceName',
|
32
32
|
type: {
|
33
33
|
name: 'Composite',
|
34
|
-
class_name: '
|
34
|
+
class_name: 'ResourceName',
|
35
35
|
model_properties: {
|
36
36
|
value: {
|
37
37
|
client_side_validation: true,
|
@@ -15,7 +15,7 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
15
15
|
# @return [Integer] The Resource limit.
|
16
16
|
attr_accessor :limit
|
17
17
|
|
18
|
-
# @return [
|
18
|
+
# @return [ResourceName] The Resource name.
|
19
19
|
attr_accessor :name
|
20
20
|
|
21
21
|
# @return [String] Resource type for which the quota check was made.
|
@@ -63,7 +63,7 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
63
63
|
serialized_name: 'name',
|
64
64
|
type: {
|
65
65
|
name: 'Composite',
|
66
|
-
class_name: '
|
66
|
+
class_name: 'ResourceName'
|
67
67
|
}
|
68
68
|
},
|
69
69
|
resource_type: {
|
data/lib/2019-07-19-preview/generated/azure_mgmt_reservations/models/support_request_action.rb
CHANGED
@@ -12,9 +12,6 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
12
12
|
|
13
13
|
include MsRestAzure
|
14
14
|
|
15
|
-
# @return Is support request action enabled.
|
16
|
-
attr_accessor :auto_quota_increase_state
|
17
|
-
|
18
15
|
# @return The support request severity.
|
19
16
|
attr_accessor :severity
|
20
17
|
|
@@ -56,14 +53,6 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
56
53
|
name: 'Composite',
|
57
54
|
class_name: 'SupportRequestAction',
|
58
55
|
model_properties: {
|
59
|
-
auto_quota_increase_state: {
|
60
|
-
client_side_validation: true,
|
61
|
-
required: false,
|
62
|
-
serialized_name: 'autoQuotaIncreaseState',
|
63
|
-
type: {
|
64
|
-
name: 'Object'
|
65
|
-
}
|
66
|
-
},
|
67
56
|
severity: {
|
68
57
|
client_side_validation: true,
|
69
58
|
required: false,
|
@@ -22,74 +22,602 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
22
22
|
attr_reader :client
|
23
23
|
|
24
24
|
#
|
25
|
-
# Gets the current
|
26
|
-
#
|
27
|
-
#
|
28
|
-
# This API gets the current quota limit and usages for the specific resource
|
29
|
-
# for resource provider for the specified location. This response can be used
|
30
|
-
# to submit quotaRequests.
|
25
|
+
# Gets the current service limits (quotas) and usage of a resource. The
|
26
|
+
# response from Get API can be leveraged to submit quota update requests.
|
31
27
|
#
|
32
28
|
# @param subscription_id [String] Azure subscription id.
|
33
|
-
# @param provider_id [String] Azure resource
|
29
|
+
# @param provider_id [String] Azure resource provider id.
|
34
30
|
# @param location [String] Azure region.
|
35
|
-
# @param resource_name [String] The
|
36
|
-
#
|
31
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
32
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
33
|
+
# Microsoft.MachineLearningServices
|
37
34
|
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
38
35
|
# will be added to the HTTP request.
|
39
36
|
#
|
40
37
|
# @return [CurrentQuotaLimitBase] operation results.
|
41
38
|
#
|
42
|
-
def
|
43
|
-
response =
|
39
|
+
def get(subscription_id, provider_id, location, resource_name, custom_headers:nil)
|
40
|
+
response = get_async(subscription_id, provider_id, location, resource_name, custom_headers:custom_headers).value!
|
44
41
|
response.body unless response.nil?
|
45
42
|
end
|
46
43
|
|
47
44
|
#
|
48
|
-
# Gets the current
|
49
|
-
#
|
45
|
+
# Gets the current service limits (quotas) and usage of a resource. The
|
46
|
+
# response from Get API can be leveraged to submit quota update requests.
|
47
|
+
#
|
48
|
+
# @param subscription_id [String] Azure subscription id.
|
49
|
+
# @param provider_id [String] Azure resource provider id.
|
50
|
+
# @param location [String] Azure region.
|
51
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
52
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
53
|
+
# Microsoft.MachineLearningServices
|
54
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
55
|
+
# will be added to the HTTP request.
|
56
|
+
#
|
57
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
58
|
+
#
|
59
|
+
def get_with_http_info(subscription_id, provider_id, location, resource_name, custom_headers:nil)
|
60
|
+
get_async(subscription_id, provider_id, location, resource_name, custom_headers:custom_headers).value!
|
61
|
+
end
|
62
|
+
|
50
63
|
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
# to submit quotaRequests.
|
64
|
+
# Gets the current service limits (quotas) and usage of a resource. The
|
65
|
+
# response from Get API can be leveraged to submit quota update requests.
|
54
66
|
#
|
55
67
|
# @param subscription_id [String] Azure subscription id.
|
56
|
-
# @param provider_id [String] Azure resource
|
68
|
+
# @param provider_id [String] Azure resource provider id.
|
69
|
+
# @param location [String] Azure region.
|
70
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
71
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
72
|
+
# Microsoft.MachineLearningServices
|
73
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
74
|
+
# to the HTTP request.
|
75
|
+
#
|
76
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
77
|
+
#
|
78
|
+
def get_async(subscription_id, provider_id, location, resource_name, custom_headers:nil)
|
79
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
80
|
+
fail ArgumentError, 'provider_id is nil' if provider_id.nil?
|
81
|
+
fail ArgumentError, 'location is nil' if location.nil?
|
82
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
83
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
84
|
+
|
85
|
+
|
86
|
+
request_headers = {}
|
87
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
88
|
+
|
89
|
+
# Set Headers
|
90
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
91
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
92
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'
|
93
|
+
|
94
|
+
request_url = @base_url || @client.base_url
|
95
|
+
|
96
|
+
options = {
|
97
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
98
|
+
path_params: {'subscriptionId' => subscription_id,'providerId' => provider_id,'location' => location,'resourceName' => resource_name},
|
99
|
+
query_params: {'api-version' => @client.api_version},
|
100
|
+
headers: request_headers.merge(custom_headers || {}),
|
101
|
+
base_url: request_url
|
102
|
+
}
|
103
|
+
promise = @client.make_request_async(:get, path_template, options)
|
104
|
+
|
105
|
+
promise = promise.then do |result|
|
106
|
+
http_response = result.response
|
107
|
+
status_code = http_response.status
|
108
|
+
response_content = http_response.body
|
109
|
+
unless status_code == 200
|
110
|
+
error_model = JSON.load(response_content)
|
111
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
112
|
+
end
|
113
|
+
|
114
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
115
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
116
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
117
|
+
# Deserialize Response
|
118
|
+
if status_code == 200
|
119
|
+
begin
|
120
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
121
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::CurrentQuotaLimitBase.mapper()
|
122
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
123
|
+
rescue Exception => e
|
124
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
result
|
129
|
+
end
|
130
|
+
|
131
|
+
promise.execute
|
132
|
+
end
|
133
|
+
|
134
|
+
#
|
135
|
+
# Create or update the service limits (quota) of a resource to requested value.
|
136
|
+
# Steps:
|
137
|
+
#
|
138
|
+
# 1. Make the Get request to get the quota information for specific resource.
|
139
|
+
#
|
140
|
+
# 2. To increase the quota, update the limit field in the response from Get
|
141
|
+
# request to new value.
|
142
|
+
#
|
143
|
+
# 3. Submit the JSON to the quota request API to update the quota.
|
144
|
+
# The Create quota request may be constructed as follows. The PUT operation can
|
145
|
+
# be used to update the quota.
|
146
|
+
#
|
147
|
+
# @param subscription_id [String] Azure subscription id.
|
148
|
+
# @param provider_id [String] Azure resource provider id.
|
149
|
+
# @param location [String] Azure region.
|
150
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
151
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
152
|
+
# Microsoft.MachineLearningServices
|
153
|
+
# @param create_quota_request [CurrentQuotaLimitBase] Quota requests payload.
|
154
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
155
|
+
# will be added to the HTTP request.
|
156
|
+
#
|
157
|
+
# @return [Object] operation results.
|
158
|
+
#
|
159
|
+
def create_or_update(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:nil)
|
160
|
+
response = create_or_update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:custom_headers).value!
|
161
|
+
response.body unless response.nil?
|
162
|
+
end
|
163
|
+
|
164
|
+
#
|
165
|
+
# @param subscription_id [String] Azure subscription id.
|
166
|
+
# @param provider_id [String] Azure resource provider id.
|
167
|
+
# @param location [String] Azure region.
|
168
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
169
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
170
|
+
# Microsoft.MachineLearningServices
|
171
|
+
# @param create_quota_request [CurrentQuotaLimitBase] Quota requests payload.
|
172
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
173
|
+
# will be added to the HTTP request.
|
174
|
+
#
|
175
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
176
|
+
# response.
|
177
|
+
#
|
178
|
+
def create_or_update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:nil)
|
179
|
+
# Send request
|
180
|
+
promise = begin_create_or_update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:custom_headers)
|
181
|
+
|
182
|
+
promise = promise.then do |response|
|
183
|
+
# Defining deserialization method.
|
184
|
+
deserialize_method = lambda do |parsed_response|
|
185
|
+
result_mapper = {
|
186
|
+
client_side_validation: true,
|
187
|
+
required: false,
|
188
|
+
serialized_name: 'parsed_response',
|
189
|
+
type: {
|
190
|
+
name: 'Object'
|
191
|
+
}
|
192
|
+
}
|
193
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Waiting for response.
|
197
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
198
|
+
end
|
199
|
+
|
200
|
+
promise
|
201
|
+
end
|
202
|
+
|
203
|
+
#
|
204
|
+
# Update the service limits (quota) of a resource to requested value.
|
205
|
+
# Steps:
|
206
|
+
#
|
207
|
+
# 1. Make the Get request to get the quota information for specific resource.
|
208
|
+
#
|
209
|
+
# 2. To increase the quota, update the limit field in the response from Get
|
210
|
+
# request to new value.
|
211
|
+
#
|
212
|
+
# 3. Submit the JSON to the quota request API to update the quota.
|
213
|
+
# The Update quota request may be constructed as follows. The PATCH operation
|
214
|
+
# can be used to update the quota.
|
215
|
+
#
|
216
|
+
# @param subscription_id [String] Azure subscription id.
|
217
|
+
# @param provider_id [String] Azure resource provider id.
|
218
|
+
# @param location [String] Azure region.
|
219
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
220
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
221
|
+
# Microsoft.MachineLearningServices
|
222
|
+
# @param create_quota_request [CurrentQuotaLimitBase] Quota requests payload.
|
223
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
224
|
+
# will be added to the HTTP request.
|
225
|
+
#
|
226
|
+
# @return [Object] operation results.
|
227
|
+
#
|
228
|
+
def update(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:nil)
|
229
|
+
response = update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:custom_headers).value!
|
230
|
+
response.body unless response.nil?
|
231
|
+
end
|
232
|
+
|
233
|
+
#
|
234
|
+
# @param subscription_id [String] Azure subscription id.
|
235
|
+
# @param provider_id [String] Azure resource provider id.
|
236
|
+
# @param location [String] Azure region.
|
237
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
238
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
239
|
+
# Microsoft.MachineLearningServices
|
240
|
+
# @param create_quota_request [CurrentQuotaLimitBase] Quota requests payload.
|
241
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
242
|
+
# will be added to the HTTP request.
|
243
|
+
#
|
244
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
245
|
+
# response.
|
246
|
+
#
|
247
|
+
def update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:nil)
|
248
|
+
# Send request
|
249
|
+
promise = begin_update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:custom_headers)
|
250
|
+
|
251
|
+
promise = promise.then do |response|
|
252
|
+
# Defining deserialization method.
|
253
|
+
deserialize_method = lambda do |parsed_response|
|
254
|
+
result_mapper = {
|
255
|
+
client_side_validation: true,
|
256
|
+
required: false,
|
257
|
+
serialized_name: 'parsed_response',
|
258
|
+
type: {
|
259
|
+
name: 'Object'
|
260
|
+
}
|
261
|
+
}
|
262
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
263
|
+
end
|
264
|
+
|
265
|
+
# Waiting for response.
|
266
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
267
|
+
end
|
268
|
+
|
269
|
+
promise
|
270
|
+
end
|
271
|
+
|
272
|
+
#
|
273
|
+
# Get a list of current service limits (quota) and usages of all the resources.
|
274
|
+
# The response from List API can be leveraged to submit quota update requests.
|
275
|
+
#
|
276
|
+
# @param subscription_id [String] Azure subscription id.
|
277
|
+
# @param provider_id [String] Azure resource provider id.
|
278
|
+
# @param location [String] Azure region.
|
279
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
280
|
+
# will be added to the HTTP request.
|
281
|
+
#
|
282
|
+
# @return [Array<CurrentQuotaLimitBase>] operation results.
|
283
|
+
#
|
284
|
+
def list(subscription_id, provider_id, location, custom_headers:nil)
|
285
|
+
first_page = list_as_lazy(subscription_id, provider_id, location, custom_headers:custom_headers)
|
286
|
+
first_page.get_all_items
|
287
|
+
end
|
288
|
+
|
289
|
+
#
|
290
|
+
# Get a list of current service limits (quota) and usages of all the resources.
|
291
|
+
# The response from List API can be leveraged to submit quota update requests.
|
292
|
+
#
|
293
|
+
# @param subscription_id [String] Azure subscription id.
|
294
|
+
# @param provider_id [String] Azure resource provider id.
|
57
295
|
# @param location [String] Azure region.
|
58
|
-
# @param resource_name [String] The Resource name for the specific resource
|
59
|
-
# provider, such as SKU name for Microsoft.Compute, pool for Microsoft.Batch.
|
60
296
|
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
61
297
|
# will be added to the HTTP request.
|
62
298
|
#
|
63
299
|
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
64
300
|
#
|
65
|
-
def
|
66
|
-
|
301
|
+
def list_with_http_info(subscription_id, provider_id, location, custom_headers:nil)
|
302
|
+
list_async(subscription_id, provider_id, location, custom_headers:custom_headers).value!
|
303
|
+
end
|
304
|
+
|
305
|
+
#
|
306
|
+
# Get a list of current service limits (quota) and usages of all the resources.
|
307
|
+
# The response from List API can be leveraged to submit quota update requests.
|
308
|
+
#
|
309
|
+
# @param subscription_id [String] Azure subscription id.
|
310
|
+
# @param provider_id [String] Azure resource provider id.
|
311
|
+
# @param location [String] Azure region.
|
312
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
313
|
+
# to the HTTP request.
|
314
|
+
#
|
315
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
316
|
+
#
|
317
|
+
def list_async(subscription_id, provider_id, location, custom_headers:nil)
|
318
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
319
|
+
fail ArgumentError, 'provider_id is nil' if provider_id.nil?
|
320
|
+
fail ArgumentError, 'location is nil' if location.nil?
|
321
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
322
|
+
|
323
|
+
|
324
|
+
request_headers = {}
|
325
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
326
|
+
|
327
|
+
# Set Headers
|
328
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
329
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
330
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits'
|
331
|
+
|
332
|
+
request_url = @base_url || @client.base_url
|
333
|
+
|
334
|
+
options = {
|
335
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
336
|
+
path_params: {'subscriptionId' => subscription_id,'providerId' => provider_id,'location' => location},
|
337
|
+
query_params: {'api-version' => @client.api_version},
|
338
|
+
headers: request_headers.merge(custom_headers || {}),
|
339
|
+
base_url: request_url
|
340
|
+
}
|
341
|
+
promise = @client.make_request_async(:get, path_template, options)
|
342
|
+
|
343
|
+
promise = promise.then do |result|
|
344
|
+
http_response = result.response
|
345
|
+
status_code = http_response.status
|
346
|
+
response_content = http_response.body
|
347
|
+
unless status_code == 200
|
348
|
+
error_model = JSON.load(response_content)
|
349
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
350
|
+
end
|
351
|
+
|
352
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
353
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
354
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
355
|
+
# Deserialize Response
|
356
|
+
if status_code == 200
|
357
|
+
begin
|
358
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
359
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaLimits.mapper()
|
360
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
361
|
+
rescue Exception => e
|
362
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
result
|
367
|
+
end
|
368
|
+
|
369
|
+
promise.execute
|
67
370
|
end
|
68
371
|
|
69
372
|
#
|
70
|
-
#
|
71
|
-
#
|
373
|
+
# Create or update the service limits (quota) of a resource to requested value.
|
374
|
+
# Steps:
|
375
|
+
#
|
376
|
+
# 1. Make the Get request to get the quota information for specific resource.
|
72
377
|
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
378
|
+
# 2. To increase the quota, update the limit field in the response from Get
|
379
|
+
# request to new value.
|
380
|
+
#
|
381
|
+
# 3. Submit the JSON to the quota request API to update the quota.
|
382
|
+
# The Create quota request may be constructed as follows. The PUT operation can
|
383
|
+
# be used to update the quota.
|
76
384
|
#
|
77
385
|
# @param subscription_id [String] Azure subscription id.
|
78
|
-
# @param provider_id [String] Azure resource
|
386
|
+
# @param provider_id [String] Azure resource provider id.
|
79
387
|
# @param location [String] Azure region.
|
80
|
-
# @param resource_name [String] The
|
81
|
-
#
|
388
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
389
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
390
|
+
# Microsoft.MachineLearningServices
|
391
|
+
# @param create_quota_request [CurrentQuotaLimitBase] Quota requests payload.
|
392
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
393
|
+
# will be added to the HTTP request.
|
394
|
+
#
|
395
|
+
# @return [Object] operation results.
|
396
|
+
#
|
397
|
+
def begin_create_or_update(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:nil)
|
398
|
+
response = begin_create_or_update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:custom_headers).value!
|
399
|
+
response.body unless response.nil?
|
400
|
+
end
|
401
|
+
|
402
|
+
#
|
403
|
+
# Create or update the service limits (quota) of a resource to requested value.
|
404
|
+
# Steps:
|
405
|
+
#
|
406
|
+
# 1. Make the Get request to get the quota information for specific resource.
|
407
|
+
#
|
408
|
+
# 2. To increase the quota, update the limit field in the response from Get
|
409
|
+
# request to new value.
|
410
|
+
#
|
411
|
+
# 3. Submit the JSON to the quota request API to update the quota.
|
412
|
+
# The Create quota request may be constructed as follows. The PUT operation can
|
413
|
+
# be used to update the quota.
|
414
|
+
#
|
415
|
+
# @param subscription_id [String] Azure subscription id.
|
416
|
+
# @param provider_id [String] Azure resource provider id.
|
417
|
+
# @param location [String] Azure region.
|
418
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
419
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
420
|
+
# Microsoft.MachineLearningServices
|
421
|
+
# @param create_quota_request [CurrentQuotaLimitBase] Quota requests payload.
|
422
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
423
|
+
# will be added to the HTTP request.
|
424
|
+
#
|
425
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
426
|
+
#
|
427
|
+
def begin_create_or_update_with_http_info(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:nil)
|
428
|
+
begin_create_or_update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:custom_headers).value!
|
429
|
+
end
|
430
|
+
|
431
|
+
#
|
432
|
+
# Create or update the service limits (quota) of a resource to requested value.
|
433
|
+
# Steps:
|
434
|
+
#
|
435
|
+
# 1. Make the Get request to get the quota information for specific resource.
|
436
|
+
#
|
437
|
+
# 2. To increase the quota, update the limit field in the response from Get
|
438
|
+
# request to new value.
|
439
|
+
#
|
440
|
+
# 3. Submit the JSON to the quota request API to update the quota.
|
441
|
+
# The Create quota request may be constructed as follows. The PUT operation can
|
442
|
+
# be used to update the quota.
|
443
|
+
#
|
444
|
+
# @param subscription_id [String] Azure subscription id.
|
445
|
+
# @param provider_id [String] Azure resource provider id.
|
446
|
+
# @param location [String] Azure region.
|
447
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
448
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
449
|
+
# Microsoft.MachineLearningServices
|
450
|
+
# @param create_quota_request [CurrentQuotaLimitBase] Quota requests payload.
|
82
451
|
# @param [Hash{String => String}] A hash of custom headers that will be added
|
83
452
|
# to the HTTP request.
|
84
453
|
#
|
85
454
|
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
86
455
|
#
|
87
|
-
def
|
456
|
+
def begin_create_or_update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:nil)
|
88
457
|
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
89
458
|
fail ArgumentError, 'provider_id is nil' if provider_id.nil?
|
90
459
|
fail ArgumentError, 'location is nil' if location.nil?
|
460
|
+
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
91
461
|
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
462
|
+
fail ArgumentError, 'create_quota_request is nil' if create_quota_request.nil?
|
463
|
+
|
464
|
+
|
465
|
+
request_headers = {}
|
466
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
467
|
+
|
468
|
+
# Set Headers
|
469
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
470
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
471
|
+
|
472
|
+
# Serialize Request
|
473
|
+
request_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::CurrentQuotaLimitBase.mapper()
|
474
|
+
request_content = @client.serialize(request_mapper, create_quota_request)
|
475
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
476
|
+
|
477
|
+
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'
|
478
|
+
|
479
|
+
request_url = @base_url || @client.base_url
|
480
|
+
|
481
|
+
options = {
|
482
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
483
|
+
path_params: {'subscriptionId' => subscription_id,'providerId' => provider_id,'location' => location,'resourceName' => resource_name},
|
484
|
+
query_params: {'api-version' => @client.api_version},
|
485
|
+
body: request_content,
|
486
|
+
headers: request_headers.merge(custom_headers || {}),
|
487
|
+
base_url: request_url
|
488
|
+
}
|
489
|
+
promise = @client.make_request_async(:put, path_template, options)
|
490
|
+
|
491
|
+
promise = promise.then do |result|
|
492
|
+
http_response = result.response
|
493
|
+
status_code = http_response.status
|
494
|
+
response_content = http_response.body
|
495
|
+
unless status_code == 200 || status_code == 201
|
496
|
+
error_model = JSON.load(response_content)
|
497
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
498
|
+
end
|
499
|
+
|
500
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
501
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
502
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
503
|
+
# Deserialize Response
|
504
|
+
if status_code == 200
|
505
|
+
begin
|
506
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
507
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaRequestOneResourceSubmitResponse.mapper()
|
508
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
509
|
+
rescue Exception => e
|
510
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
511
|
+
end
|
512
|
+
end
|
513
|
+
# Deserialize Response
|
514
|
+
if status_code == 201
|
515
|
+
begin
|
516
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
517
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaRequestSubmitResponse201.mapper()
|
518
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
519
|
+
rescue Exception => e
|
520
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
521
|
+
end
|
522
|
+
end
|
523
|
+
|
524
|
+
result
|
525
|
+
end
|
526
|
+
|
527
|
+
promise.execute
|
528
|
+
end
|
529
|
+
|
530
|
+
#
|
531
|
+
# Update the service limits (quota) of a resource to requested value.
|
532
|
+
# Steps:
|
533
|
+
#
|
534
|
+
# 1. Make the Get request to get the quota information for specific resource.
|
535
|
+
#
|
536
|
+
# 2. To increase the quota, update the limit field in the response from Get
|
537
|
+
# request to new value.
|
538
|
+
#
|
539
|
+
# 3. Submit the JSON to the quota request API to update the quota.
|
540
|
+
# The Update quota request may be constructed as follows. The PATCH operation
|
541
|
+
# can be used to update the quota.
|
542
|
+
#
|
543
|
+
# @param subscription_id [String] Azure subscription id.
|
544
|
+
# @param provider_id [String] Azure resource provider id.
|
545
|
+
# @param location [String] Azure region.
|
546
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
547
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
548
|
+
# Microsoft.MachineLearningServices
|
549
|
+
# @param create_quota_request [CurrentQuotaLimitBase] Quota requests payload.
|
550
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
551
|
+
# will be added to the HTTP request.
|
552
|
+
#
|
553
|
+
# @return [Object] operation results.
|
554
|
+
#
|
555
|
+
def begin_update(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:nil)
|
556
|
+
response = begin_update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:custom_headers).value!
|
557
|
+
response.body unless response.nil?
|
558
|
+
end
|
559
|
+
|
560
|
+
#
|
561
|
+
# Update the service limits (quota) of a resource to requested value.
|
562
|
+
# Steps:
|
563
|
+
#
|
564
|
+
# 1. Make the Get request to get the quota information for specific resource.
|
565
|
+
#
|
566
|
+
# 2. To increase the quota, update the limit field in the response from Get
|
567
|
+
# request to new value.
|
568
|
+
#
|
569
|
+
# 3. Submit the JSON to the quota request API to update the quota.
|
570
|
+
# The Update quota request may be constructed as follows. The PATCH operation
|
571
|
+
# can be used to update the quota.
|
572
|
+
#
|
573
|
+
# @param subscription_id [String] Azure subscription id.
|
574
|
+
# @param provider_id [String] Azure resource provider id.
|
575
|
+
# @param location [String] Azure region.
|
576
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
577
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
578
|
+
# Microsoft.MachineLearningServices
|
579
|
+
# @param create_quota_request [CurrentQuotaLimitBase] Quota requests payload.
|
580
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
581
|
+
# will be added to the HTTP request.
|
582
|
+
#
|
583
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
584
|
+
#
|
585
|
+
def begin_update_with_http_info(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:nil)
|
586
|
+
begin_update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:custom_headers).value!
|
587
|
+
end
|
588
|
+
|
589
|
+
#
|
590
|
+
# Update the service limits (quota) of a resource to requested value.
|
591
|
+
# Steps:
|
592
|
+
#
|
593
|
+
# 1. Make the Get request to get the quota information for specific resource.
|
594
|
+
#
|
595
|
+
# 2. To increase the quota, update the limit field in the response from Get
|
596
|
+
# request to new value.
|
597
|
+
#
|
598
|
+
# 3. Submit the JSON to the quota request API to update the quota.
|
599
|
+
# The Update quota request may be constructed as follows. The PATCH operation
|
600
|
+
# can be used to update the quota.
|
601
|
+
#
|
602
|
+
# @param subscription_id [String] Azure subscription id.
|
603
|
+
# @param provider_id [String] Azure resource provider id.
|
604
|
+
# @param location [String] Azure region.
|
605
|
+
# @param resource_name [String] The resource name for a resource provider, such
|
606
|
+
# as SKU name for Microsoft.Compute, Sku or TotalLowPriorityCores for
|
607
|
+
# Microsoft.MachineLearningServices
|
608
|
+
# @param create_quota_request [CurrentQuotaLimitBase] Quota requests payload.
|
609
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
610
|
+
# to the HTTP request.
|
611
|
+
#
|
612
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
613
|
+
#
|
614
|
+
def begin_update_async(subscription_id, provider_id, location, resource_name, create_quota_request, custom_headers:nil)
|
615
|
+
fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
|
616
|
+
fail ArgumentError, 'provider_id is nil' if provider_id.nil?
|
617
|
+
fail ArgumentError, 'location is nil' if location.nil?
|
92
618
|
fail ArgumentError, 'resource_name is nil' if resource_name.nil?
|
619
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
620
|
+
fail ArgumentError, 'create_quota_request is nil' if create_quota_request.nil?
|
93
621
|
|
94
622
|
|
95
623
|
request_headers = {}
|
@@ -98,6 +626,12 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
98
626
|
# Set Headers
|
99
627
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
100
628
|
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
629
|
+
|
630
|
+
# Serialize Request
|
631
|
+
request_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::CurrentQuotaLimitBase.mapper()
|
632
|
+
request_content = @client.serialize(request_mapper, create_quota_request)
|
633
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
634
|
+
|
101
635
|
path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}'
|
102
636
|
|
103
637
|
request_url = @base_url || @client.base_url
|
@@ -106,6 +640,110 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
106
640
|
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
107
641
|
path_params: {'subscriptionId' => subscription_id,'providerId' => provider_id,'location' => location,'resourceName' => resource_name},
|
108
642
|
query_params: {'api-version' => @client.api_version},
|
643
|
+
body: request_content,
|
644
|
+
headers: request_headers.merge(custom_headers || {}),
|
645
|
+
base_url: request_url
|
646
|
+
}
|
647
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
648
|
+
|
649
|
+
promise = promise.then do |result|
|
650
|
+
http_response = result.response
|
651
|
+
status_code = http_response.status
|
652
|
+
response_content = http_response.body
|
653
|
+
unless status_code == 200 || status_code == 201
|
654
|
+
error_model = JSON.load(response_content)
|
655
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
656
|
+
end
|
657
|
+
|
658
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
659
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
660
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
661
|
+
# Deserialize Response
|
662
|
+
if status_code == 200
|
663
|
+
begin
|
664
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
665
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaRequestOneResourceSubmitResponse.mapper()
|
666
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
667
|
+
rescue Exception => e
|
668
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
669
|
+
end
|
670
|
+
end
|
671
|
+
# Deserialize Response
|
672
|
+
if status_code == 201
|
673
|
+
begin
|
674
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
675
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaRequestSubmitResponse201.mapper()
|
676
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
677
|
+
rescue Exception => e
|
678
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
679
|
+
end
|
680
|
+
end
|
681
|
+
|
682
|
+
result
|
683
|
+
end
|
684
|
+
|
685
|
+
promise.execute
|
686
|
+
end
|
687
|
+
|
688
|
+
#
|
689
|
+
# Get a list of current service limits (quota) and usages of all the resources.
|
690
|
+
# The response from List API can be leveraged to submit quota update requests.
|
691
|
+
#
|
692
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
693
|
+
# to List operation.
|
694
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
695
|
+
# will be added to the HTTP request.
|
696
|
+
#
|
697
|
+
# @return [QuotaLimits] operation results.
|
698
|
+
#
|
699
|
+
def list_next(next_page_link, custom_headers:nil)
|
700
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
701
|
+
response.body unless response.nil?
|
702
|
+
end
|
703
|
+
|
704
|
+
#
|
705
|
+
# Get a list of current service limits (quota) and usages of all the resources.
|
706
|
+
# The response from List API can be leveraged to submit quota update requests.
|
707
|
+
#
|
708
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
709
|
+
# to List operation.
|
710
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
711
|
+
# will be added to the HTTP request.
|
712
|
+
#
|
713
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
714
|
+
#
|
715
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
716
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
717
|
+
end
|
718
|
+
|
719
|
+
#
|
720
|
+
# Get a list of current service limits (quota) and usages of all the resources.
|
721
|
+
# The response from List API can be leveraged to submit quota update requests.
|
722
|
+
#
|
723
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
724
|
+
# to List operation.
|
725
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
726
|
+
# to the HTTP request.
|
727
|
+
#
|
728
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
729
|
+
#
|
730
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
731
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
732
|
+
|
733
|
+
|
734
|
+
request_headers = {}
|
735
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
736
|
+
|
737
|
+
# Set Headers
|
738
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
739
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
740
|
+
path_template = '{nextLink}'
|
741
|
+
|
742
|
+
request_url = @base_url || @client.base_url
|
743
|
+
|
744
|
+
options = {
|
745
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
746
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
109
747
|
headers: request_headers.merge(custom_headers || {}),
|
110
748
|
base_url: request_url
|
111
749
|
}
|
@@ -127,7 +765,7 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
127
765
|
if status_code == 200
|
128
766
|
begin
|
129
767
|
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
130
|
-
result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::
|
768
|
+
result_mapper = Azure::Reservations::Mgmt::V2019_07_19_preview::Models::QuotaLimits.mapper()
|
131
769
|
result.body = @client.deserialize(result_mapper, parsed_response)
|
132
770
|
rescue Exception => e
|
133
771
|
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
@@ -140,5 +778,28 @@ module Azure::Reservations::Mgmt::V2019_07_19_preview
|
|
140
778
|
promise.execute
|
141
779
|
end
|
142
780
|
|
781
|
+
#
|
782
|
+
# Get a list of current service limits (quota) and usages of all the resources.
|
783
|
+
# The response from List API can be leveraged to submit quota update requests.
|
784
|
+
#
|
785
|
+
# @param subscription_id [String] Azure subscription id.
|
786
|
+
# @param provider_id [String] Azure resource provider id.
|
787
|
+
# @param location [String] Azure region.
|
788
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
789
|
+
# will be added to the HTTP request.
|
790
|
+
#
|
791
|
+
# @return [QuotaLimits] which provide lazy access to pages of the response.
|
792
|
+
#
|
793
|
+
def list_as_lazy(subscription_id, provider_id, location, custom_headers:nil)
|
794
|
+
response = list_async(subscription_id, provider_id, location, custom_headers:custom_headers).value!
|
795
|
+
unless response.nil?
|
796
|
+
page = response.body
|
797
|
+
page.next_method = Proc.new do |next_page_link|
|
798
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
799
|
+
end
|
800
|
+
page
|
801
|
+
end
|
802
|
+
end
|
803
|
+
|
143
804
|
end
|
144
805
|
end
|