azure_mgmt_devtestlabs 0.4.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 +7 -0
- data/.rspec +3 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +5 -0
- data/azure_mgmt_devtestlabs.gemspec +34 -0
- data/lib/azure_mgmt_devtestlabs.rb +5 -0
- data/lib/generated/azure_mgmt_devtestlabs.rb +103 -0
- data/lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb +477 -0
- data/lib/generated/azure_mgmt_devtestlabs/artifact_source_operations.rb +669 -0
- data/lib/generated/azure_mgmt_devtestlabs/cost_operations.rb +124 -0
- data/lib/generated/azure_mgmt_devtestlabs/custom_image_operations.rb +648 -0
- data/lib/generated/azure_mgmt_devtestlabs/dev_test_labs_client.rb +110 -0
- data/lib/generated/azure_mgmt_devtestlabs/formula_operations.rb +608 -0
- data/lib/generated/azure_mgmt_devtestlabs/gallery_image_operations.rb +252 -0
- data/lib/generated/azure_mgmt_devtestlabs/lab_operations.rb +1403 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/apply_artifacts_request.rb +53 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/arm_template_info.rb +54 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/artifact.rb +151 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/artifact_deployment_status_properties.rb +66 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/artifact_install_properties.rb +63 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/artifact_parameter_properties.rb +54 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/artifact_source.rb +183 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/cost.rb +139 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/cost_per_day_properties.rb +65 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/custom_image.rb +164 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/custom_image_os_type.rb +17 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/custom_image_properties_custom.rb +65 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/custom_image_properties_from_vm.rb +66 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/day_details.rb +44 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/enable_status.rb +16 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/evaluate_policies_properties.rb +64 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/evaluate_policies_request.rb +52 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/evaluate_policies_response.rb +52 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/formula.rb +174 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/formula_properties_from_vm.rb +45 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/gallery_image.rb +153 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/gallery_image_reference.rb +84 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/generate_arm_template_request.rb +72 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/generate_upload_uri_parameter.rb +44 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/generate_upload_uri_response.rb +44 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/hour_details.rb +44 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/lab.rb +162 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/lab_cost_type.rb +17 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/lab_storage_type.rb +16 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/lab_vhd.rb +44 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/lab_virtual_machine.rb +321 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/linux_os_info.rb +46 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/linux_os_state.rb +17 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/parameter_info.rb +54 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/policy.rb +175 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/policy_evaluator_type.rb +16 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/policy_fact_name.rb +19 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/policy_set_result.rb +63 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/policy_status.rb +16 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/policy_violation.rb +54 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/resource_cost_properties.rb +106 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_artifact.rb +93 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_artifact_source.rb +94 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_custom_image.rb +93 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_formula.rb +93 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_gallery_image.rb +93 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_lab.rb +93 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_lab_vhd.rb +93 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_lab_virtual_machine.rb +95 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_policy.rb +93 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_schedule.rb +93 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_virtual_network.rb +94 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/schedule.rb +175 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/source_control_type.rb +16 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/subnet.rb +65 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/subnet_override.rb +78 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/subscription_notification.rb +67 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/subscription_notification_properties.rb +44 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/subscription_notification_state.rb +20 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/usage_permission_type.rb +17 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/virtual_network.rb +169 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/week_details.rb +61 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/windows_os_info.rb +45 -0
- data/lib/generated/azure_mgmt_devtestlabs/models/windows_os_state.rb +17 -0
- data/lib/generated/azure_mgmt_devtestlabs/module_definition.rb +8 -0
- data/lib/generated/azure_mgmt_devtestlabs/policy_operations.rb +690 -0
- data/lib/generated/azure_mgmt_devtestlabs/policy_set.rb +137 -0
- data/lib/generated/azure_mgmt_devtestlabs/schedule_operations.rb +796 -0
- data/lib/generated/azure_mgmt_devtestlabs/version.rb +8 -0
- data/lib/generated/azure_mgmt_devtestlabs/virtual_machine.rb +1155 -0
- data/lib/generated/azure_mgmt_devtestlabs/virtual_network_operations.rb +759 -0
- metadata +199 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
|
4
|
+
# regenerated.
|
|
5
|
+
|
|
6
|
+
module Azure::ARM::DevTestLabs
|
|
7
|
+
#
|
|
8
|
+
# The DevTest Labs Client.
|
|
9
|
+
#
|
|
10
|
+
class PolicySet
|
|
11
|
+
include Azure::ARM::DevTestLabs::Models
|
|
12
|
+
include MsRestAzure
|
|
13
|
+
|
|
14
|
+
#
|
|
15
|
+
# Creates and initializes a new instance of the PolicySet class.
|
|
16
|
+
# @param client service class for accessing basic functionality.
|
|
17
|
+
#
|
|
18
|
+
def initialize(client)
|
|
19
|
+
@client = client
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @return reference to the DevTestLabsClient
|
|
23
|
+
attr_reader :client
|
|
24
|
+
|
|
25
|
+
#
|
|
26
|
+
# Evaluates Lab Policy.
|
|
27
|
+
#
|
|
28
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
29
|
+
# @param lab_name [String] The name of the lab.
|
|
30
|
+
# @param name [String] The name of the policy set.
|
|
31
|
+
# @param evaluate_policies_request [EvaluatePoliciesRequest]
|
|
32
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
33
|
+
# will be added to the HTTP request.
|
|
34
|
+
#
|
|
35
|
+
# @return [EvaluatePoliciesResponse] operation results.
|
|
36
|
+
#
|
|
37
|
+
def evaluate_policies(resource_group_name, lab_name, name, evaluate_policies_request, custom_headers = nil)
|
|
38
|
+
response = evaluate_policies_async(resource_group_name, lab_name, name, evaluate_policies_request, custom_headers).value!
|
|
39
|
+
response.body unless response.nil?
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
#
|
|
43
|
+
# Evaluates Lab Policy.
|
|
44
|
+
#
|
|
45
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
46
|
+
# @param lab_name [String] The name of the lab.
|
|
47
|
+
# @param name [String] The name of the policy set.
|
|
48
|
+
# @param evaluate_policies_request [EvaluatePoliciesRequest]
|
|
49
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
50
|
+
# will be added to the HTTP request.
|
|
51
|
+
#
|
|
52
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
53
|
+
#
|
|
54
|
+
def evaluate_policies_with_http_info(resource_group_name, lab_name, name, evaluate_policies_request, custom_headers = nil)
|
|
55
|
+
evaluate_policies_async(resource_group_name, lab_name, name, evaluate_policies_request, custom_headers).value!
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
#
|
|
59
|
+
# Evaluates Lab Policy.
|
|
60
|
+
#
|
|
61
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
62
|
+
# @param lab_name [String] The name of the lab.
|
|
63
|
+
# @param name [String] The name of the policy set.
|
|
64
|
+
# @param evaluate_policies_request [EvaluatePoliciesRequest]
|
|
65
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
66
|
+
# to the HTTP request.
|
|
67
|
+
#
|
|
68
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
69
|
+
#
|
|
70
|
+
def evaluate_policies_async(resource_group_name, lab_name, name, evaluate_policies_request, custom_headers = nil)
|
|
71
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
72
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
73
|
+
fail ArgumentError, 'lab_name is nil' if lab_name.nil?
|
|
74
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
|
75
|
+
fail ArgumentError, 'evaluate_policies_request is nil' if evaluate_policies_request.nil?
|
|
76
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
request_headers = {}
|
|
80
|
+
|
|
81
|
+
# Set Headers
|
|
82
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
83
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
84
|
+
|
|
85
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
86
|
+
|
|
87
|
+
# Serialize Request
|
|
88
|
+
request_mapper = EvaluatePoliciesRequest.mapper()
|
|
89
|
+
request_content = @client.serialize(request_mapper, evaluate_policies_request, 'evaluate_policies_request')
|
|
90
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
|
91
|
+
|
|
92
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies'
|
|
93
|
+
options = {
|
|
94
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
95
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
|
|
96
|
+
query_params: {'api-version' => @client.api_version},
|
|
97
|
+
body: request_content,
|
|
98
|
+
headers: request_headers.merge(custom_headers || {})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
request_url = @base_url || @client.base_url
|
|
102
|
+
|
|
103
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
|
|
104
|
+
promise = request.run_promise do |req|
|
|
105
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
promise = promise.then do |http_response|
|
|
109
|
+
status_code = http_response.status
|
|
110
|
+
response_content = http_response.body
|
|
111
|
+
unless status_code == 200
|
|
112
|
+
error_model = JSON.load(response_content)
|
|
113
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Create Result
|
|
117
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
|
118
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
119
|
+
# Deserialize Response
|
|
120
|
+
if status_code == 200
|
|
121
|
+
begin
|
|
122
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
123
|
+
result_mapper = EvaluatePoliciesResponse.mapper()
|
|
124
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
125
|
+
rescue Exception => e
|
|
126
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
result
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
promise.execute
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
end
|
|
137
|
+
end
|
|
@@ -0,0 +1,796 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
|
4
|
+
# regenerated.
|
|
5
|
+
|
|
6
|
+
module Azure::ARM::DevTestLabs
|
|
7
|
+
#
|
|
8
|
+
# The DevTest Labs Client.
|
|
9
|
+
#
|
|
10
|
+
class ScheduleOperations
|
|
11
|
+
include Azure::ARM::DevTestLabs::Models
|
|
12
|
+
include MsRestAzure
|
|
13
|
+
|
|
14
|
+
#
|
|
15
|
+
# Creates and initializes a new instance of the ScheduleOperations class.
|
|
16
|
+
# @param client service class for accessing basic functionality.
|
|
17
|
+
#
|
|
18
|
+
def initialize(client)
|
|
19
|
+
@client = client
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @return reference to the DevTestLabsClient
|
|
23
|
+
attr_reader :client
|
|
24
|
+
|
|
25
|
+
#
|
|
26
|
+
# List schedules in a given lab.
|
|
27
|
+
#
|
|
28
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
29
|
+
# @param lab_name [String] The name of the lab.
|
|
30
|
+
# @param filter [String] The filter to apply on the operation.
|
|
31
|
+
# @param top [Integer] The maximum number of resources to return from the
|
|
32
|
+
# operation.
|
|
33
|
+
# @param order_by [String] The ordering expression for the results, using
|
|
34
|
+
# OData notation.
|
|
35
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
36
|
+
# will be added to the HTTP request.
|
|
37
|
+
#
|
|
38
|
+
# @return [ResponseWithContinuationSchedule] which provide lazy access to
|
|
39
|
+
# pages of the response.
|
|
40
|
+
#
|
|
41
|
+
def list_as_lazy(resource_group_name, lab_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
|
|
42
|
+
response = list_async(resource_group_name, lab_name, filter, top, order_by, custom_headers).value!
|
|
43
|
+
unless response.nil?
|
|
44
|
+
page = response.body
|
|
45
|
+
page.next_method = Proc.new do |next_link|
|
|
46
|
+
list_next_async(next_link, custom_headers)
|
|
47
|
+
end
|
|
48
|
+
page
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
#
|
|
53
|
+
# List schedules in a given lab.
|
|
54
|
+
#
|
|
55
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
56
|
+
# @param lab_name [String] The name of the lab.
|
|
57
|
+
# @param filter [String] The filter to apply on the operation.
|
|
58
|
+
# @param top [Integer] The maximum number of resources to return from the
|
|
59
|
+
# operation.
|
|
60
|
+
# @param order_by [String] The ordering expression for the results, using
|
|
61
|
+
# OData notation.
|
|
62
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
63
|
+
# will be added to the HTTP request.
|
|
64
|
+
#
|
|
65
|
+
# @return [Array<Schedule>] operation results.
|
|
66
|
+
#
|
|
67
|
+
def list(resource_group_name, lab_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
|
|
68
|
+
first_page = list_as_lazy(resource_group_name, lab_name, filter, top, order_by, custom_headers)
|
|
69
|
+
first_page.get_all_items
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
#
|
|
73
|
+
# List schedules in a given lab.
|
|
74
|
+
#
|
|
75
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
76
|
+
# @param lab_name [String] The name of the lab.
|
|
77
|
+
# @param filter [String] The filter to apply on the operation.
|
|
78
|
+
# @param top [Integer] The maximum number of resources to return from the
|
|
79
|
+
# operation.
|
|
80
|
+
# @param order_by [String] The ordering expression for the results, using
|
|
81
|
+
# OData notation.
|
|
82
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
83
|
+
# will be added to the HTTP request.
|
|
84
|
+
#
|
|
85
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
86
|
+
#
|
|
87
|
+
def list_with_http_info(resource_group_name, lab_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
|
|
88
|
+
list_async(resource_group_name, lab_name, filter, top, order_by, custom_headers).value!
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
#
|
|
92
|
+
# List schedules in a given lab.
|
|
93
|
+
#
|
|
94
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
95
|
+
# @param lab_name [String] The name of the lab.
|
|
96
|
+
# @param filter [String] The filter to apply on the operation.
|
|
97
|
+
# @param top [Integer] The maximum number of resources to return from the
|
|
98
|
+
# operation.
|
|
99
|
+
# @param order_by [String] The ordering expression for the results, using
|
|
100
|
+
# OData notation.
|
|
101
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
102
|
+
# to the HTTP request.
|
|
103
|
+
#
|
|
104
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
105
|
+
#
|
|
106
|
+
def list_async(resource_group_name, lab_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
|
|
107
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
108
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
109
|
+
fail ArgumentError, 'lab_name is nil' if lab_name.nil?
|
|
110
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
request_headers = {}
|
|
114
|
+
|
|
115
|
+
# Set Headers
|
|
116
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
117
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
118
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules'
|
|
119
|
+
options = {
|
|
120
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
121
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name},
|
|
122
|
+
query_params: {'$filter' => filter,'$top' => top,'$orderBy' => order_by,'api-version' => @client.api_version},
|
|
123
|
+
headers: request_headers.merge(custom_headers || {})
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
request_url = @base_url || @client.base_url
|
|
127
|
+
|
|
128
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
|
|
129
|
+
promise = request.run_promise do |req|
|
|
130
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
promise = promise.then do |http_response|
|
|
134
|
+
status_code = http_response.status
|
|
135
|
+
response_content = http_response.body
|
|
136
|
+
unless status_code == 200
|
|
137
|
+
error_model = JSON.load(response_content)
|
|
138
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Create Result
|
|
142
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
|
143
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
144
|
+
# Deserialize Response
|
|
145
|
+
if status_code == 200
|
|
146
|
+
begin
|
|
147
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
148
|
+
result_mapper = ResponseWithContinuationSchedule.mapper()
|
|
149
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
150
|
+
rescue Exception => e
|
|
151
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
result
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
promise.execute
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
#
|
|
162
|
+
# Get schedule.
|
|
163
|
+
#
|
|
164
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
165
|
+
# @param lab_name [String] The name of the lab.
|
|
166
|
+
# @param name [String] The name of the schedule.
|
|
167
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
168
|
+
# will be added to the HTTP request.
|
|
169
|
+
#
|
|
170
|
+
# @return [Schedule] operation results.
|
|
171
|
+
#
|
|
172
|
+
def get_resource(resource_group_name, lab_name, name, custom_headers = nil)
|
|
173
|
+
response = get_resource_async(resource_group_name, lab_name, name, custom_headers).value!
|
|
174
|
+
response.body unless response.nil?
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
#
|
|
178
|
+
# Get schedule.
|
|
179
|
+
#
|
|
180
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
181
|
+
# @param lab_name [String] The name of the lab.
|
|
182
|
+
# @param name [String] The name of the schedule.
|
|
183
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
184
|
+
# will be added to the HTTP request.
|
|
185
|
+
#
|
|
186
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
187
|
+
#
|
|
188
|
+
def get_resource_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
|
|
189
|
+
get_resource_async(resource_group_name, lab_name, name, custom_headers).value!
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
#
|
|
193
|
+
# Get schedule.
|
|
194
|
+
#
|
|
195
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
196
|
+
# @param lab_name [String] The name of the lab.
|
|
197
|
+
# @param name [String] The name of the schedule.
|
|
198
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
199
|
+
# to the HTTP request.
|
|
200
|
+
#
|
|
201
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
202
|
+
#
|
|
203
|
+
def get_resource_async(resource_group_name, lab_name, name, custom_headers = nil)
|
|
204
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
205
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
206
|
+
fail ArgumentError, 'lab_name is nil' if lab_name.nil?
|
|
207
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
|
208
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
request_headers = {}
|
|
212
|
+
|
|
213
|
+
# Set Headers
|
|
214
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
215
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
216
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}'
|
|
217
|
+
options = {
|
|
218
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
219
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
|
|
220
|
+
query_params: {'api-version' => @client.api_version},
|
|
221
|
+
headers: request_headers.merge(custom_headers || {})
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
request_url = @base_url || @client.base_url
|
|
225
|
+
|
|
226
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
|
|
227
|
+
promise = request.run_promise do |req|
|
|
228
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
promise = promise.then do |http_response|
|
|
232
|
+
status_code = http_response.status
|
|
233
|
+
response_content = http_response.body
|
|
234
|
+
unless status_code == 200
|
|
235
|
+
error_model = JSON.load(response_content)
|
|
236
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Create Result
|
|
240
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
|
241
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
242
|
+
# Deserialize Response
|
|
243
|
+
if status_code == 200
|
|
244
|
+
begin
|
|
245
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
246
|
+
result_mapper = Schedule.mapper()
|
|
247
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
248
|
+
rescue Exception => e
|
|
249
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
result
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
promise.execute
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
#
|
|
260
|
+
# Create or replace an existing schedule.
|
|
261
|
+
#
|
|
262
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
263
|
+
# @param lab_name [String] The name of the lab.
|
|
264
|
+
# @param name [String] The name of the schedule.
|
|
265
|
+
# @param schedule [Schedule]
|
|
266
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
267
|
+
# will be added to the HTTP request.
|
|
268
|
+
#
|
|
269
|
+
# @return [Schedule] operation results.
|
|
270
|
+
#
|
|
271
|
+
def create_or_update_resource(resource_group_name, lab_name, name, schedule, custom_headers = nil)
|
|
272
|
+
response = create_or_update_resource_async(resource_group_name, lab_name, name, schedule, custom_headers).value!
|
|
273
|
+
response.body unless response.nil?
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
#
|
|
277
|
+
# Create or replace an existing schedule.
|
|
278
|
+
#
|
|
279
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
280
|
+
# @param lab_name [String] The name of the lab.
|
|
281
|
+
# @param name [String] The name of the schedule.
|
|
282
|
+
# @param schedule [Schedule]
|
|
283
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
284
|
+
# will be added to the HTTP request.
|
|
285
|
+
#
|
|
286
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
287
|
+
#
|
|
288
|
+
def create_or_update_resource_with_http_info(resource_group_name, lab_name, name, schedule, custom_headers = nil)
|
|
289
|
+
create_or_update_resource_async(resource_group_name, lab_name, name, schedule, custom_headers).value!
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
#
|
|
293
|
+
# Create or replace an existing schedule.
|
|
294
|
+
#
|
|
295
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
296
|
+
# @param lab_name [String] The name of the lab.
|
|
297
|
+
# @param name [String] The name of the schedule.
|
|
298
|
+
# @param schedule [Schedule]
|
|
299
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
300
|
+
# to the HTTP request.
|
|
301
|
+
#
|
|
302
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
303
|
+
#
|
|
304
|
+
def create_or_update_resource_async(resource_group_name, lab_name, name, schedule, custom_headers = nil)
|
|
305
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
306
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
307
|
+
fail ArgumentError, 'lab_name is nil' if lab_name.nil?
|
|
308
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
|
309
|
+
fail ArgumentError, 'schedule is nil' if schedule.nil?
|
|
310
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
request_headers = {}
|
|
314
|
+
|
|
315
|
+
# Set Headers
|
|
316
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
317
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
318
|
+
|
|
319
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
320
|
+
|
|
321
|
+
# Serialize Request
|
|
322
|
+
request_mapper = Schedule.mapper()
|
|
323
|
+
request_content = @client.serialize(request_mapper, schedule, 'schedule')
|
|
324
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
|
325
|
+
|
|
326
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}'
|
|
327
|
+
options = {
|
|
328
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
329
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
|
|
330
|
+
query_params: {'api-version' => @client.api_version},
|
|
331
|
+
body: request_content,
|
|
332
|
+
headers: request_headers.merge(custom_headers || {})
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
request_url = @base_url || @client.base_url
|
|
336
|
+
|
|
337
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
|
|
338
|
+
promise = request.run_promise do |req|
|
|
339
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
promise = promise.then do |http_response|
|
|
343
|
+
status_code = http_response.status
|
|
344
|
+
response_content = http_response.body
|
|
345
|
+
unless status_code == 200 || status_code == 201
|
|
346
|
+
error_model = JSON.load(response_content)
|
|
347
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
# Create Result
|
|
351
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
|
352
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
353
|
+
# Deserialize Response
|
|
354
|
+
if status_code == 200
|
|
355
|
+
begin
|
|
356
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
357
|
+
result_mapper = Schedule.mapper()
|
|
358
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
359
|
+
rescue Exception => e
|
|
360
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
361
|
+
end
|
|
362
|
+
end
|
|
363
|
+
# Deserialize Response
|
|
364
|
+
if status_code == 201
|
|
365
|
+
begin
|
|
366
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
367
|
+
result_mapper = Schedule.mapper()
|
|
368
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
369
|
+
rescue Exception => e
|
|
370
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
371
|
+
end
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
result
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
promise.execute
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
#
|
|
381
|
+
# Delete schedule.
|
|
382
|
+
#
|
|
383
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
384
|
+
# @param lab_name [String] The name of the lab.
|
|
385
|
+
# @param name [String] The name of the schedule.
|
|
386
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
387
|
+
# will be added to the HTTP request.
|
|
388
|
+
#
|
|
389
|
+
#
|
|
390
|
+
def delete_resource(resource_group_name, lab_name, name, custom_headers = nil)
|
|
391
|
+
response = delete_resource_async(resource_group_name, lab_name, name, custom_headers).value!
|
|
392
|
+
nil
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
#
|
|
396
|
+
# Delete schedule.
|
|
397
|
+
#
|
|
398
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
399
|
+
# @param lab_name [String] The name of the lab.
|
|
400
|
+
# @param name [String] The name of the schedule.
|
|
401
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
402
|
+
# will be added to the HTTP request.
|
|
403
|
+
#
|
|
404
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
405
|
+
#
|
|
406
|
+
def delete_resource_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
|
|
407
|
+
delete_resource_async(resource_group_name, lab_name, name, custom_headers).value!
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
#
|
|
411
|
+
# Delete schedule.
|
|
412
|
+
#
|
|
413
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
414
|
+
# @param lab_name [String] The name of the lab.
|
|
415
|
+
# @param name [String] The name of the schedule.
|
|
416
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
417
|
+
# to the HTTP request.
|
|
418
|
+
#
|
|
419
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
420
|
+
#
|
|
421
|
+
def delete_resource_async(resource_group_name, lab_name, name, custom_headers = nil)
|
|
422
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
423
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
424
|
+
fail ArgumentError, 'lab_name is nil' if lab_name.nil?
|
|
425
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
|
426
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
request_headers = {}
|
|
430
|
+
|
|
431
|
+
# Set Headers
|
|
432
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
433
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
434
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}'
|
|
435
|
+
options = {
|
|
436
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
437
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
|
|
438
|
+
query_params: {'api-version' => @client.api_version},
|
|
439
|
+
headers: request_headers.merge(custom_headers || {})
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
request_url = @base_url || @client.base_url
|
|
443
|
+
|
|
444
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
|
|
445
|
+
promise = request.run_promise do |req|
|
|
446
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
|
447
|
+
end
|
|
448
|
+
|
|
449
|
+
promise = promise.then do |http_response|
|
|
450
|
+
status_code = http_response.status
|
|
451
|
+
response_content = http_response.body
|
|
452
|
+
unless status_code == 200 || status_code == 204
|
|
453
|
+
error_model = JSON.load(response_content)
|
|
454
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
# Create Result
|
|
458
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
|
459
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
460
|
+
|
|
461
|
+
result
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
promise.execute
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
#
|
|
468
|
+
# Modify properties of schedules.
|
|
469
|
+
#
|
|
470
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
471
|
+
# @param lab_name [String] The name of the lab.
|
|
472
|
+
# @param name [String] The name of the schedule.
|
|
473
|
+
# @param schedule [Schedule]
|
|
474
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
475
|
+
# will be added to the HTTP request.
|
|
476
|
+
#
|
|
477
|
+
# @return [Schedule] operation results.
|
|
478
|
+
#
|
|
479
|
+
def patch_resource(resource_group_name, lab_name, name, schedule, custom_headers = nil)
|
|
480
|
+
response = patch_resource_async(resource_group_name, lab_name, name, schedule, custom_headers).value!
|
|
481
|
+
response.body unless response.nil?
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
#
|
|
485
|
+
# Modify properties of schedules.
|
|
486
|
+
#
|
|
487
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
488
|
+
# @param lab_name [String] The name of the lab.
|
|
489
|
+
# @param name [String] The name of the schedule.
|
|
490
|
+
# @param schedule [Schedule]
|
|
491
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
492
|
+
# will be added to the HTTP request.
|
|
493
|
+
#
|
|
494
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
495
|
+
#
|
|
496
|
+
def patch_resource_with_http_info(resource_group_name, lab_name, name, schedule, custom_headers = nil)
|
|
497
|
+
patch_resource_async(resource_group_name, lab_name, name, schedule, custom_headers).value!
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
#
|
|
501
|
+
# Modify properties of schedules.
|
|
502
|
+
#
|
|
503
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
504
|
+
# @param lab_name [String] The name of the lab.
|
|
505
|
+
# @param name [String] The name of the schedule.
|
|
506
|
+
# @param schedule [Schedule]
|
|
507
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
508
|
+
# to the HTTP request.
|
|
509
|
+
#
|
|
510
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
511
|
+
#
|
|
512
|
+
def patch_resource_async(resource_group_name, lab_name, name, schedule, custom_headers = nil)
|
|
513
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
514
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
515
|
+
fail ArgumentError, 'lab_name is nil' if lab_name.nil?
|
|
516
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
|
517
|
+
fail ArgumentError, 'schedule is nil' if schedule.nil?
|
|
518
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
request_headers = {}
|
|
522
|
+
|
|
523
|
+
# Set Headers
|
|
524
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
525
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
526
|
+
|
|
527
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
|
528
|
+
|
|
529
|
+
# Serialize Request
|
|
530
|
+
request_mapper = Schedule.mapper()
|
|
531
|
+
request_content = @client.serialize(request_mapper, schedule, 'schedule')
|
|
532
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
|
533
|
+
|
|
534
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}'
|
|
535
|
+
options = {
|
|
536
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
537
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
|
|
538
|
+
query_params: {'api-version' => @client.api_version},
|
|
539
|
+
body: request_content,
|
|
540
|
+
headers: request_headers.merge(custom_headers || {})
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
request_url = @base_url || @client.base_url
|
|
544
|
+
|
|
545
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
|
|
546
|
+
promise = request.run_promise do |req|
|
|
547
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
|
548
|
+
end
|
|
549
|
+
|
|
550
|
+
promise = promise.then do |http_response|
|
|
551
|
+
status_code = http_response.status
|
|
552
|
+
response_content = http_response.body
|
|
553
|
+
unless status_code == 200
|
|
554
|
+
error_model = JSON.load(response_content)
|
|
555
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
|
556
|
+
end
|
|
557
|
+
|
|
558
|
+
# Create Result
|
|
559
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
|
560
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
561
|
+
# Deserialize Response
|
|
562
|
+
if status_code == 200
|
|
563
|
+
begin
|
|
564
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
565
|
+
result_mapper = Schedule.mapper()
|
|
566
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
567
|
+
rescue Exception => e
|
|
568
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
569
|
+
end
|
|
570
|
+
end
|
|
571
|
+
|
|
572
|
+
result
|
|
573
|
+
end
|
|
574
|
+
|
|
575
|
+
promise.execute
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
#
|
|
579
|
+
# Execute a schedule. This operation can take a while to complete.
|
|
580
|
+
#
|
|
581
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
582
|
+
# @param lab_name [String] The name of the lab.
|
|
583
|
+
# @param name [String] The name of the schedule.
|
|
584
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
585
|
+
# will be added to the HTTP request.
|
|
586
|
+
#
|
|
587
|
+
def execute(resource_group_name, lab_name, name, custom_headers = nil)
|
|
588
|
+
response = execute_async(resource_group_name, lab_name, name, custom_headers).value!
|
|
589
|
+
nil
|
|
590
|
+
end
|
|
591
|
+
|
|
592
|
+
#
|
|
593
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
594
|
+
# @param lab_name [String] The name of the lab.
|
|
595
|
+
# @param name [String] The name of the schedule.
|
|
596
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
597
|
+
# will be added to the HTTP request.
|
|
598
|
+
#
|
|
599
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
|
600
|
+
# response.
|
|
601
|
+
#
|
|
602
|
+
def execute_async(resource_group_name, lab_name, name, custom_headers = nil)
|
|
603
|
+
# Send request
|
|
604
|
+
promise = begin_execute_async(resource_group_name, lab_name, name, custom_headers)
|
|
605
|
+
|
|
606
|
+
promise = promise.then do |response|
|
|
607
|
+
# Defining deserialization method.
|
|
608
|
+
deserialize_method = lambda do |parsed_response|
|
|
609
|
+
end
|
|
610
|
+
|
|
611
|
+
# Waiting for response.
|
|
612
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
|
613
|
+
end
|
|
614
|
+
|
|
615
|
+
promise
|
|
616
|
+
end
|
|
617
|
+
|
|
618
|
+
#
|
|
619
|
+
# Execute a schedule. This operation can take a while to complete.
|
|
620
|
+
#
|
|
621
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
622
|
+
# @param lab_name [String] The name of the lab.
|
|
623
|
+
# @param name [String] The name of the schedule.
|
|
624
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
625
|
+
# will be added to the HTTP request.
|
|
626
|
+
#
|
|
627
|
+
#
|
|
628
|
+
def begin_execute(resource_group_name, lab_name, name, custom_headers = nil)
|
|
629
|
+
response = begin_execute_async(resource_group_name, lab_name, name, custom_headers).value!
|
|
630
|
+
nil
|
|
631
|
+
end
|
|
632
|
+
|
|
633
|
+
#
|
|
634
|
+
# Execute a schedule. This operation can take a while to complete.
|
|
635
|
+
#
|
|
636
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
637
|
+
# @param lab_name [String] The name of the lab.
|
|
638
|
+
# @param name [String] The name of the schedule.
|
|
639
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
640
|
+
# will be added to the HTTP request.
|
|
641
|
+
#
|
|
642
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
643
|
+
#
|
|
644
|
+
def begin_execute_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
|
|
645
|
+
begin_execute_async(resource_group_name, lab_name, name, custom_headers).value!
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
#
|
|
649
|
+
# Execute a schedule. This operation can take a while to complete.
|
|
650
|
+
#
|
|
651
|
+
# @param resource_group_name [String] The name of the resource group.
|
|
652
|
+
# @param lab_name [String] The name of the lab.
|
|
653
|
+
# @param name [String] The name of the schedule.
|
|
654
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
655
|
+
# to the HTTP request.
|
|
656
|
+
#
|
|
657
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
658
|
+
#
|
|
659
|
+
def begin_execute_async(resource_group_name, lab_name, name, custom_headers = nil)
|
|
660
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
|
661
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
|
662
|
+
fail ArgumentError, 'lab_name is nil' if lab_name.nil?
|
|
663
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
|
664
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
request_headers = {}
|
|
668
|
+
|
|
669
|
+
# Set Headers
|
|
670
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
671
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
672
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute'
|
|
673
|
+
options = {
|
|
674
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
675
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
|
|
676
|
+
query_params: {'api-version' => @client.api_version},
|
|
677
|
+
headers: request_headers.merge(custom_headers || {})
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
request_url = @base_url || @client.base_url
|
|
681
|
+
|
|
682
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
|
|
683
|
+
promise = request.run_promise do |req|
|
|
684
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
|
685
|
+
end
|
|
686
|
+
|
|
687
|
+
promise = promise.then do |http_response|
|
|
688
|
+
status_code = http_response.status
|
|
689
|
+
response_content = http_response.body
|
|
690
|
+
unless status_code == 200 || status_code == 202
|
|
691
|
+
error_model = JSON.load(response_content)
|
|
692
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
|
693
|
+
end
|
|
694
|
+
|
|
695
|
+
# Create Result
|
|
696
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
|
697
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
698
|
+
|
|
699
|
+
result
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
promise.execute
|
|
703
|
+
end
|
|
704
|
+
|
|
705
|
+
#
|
|
706
|
+
# List schedules in a given lab.
|
|
707
|
+
#
|
|
708
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
|
709
|
+
# call 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 [ResponseWithContinuationSchedule] operation results.
|
|
714
|
+
#
|
|
715
|
+
def list_next(next_page_link, custom_headers = nil)
|
|
716
|
+
response = list_next_async(next_page_link, custom_headers).value!
|
|
717
|
+
response.body unless response.nil?
|
|
718
|
+
end
|
|
719
|
+
|
|
720
|
+
#
|
|
721
|
+
# List schedules in a given lab.
|
|
722
|
+
#
|
|
723
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
|
724
|
+
# call to List operation.
|
|
725
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
|
726
|
+
# will be added to the HTTP request.
|
|
727
|
+
#
|
|
728
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
|
729
|
+
#
|
|
730
|
+
def list_next_with_http_info(next_page_link, custom_headers = nil)
|
|
731
|
+
list_next_async(next_page_link, custom_headers).value!
|
|
732
|
+
end
|
|
733
|
+
|
|
734
|
+
#
|
|
735
|
+
# List schedules in a given lab.
|
|
736
|
+
#
|
|
737
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
|
738
|
+
# call to List operation.
|
|
739
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
|
740
|
+
# to the HTTP request.
|
|
741
|
+
#
|
|
742
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
|
743
|
+
#
|
|
744
|
+
def list_next_async(next_page_link, custom_headers = nil)
|
|
745
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
request_headers = {}
|
|
749
|
+
|
|
750
|
+
# Set Headers
|
|
751
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
|
752
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
|
753
|
+
path_template = '{nextLink}'
|
|
754
|
+
options = {
|
|
755
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
|
756
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
|
757
|
+
headers: request_headers.merge(custom_headers || {})
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
request_url = @base_url || @client.base_url
|
|
761
|
+
|
|
762
|
+
request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
|
|
763
|
+
promise = request.run_promise do |req|
|
|
764
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
|
765
|
+
end
|
|
766
|
+
|
|
767
|
+
promise = promise.then do |http_response|
|
|
768
|
+
status_code = http_response.status
|
|
769
|
+
response_content = http_response.body
|
|
770
|
+
unless status_code == 200
|
|
771
|
+
error_model = JSON.load(response_content)
|
|
772
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
|
773
|
+
end
|
|
774
|
+
|
|
775
|
+
# Create Result
|
|
776
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
|
777
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
|
778
|
+
# Deserialize Response
|
|
779
|
+
if status_code == 200
|
|
780
|
+
begin
|
|
781
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
|
782
|
+
result_mapper = ResponseWithContinuationSchedule.mapper()
|
|
783
|
+
result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
|
|
784
|
+
rescue Exception => e
|
|
785
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
|
786
|
+
end
|
|
787
|
+
end
|
|
788
|
+
|
|
789
|
+
result
|
|
790
|
+
end
|
|
791
|
+
|
|
792
|
+
promise.execute
|
|
793
|
+
end
|
|
794
|
+
|
|
795
|
+
end
|
|
796
|
+
end
|