azure_mgmt_databox 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2018-01-01/generated/azure_mgmt_databox.rb +94 -0
  4. data/lib/2018-01-01/generated/azure_mgmt_databox/data_box_management_client.rb +139 -0
  5. data/lib/2018-01-01/generated/azure_mgmt_databox/jobs.rb +1346 -0
  6. data/lib/2018-01-01/generated/azure_mgmt_databox/models/access_protocol.rb +16 -0
  7. data/lib/2018-01-01/generated/azure_mgmt_databox/models/account_credential_details.rb +82 -0
  8. data/lib/2018-01-01/generated/azure_mgmt_databox/models/address_type.rb +17 -0
  9. data/lib/2018-01-01/generated/azure_mgmt_databox/models/address_validation_output.rb +70 -0
  10. data/lib/2018-01-01/generated/azure_mgmt_databox/models/address_validation_status.rb +17 -0
  11. data/lib/2018-01-01/generated/azure_mgmt_databox/models/appliance_network_configuration.rb +59 -0
  12. data/lib/2018-01-01/generated/azure_mgmt_databox/models/arm_base_object.rb +71 -0
  13. data/lib/2018-01-01/generated/azure_mgmt_databox/models/available_sku_request.rb +93 -0
  14. data/lib/2018-01-01/generated/azure_mgmt_databox/models/available_skus_result.rb +99 -0
  15. data/lib/2018-01-01/generated/azure_mgmt_databox/models/cancellation_reason.rb +46 -0
  16. data/lib/2018-01-01/generated/azure_mgmt_databox/models/contact_details.rb +120 -0
  17. data/lib/2018-01-01/generated/azure_mgmt_databox/models/copy_log_details.rb +48 -0
  18. data/lib/2018-01-01/generated/azure_mgmt_databox/models/copy_progress.rb +108 -0
  19. data/lib/2018-01-01/generated/azure_mgmt_databox/models/copy_status.rb +20 -0
  20. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_account_copy_log_details.rb +74 -0
  21. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_disk_copy_log_details.rb +86 -0
  22. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_disk_copy_progress.rb +87 -0
  23. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_disk_job_details.rb +274 -0
  24. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_disk_job_secrets.rb +96 -0
  25. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_heavy_account_copy_log_details.rb +82 -0
  26. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_heavy_job_details.rb +219 -0
  27. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_heavy_job_secrets.rb +72 -0
  28. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_heavy_secret.rb +116 -0
  29. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_job_details.rb +219 -0
  30. data/lib/2018-01-01/generated/azure_mgmt_databox/models/data_box_secret.rb +116 -0
  31. data/lib/2018-01-01/generated/azure_mgmt_databox/models/databox_job_secrets.rb +71 -0
  32. data/lib/2018-01-01/generated/azure_mgmt_databox/models/destination_account_details.rb +59 -0
  33. data/lib/2018-01-01/generated/azure_mgmt_databox/models/destination_managed_disk_details.rb +82 -0
  34. data/lib/2018-01-01/generated/azure_mgmt_databox/models/destination_storage_account_details.rb +69 -0
  35. data/lib/2018-01-01/generated/azure_mgmt_databox/models/destination_to_service_location_map.rb +59 -0
  36. data/lib/2018-01-01/generated/azure_mgmt_databox/models/disk_secret.rb +60 -0
  37. data/lib/2018-01-01/generated/azure_mgmt_databox/models/error.rb +61 -0
  38. data/lib/2018-01-01/generated/azure_mgmt_databox/models/job_details.rb +236 -0
  39. data/lib/2018-01-01/generated/azure_mgmt_databox/models/job_error_details.rb +83 -0
  40. data/lib/2018-01-01/generated/azure_mgmt_databox/models/job_resource.rb +211 -0
  41. data/lib/2018-01-01/generated/azure_mgmt_databox/models/job_resource_list.rb +98 -0
  42. data/lib/2018-01-01/generated/azure_mgmt_databox/models/job_resource_update_parameter.rb +90 -0
  43. data/lib/2018-01-01/generated/azure_mgmt_databox/models/job_secrets.rb +48 -0
  44. data/lib/2018-01-01/generated/azure_mgmt_databox/models/job_stages.rb +124 -0
  45. data/lib/2018-01-01/generated/azure_mgmt_databox/models/notification_preference.rb +60 -0
  46. data/lib/2018-01-01/generated/azure_mgmt_databox/models/notification_stage_name.rb +20 -0
  47. data/lib/2018-01-01/generated/azure_mgmt_databox/models/operation.rb +86 -0
  48. data/lib/2018-01-01/generated/azure_mgmt_databox/models/operation_display.rb +80 -0
  49. data/lib/2018-01-01/generated/azure_mgmt_databox/models/operation_list.rb +99 -0
  50. data/lib/2018-01-01/generated/azure_mgmt_databox/models/package_shipping_details.rb +71 -0
  51. data/lib/2018-01-01/generated/azure_mgmt_databox/models/preferences.rb +54 -0
  52. data/lib/2018-01-01/generated/azure_mgmt_databox/models/resource.rb +92 -0
  53. data/lib/2018-01-01/generated/azure_mgmt_databox/models/share_credential_details.rb +108 -0
  54. data/lib/2018-01-01/generated/azure_mgmt_databox/models/share_destination_format_type.rb +20 -0
  55. data/lib/2018-01-01/generated/azure_mgmt_databox/models/shipment_pick_up_request.rb +70 -0
  56. data/lib/2018-01-01/generated/azure_mgmt_databox/models/shipment_pick_up_response.rb +60 -0
  57. data/lib/2018-01-01/generated/azure_mgmt_databox/models/shipping_address.rb +147 -0
  58. data/lib/2018-01-01/generated/azure_mgmt_databox/models/sku.rb +70 -0
  59. data/lib/2018-01-01/generated/azure_mgmt_databox/models/sku_capacity.rb +59 -0
  60. data/lib/2018-01-01/generated/azure_mgmt_databox/models/sku_cost.rb +59 -0
  61. data/lib/2018-01-01/generated/azure_mgmt_databox/models/sku_disabled_reason.rb +20 -0
  62. data/lib/2018-01-01/generated/azure_mgmt_databox/models/sku_information.rb +175 -0
  63. data/lib/2018-01-01/generated/azure_mgmt_databox/models/sku_name.rb +17 -0
  64. data/lib/2018-01-01/generated/azure_mgmt_databox/models/stage_name.rb +27 -0
  65. data/lib/2018-01-01/generated/azure_mgmt_databox/models/stage_status.rb +21 -0
  66. data/lib/2018-01-01/generated/azure_mgmt_databox/models/unencrypted_credentials.rb +62 -0
  67. data/lib/2018-01-01/generated/azure_mgmt_databox/models/unencrypted_credentials_list.rb +67 -0
  68. data/lib/2018-01-01/generated/azure_mgmt_databox/models/update_job_details.rb +59 -0
  69. data/lib/2018-01-01/generated/azure_mgmt_databox/models/validate_address.rb +61 -0
  70. data/lib/2018-01-01/generated/azure_mgmt_databox/module_definition.rb +9 -0
  71. data/lib/2018-01-01/generated/azure_mgmt_databox/operations.rb +218 -0
  72. data/lib/2018-01-01/generated/azure_mgmt_databox/service.rb +353 -0
  73. data/lib/azure_mgmt_databox.rb +6 -0
  74. data/lib/module_definition.rb +7 -0
  75. data/lib/profiles/latest/databox_latest_profile_client.rb +40 -0
  76. data/lib/profiles/latest/databox_module_definition.rb +8 -0
  77. data/lib/profiles/latest/modules/databox_profile_module.rb +321 -0
  78. data/lib/version.rb +7 -0
  79. metadata +194 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 84d3d8e0ad1e346ae58be74e43820bc6a5307b204407ccd41a731fb07590430c
4
+ data.tar.gz: 0fd5ccb7c5420266093d72ea862379cb6762e38ac205c85be29b29b22f791552
5
+ SHA512:
6
+ metadata.gz: f0a744c6c2b0b8c5e32c206dc828d74c6777c58d38ff9532ad09178c7b75460a567d196625ddcf3fb91688db5e6332ecb70d9fec0003a99cae7f6a8a13175280
7
+ data.tar.gz: 40352f253ec05f2ed87f8710d56d56055a5f75c2e2f201120e3373f23025d85a4dd6f9945f95bdcb1290f379a5ab09a3e4d753f28675fb98b8d45b80a5073fde
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,94 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2018-01-01/generated/azure_mgmt_databox/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::DataBox::Mgmt::V2018_01_01
23
+ autoload :Operations, '2018-01-01/generated/azure_mgmt_databox/operations.rb'
24
+ autoload :Jobs, '2018-01-01/generated/azure_mgmt_databox/jobs.rb'
25
+ autoload :Service, '2018-01-01/generated/azure_mgmt_databox/service.rb'
26
+ autoload :DataBoxManagementClient, '2018-01-01/generated/azure_mgmt_databox/data_box_management_client.rb'
27
+
28
+ module Models
29
+ autoload :DiskSecret, '2018-01-01/generated/azure_mgmt_databox/models/disk_secret.rb'
30
+ autoload :Operation, '2018-01-01/generated/azure_mgmt_databox/models/operation.rb'
31
+ autoload :AccountCredentialDetails, '2018-01-01/generated/azure_mgmt_databox/models/account_credential_details.rb'
32
+ autoload :Resource, '2018-01-01/generated/azure_mgmt_databox/models/resource.rb'
33
+ autoload :AddressValidationOutput, '2018-01-01/generated/azure_mgmt_databox/models/address_validation_output.rb'
34
+ autoload :OperationList, '2018-01-01/generated/azure_mgmt_databox/models/operation_list.rb'
35
+ autoload :ArmBaseObject, '2018-01-01/generated/azure_mgmt_databox/models/arm_base_object.rb'
36
+ autoload :DataBoxHeavySecret, '2018-01-01/generated/azure_mgmt_databox/models/data_box_heavy_secret.rb'
37
+ autoload :Sku, '2018-01-01/generated/azure_mgmt_databox/models/sku.rb'
38
+ autoload :SkuCapacity, '2018-01-01/generated/azure_mgmt_databox/models/sku_capacity.rb'
39
+ autoload :ValidateAddress, '2018-01-01/generated/azure_mgmt_databox/models/validate_address.rb'
40
+ autoload :SkuInformation, '2018-01-01/generated/azure_mgmt_databox/models/sku_information.rb'
41
+ autoload :DataBoxSecret, '2018-01-01/generated/azure_mgmt_databox/models/data_box_secret.rb'
42
+ autoload :CancellationReason, '2018-01-01/generated/azure_mgmt_databox/models/cancellation_reason.rb'
43
+ autoload :UnencryptedCredentialsList, '2018-01-01/generated/azure_mgmt_databox/models/unencrypted_credentials_list.rb'
44
+ autoload :ContactDetails, '2018-01-01/generated/azure_mgmt_databox/models/contact_details.rb'
45
+ autoload :DestinationAccountDetails, '2018-01-01/generated/azure_mgmt_databox/models/destination_account_details.rb'
46
+ autoload :CopyProgress, '2018-01-01/generated/azure_mgmt_databox/models/copy_progress.rb'
47
+ autoload :UnencryptedCredentials, '2018-01-01/generated/azure_mgmt_databox/models/unencrypted_credentials.rb'
48
+ autoload :JobResourceUpdateParameter, '2018-01-01/generated/azure_mgmt_databox/models/job_resource_update_parameter.rb'
49
+ autoload :DataBoxDiskCopyProgress, '2018-01-01/generated/azure_mgmt_databox/models/data_box_disk_copy_progress.rb'
50
+ autoload :JobSecrets, '2018-01-01/generated/azure_mgmt_databox/models/job_secrets.rb'
51
+ autoload :ShareCredentialDetails, '2018-01-01/generated/azure_mgmt_databox/models/share_credential_details.rb'
52
+ autoload :ShipmentPickUpResponse, '2018-01-01/generated/azure_mgmt_databox/models/shipment_pick_up_response.rb'
53
+ autoload :ApplianceNetworkConfiguration, '2018-01-01/generated/azure_mgmt_databox/models/appliance_network_configuration.rb'
54
+ autoload :Error, '2018-01-01/generated/azure_mgmt_databox/models/error.rb'
55
+ autoload :DestinationToServiceLocationMap, '2018-01-01/generated/azure_mgmt_databox/models/destination_to_service_location_map.rb'
56
+ autoload :JobErrorDetails, '2018-01-01/generated/azure_mgmt_databox/models/job_error_details.rb'
57
+ autoload :AvailableSkusResult, '2018-01-01/generated/azure_mgmt_databox/models/available_skus_result.rb'
58
+ autoload :JobStages, '2018-01-01/generated/azure_mgmt_databox/models/job_stages.rb'
59
+ autoload :CopyLogDetails, '2018-01-01/generated/azure_mgmt_databox/models/copy_log_details.rb'
60
+ autoload :PackageShippingDetails, '2018-01-01/generated/azure_mgmt_databox/models/package_shipping_details.rb'
61
+ autoload :ShippingAddress, '2018-01-01/generated/azure_mgmt_databox/models/shipping_address.rb'
62
+ autoload :Preferences, '2018-01-01/generated/azure_mgmt_databox/models/preferences.rb'
63
+ autoload :SkuCost, '2018-01-01/generated/azure_mgmt_databox/models/sku_cost.rb'
64
+ autoload :JobDetails, '2018-01-01/generated/azure_mgmt_databox/models/job_details.rb'
65
+ autoload :OperationDisplay, '2018-01-01/generated/azure_mgmt_databox/models/operation_display.rb'
66
+ autoload :ShipmentPickUpRequest, '2018-01-01/generated/azure_mgmt_databox/models/shipment_pick_up_request.rb'
67
+ autoload :NotificationPreference, '2018-01-01/generated/azure_mgmt_databox/models/notification_preference.rb'
68
+ autoload :JobResourceList, '2018-01-01/generated/azure_mgmt_databox/models/job_resource_list.rb'
69
+ autoload :AvailableSkuRequest, '2018-01-01/generated/azure_mgmt_databox/models/available_sku_request.rb'
70
+ autoload :UpdateJobDetails, '2018-01-01/generated/azure_mgmt_databox/models/update_job_details.rb'
71
+ autoload :DataBoxAccountCopyLogDetails, '2018-01-01/generated/azure_mgmt_databox/models/data_box_account_copy_log_details.rb'
72
+ autoload :DataBoxDiskCopyLogDetails, '2018-01-01/generated/azure_mgmt_databox/models/data_box_disk_copy_log_details.rb'
73
+ autoload :DataBoxDiskJobDetails, '2018-01-01/generated/azure_mgmt_databox/models/data_box_disk_job_details.rb'
74
+ autoload :DataBoxDiskJobSecrets, '2018-01-01/generated/azure_mgmt_databox/models/data_box_disk_job_secrets.rb'
75
+ autoload :DataBoxHeavyAccountCopyLogDetails, '2018-01-01/generated/azure_mgmt_databox/models/data_box_heavy_account_copy_log_details.rb'
76
+ autoload :DataBoxHeavyJobDetails, '2018-01-01/generated/azure_mgmt_databox/models/data_box_heavy_job_details.rb'
77
+ autoload :DataBoxHeavyJobSecrets, '2018-01-01/generated/azure_mgmt_databox/models/data_box_heavy_job_secrets.rb'
78
+ autoload :DataBoxJobDetails, '2018-01-01/generated/azure_mgmt_databox/models/data_box_job_details.rb'
79
+ autoload :DataboxJobSecrets, '2018-01-01/generated/azure_mgmt_databox/models/databox_job_secrets.rb'
80
+ autoload :DestinationManagedDiskDetails, '2018-01-01/generated/azure_mgmt_databox/models/destination_managed_disk_details.rb'
81
+ autoload :DestinationStorageAccountDetails, '2018-01-01/generated/azure_mgmt_databox/models/destination_storage_account_details.rb'
82
+ autoload :JobResource, '2018-01-01/generated/azure_mgmt_databox/models/job_resource.rb'
83
+ autoload :ShareDestinationFormatType, '2018-01-01/generated/azure_mgmt_databox/models/share_destination_format_type.rb'
84
+ autoload :AccessProtocol, '2018-01-01/generated/azure_mgmt_databox/models/access_protocol.rb'
85
+ autoload :AddressValidationStatus, '2018-01-01/generated/azure_mgmt_databox/models/address_validation_status.rb'
86
+ autoload :AddressType, '2018-01-01/generated/azure_mgmt_databox/models/address_type.rb'
87
+ autoload :SkuName, '2018-01-01/generated/azure_mgmt_databox/models/sku_name.rb'
88
+ autoload :SkuDisabledReason, '2018-01-01/generated/azure_mgmt_databox/models/sku_disabled_reason.rb'
89
+ autoload :NotificationStageName, '2018-01-01/generated/azure_mgmt_databox/models/notification_stage_name.rb'
90
+ autoload :CopyStatus, '2018-01-01/generated/azure_mgmt_databox/models/copy_status.rb'
91
+ autoload :StageName, '2018-01-01/generated/azure_mgmt_databox/models/stage_name.rb'
92
+ autoload :StageStatus, '2018-01-01/generated/azure_mgmt_databox/models/stage_status.rb'
93
+ end
94
+ end
@@ -0,0 +1,139 @@
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::DataBox::Mgmt::V2018_01_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class DataBoxManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The API Version
21
+ attr_reader :api_version
22
+
23
+ # @return [String] The Subscription Id
24
+ attr_accessor :subscription_id
25
+
26
+ # @return [String] The preferred language for the response.
27
+ attr_accessor :accept_language
28
+
29
+ # @return [Integer] The retry timeout in seconds for Long Running
30
+ # Operations. Default value is 30.
31
+ attr_accessor :long_running_operation_retry_timeout
32
+
33
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
34
+ # generated. When set to true a unique x-ms-client-request-id value is
35
+ # generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return [Operations] operations
39
+ attr_reader :operations
40
+
41
+ # @return [Jobs] jobs
42
+ attr_reader :jobs
43
+
44
+ # @return [Service] service
45
+ attr_reader :service
46
+
47
+ #
48
+ # Creates initializes a new instance of the DataBoxManagementClient class.
49
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
50
+ # @param base_url [String] the base URI of the service.
51
+ # @param options [Array] filters to be applied to the HTTP requests.
52
+ #
53
+ def initialize(credentials = nil, base_url = nil, options = nil)
54
+ super(credentials, options)
55
+ @base_url = base_url || 'https://management.azure.com'
56
+
57
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
58
+ @credentials = credentials
59
+
60
+ @operations = Operations.new(self)
61
+ @jobs = Jobs.new(self)
62
+ @service = Service.new(self)
63
+ @api_version = '2018-01-01'
64
+ @accept_language = 'en-US'
65
+ @long_running_operation_retry_timeout = 30
66
+ @generate_client_request_id = true
67
+ add_telemetry
68
+ end
69
+
70
+ #
71
+ # Makes a request and returns the body of the response.
72
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
73
+ # @param path [String] the path, relative to {base_url}.
74
+ # @param options [Hash{String=>String}] specifying any request options like :body.
75
+ # @return [Hash{String=>String}] containing the body of the response.
76
+ # Example:
77
+ #
78
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
79
+ # path = "/path"
80
+ # options = {
81
+ # body: request_content,
82
+ # query_params: {'api-version' => '2016-02-01'}
83
+ # }
84
+ # result = @client.make_request(:put, path, options)
85
+ #
86
+ def make_request(method, path, options = {})
87
+ result = make_request_with_http_info(method, path, options)
88
+ result.body unless result.nil?
89
+ end
90
+
91
+ #
92
+ # Makes a request and returns the operation response.
93
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
94
+ # @param path [String] the path, relative to {base_url}.
95
+ # @param options [Hash{String=>String}] specifying any request options like :body.
96
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
97
+ #
98
+ def make_request_with_http_info(method, path, options = {})
99
+ result = make_request_async(method, path, options).value!
100
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
101
+ result
102
+ end
103
+
104
+ #
105
+ # Makes a request asynchronously.
106
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
107
+ # @param path [String] the path, relative to {base_url}.
108
+ # @param options [Hash{String=>String}] specifying any request options like :body.
109
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
110
+ #
111
+ def make_request_async(method, path, options = {})
112
+ fail ArgumentError, 'method is nil' if method.nil?
113
+ fail ArgumentError, 'path is nil' if path.nil?
114
+
115
+ request_url = options[:base_url] || @base_url
116
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
117
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
118
+ end
119
+
120
+ request_headers = @request_headers
121
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
122
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
123
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
124
+
125
+ super(request_url, method, path, options)
126
+ end
127
+
128
+
129
+ private
130
+ #
131
+ # Adds telemetry information.
132
+ #
133
+ def add_telemetry
134
+ sdk_information = 'azure_mgmt_databox'
135
+ sdk_information = "#{sdk_information}/0.17.0"
136
+ add_user_agent_information(sdk_information)
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,1346 @@
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::DataBox::Mgmt::V2018_01_01
7
+ #
8
+ # Jobs
9
+ #
10
+ class Jobs
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Jobs class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [DataBoxManagementClient] reference to the DataBoxManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists all the jobs available under the subscription.
26
+ #
27
+ # @param skip_token [String] $skipToken is supported on Get list of jobs, which
28
+ # provides the next page in the list of jobs.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [Array<JobResource>] operation results.
33
+ #
34
+ def list(skip_token:nil, custom_headers:nil)
35
+ first_page = list_as_lazy(skip_token:skip_token, custom_headers:custom_headers)
36
+ first_page.get_all_items
37
+ end
38
+
39
+ #
40
+ # Lists all the jobs available under the subscription.
41
+ #
42
+ # @param skip_token [String] $skipToken is supported on Get list of jobs, which
43
+ # provides the next page in the list of jobs.
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_with_http_info(skip_token:nil, custom_headers:nil)
50
+ list_async(skip_token:skip_token, custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Lists all the jobs available under the subscription.
55
+ #
56
+ # @param skip_token [String] $skipToken is supported on Get list of jobs, which
57
+ # provides the next page in the list of jobs.
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_async(skip_token:nil, custom_headers:nil)
64
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
65
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
66
+
67
+
68
+ request_headers = {}
69
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
70
+
71
+ # Set Headers
72
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
73
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
74
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.DataBox/jobs'
75
+
76
+ request_url = @base_url || @client.base_url
77
+
78
+ options = {
79
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
80
+ path_params: {'subscriptionId' => @client.subscription_id},
81
+ query_params: {'api-version' => @client.api_version,'$skipToken' => skip_token},
82
+ headers: request_headers.merge(custom_headers || {}),
83
+ base_url: request_url
84
+ }
85
+ promise = @client.make_request_async(:get, path_template, options)
86
+
87
+ promise = promise.then do |result|
88
+ http_response = result.response
89
+ status_code = http_response.status
90
+ response_content = http_response.body
91
+ unless status_code == 200
92
+ error_model = JSON.load(response_content)
93
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
94
+ end
95
+
96
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
97
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
98
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
99
+ # Deserialize Response
100
+ if status_code == 200
101
+ begin
102
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
103
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResourceList.mapper()
104
+ result.body = @client.deserialize(result_mapper, parsed_response)
105
+ rescue Exception => e
106
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
107
+ end
108
+ end
109
+
110
+ result
111
+ end
112
+
113
+ promise.execute
114
+ end
115
+
116
+ #
117
+ # Lists all the jobs available under the given resource group.
118
+ #
119
+ # @param resource_group_name [String] The Resource Group Name
120
+ # @param skip_token [String] $skipToken is supported on Get list of jobs, which
121
+ # provides the next page in the list of jobs.
122
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
123
+ # will be added to the HTTP request.
124
+ #
125
+ # @return [Array<JobResource>] operation results.
126
+ #
127
+ def list_by_resource_group(resource_group_name, skip_token:nil, custom_headers:nil)
128
+ first_page = list_by_resource_group_as_lazy(resource_group_name, skip_token:skip_token, custom_headers:custom_headers)
129
+ first_page.get_all_items
130
+ end
131
+
132
+ #
133
+ # Lists all the jobs available under the given resource group.
134
+ #
135
+ # @param resource_group_name [String] The Resource Group Name
136
+ # @param skip_token [String] $skipToken is supported on Get list of jobs, which
137
+ # provides the next page in the list of jobs.
138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
139
+ # will be added to the HTTP request.
140
+ #
141
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
142
+ #
143
+ def list_by_resource_group_with_http_info(resource_group_name, skip_token:nil, custom_headers:nil)
144
+ list_by_resource_group_async(resource_group_name, skip_token:skip_token, custom_headers:custom_headers).value!
145
+ end
146
+
147
+ #
148
+ # Lists all the jobs available under the given resource group.
149
+ #
150
+ # @param resource_group_name [String] The Resource Group Name
151
+ # @param skip_token [String] $skipToken is supported on Get list of jobs, which
152
+ # provides the next page in the list of jobs.
153
+ # @param [Hash{String => String}] A hash of custom headers that will be added
154
+ # to the HTTP request.
155
+ #
156
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
157
+ #
158
+ def list_by_resource_group_async(resource_group_name, skip_token:nil, custom_headers:nil)
159
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
160
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
161
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
162
+
163
+
164
+ request_headers = {}
165
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
166
+
167
+ # Set Headers
168
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
169
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
170
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs'
171
+
172
+ request_url = @base_url || @client.base_url
173
+
174
+ options = {
175
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
176
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
177
+ query_params: {'api-version' => @client.api_version,'$skipToken' => skip_token},
178
+ headers: request_headers.merge(custom_headers || {}),
179
+ base_url: request_url
180
+ }
181
+ promise = @client.make_request_async(:get, path_template, options)
182
+
183
+ promise = promise.then do |result|
184
+ http_response = result.response
185
+ status_code = http_response.status
186
+ response_content = http_response.body
187
+ unless status_code == 200
188
+ error_model = JSON.load(response_content)
189
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
190
+ end
191
+
192
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
193
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
194
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
195
+ # Deserialize Response
196
+ if status_code == 200
197
+ begin
198
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
199
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResourceList.mapper()
200
+ result.body = @client.deserialize(result_mapper, parsed_response)
201
+ rescue Exception => e
202
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
203
+ end
204
+ end
205
+
206
+ result
207
+ end
208
+
209
+ promise.execute
210
+ end
211
+
212
+ #
213
+ # Gets information about the specified job.
214
+ #
215
+ # @param resource_group_name [String] The Resource Group Name
216
+ # @param job_name [String] The name of the job Resource within the specified
217
+ # resource group. job names must be between 3 and 24 characters in length and
218
+ # use any alphanumeric and underscore only
219
+ # @param expand [String] $expand is supported on details parameter for job,
220
+ # which provides details on the job stages.
221
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
222
+ # will be added to the HTTP request.
223
+ #
224
+ # @return [JobResource] operation results.
225
+ #
226
+ def get(resource_group_name, job_name, expand:nil, custom_headers:nil)
227
+ response = get_async(resource_group_name, job_name, expand:expand, custom_headers:custom_headers).value!
228
+ response.body unless response.nil?
229
+ end
230
+
231
+ #
232
+ # Gets information about the specified job.
233
+ #
234
+ # @param resource_group_name [String] The Resource Group Name
235
+ # @param job_name [String] The name of the job Resource within the specified
236
+ # resource group. job names must be between 3 and 24 characters in length and
237
+ # use any alphanumeric and underscore only
238
+ # @param expand [String] $expand is supported on details parameter for job,
239
+ # which provides details on the job stages.
240
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
241
+ # will be added to the HTTP request.
242
+ #
243
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
244
+ #
245
+ def get_with_http_info(resource_group_name, job_name, expand:nil, custom_headers:nil)
246
+ get_async(resource_group_name, job_name, expand:expand, custom_headers:custom_headers).value!
247
+ end
248
+
249
+ #
250
+ # Gets information about the specified job.
251
+ #
252
+ # @param resource_group_name [String] The Resource Group Name
253
+ # @param job_name [String] The name of the job Resource within the specified
254
+ # resource group. job names must be between 3 and 24 characters in length and
255
+ # use any alphanumeric and underscore only
256
+ # @param expand [String] $expand is supported on details parameter for job,
257
+ # which provides details on the job stages.
258
+ # @param [Hash{String => String}] A hash of custom headers that will be added
259
+ # to the HTTP request.
260
+ #
261
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
262
+ #
263
+ def get_async(resource_group_name, job_name, expand:nil, custom_headers:nil)
264
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
265
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
266
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
267
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
268
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
269
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
270
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
271
+
272
+
273
+ request_headers = {}
274
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
275
+
276
+ # Set Headers
277
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
278
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
279
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'
280
+
281
+ request_url = @base_url || @client.base_url
282
+
283
+ options = {
284
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
285
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
286
+ query_params: {'api-version' => @client.api_version,'$expand' => expand},
287
+ headers: request_headers.merge(custom_headers || {}),
288
+ base_url: request_url
289
+ }
290
+ promise = @client.make_request_async(:get, path_template, options)
291
+
292
+ promise = promise.then do |result|
293
+ http_response = result.response
294
+ status_code = http_response.status
295
+ response_content = http_response.body
296
+ unless status_code == 200
297
+ error_model = JSON.load(response_content)
298
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
299
+ end
300
+
301
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
302
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
303
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
304
+ # Deserialize Response
305
+ if status_code == 200
306
+ begin
307
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
308
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.mapper()
309
+ result.body = @client.deserialize(result_mapper, parsed_response)
310
+ rescue Exception => e
311
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
312
+ end
313
+ end
314
+
315
+ result
316
+ end
317
+
318
+ promise.execute
319
+ end
320
+
321
+ #
322
+ # Creates a new job with the specified parameters. Existing job cannot be
323
+ # updated with this API and should instead be updated with the Update job API.
324
+ #
325
+ # @param resource_group_name [String] The Resource Group Name
326
+ # @param job_name [String] The name of the job Resource within the specified
327
+ # resource group. job names must be between 3 and 24 characters in length and
328
+ # use any alphanumeric and underscore only
329
+ # @param job_resource [JobResource] Job details from request body.
330
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
331
+ # will be added to the HTTP request.
332
+ #
333
+ # @return [JobResource] operation results.
334
+ #
335
+ def create(resource_group_name, job_name, job_resource, custom_headers:nil)
336
+ response = create_async(resource_group_name, job_name, job_resource, custom_headers:custom_headers).value!
337
+ response.body unless response.nil?
338
+ end
339
+
340
+ #
341
+ # @param resource_group_name [String] The Resource Group Name
342
+ # @param job_name [String] The name of the job Resource within the specified
343
+ # resource group. job names must be between 3 and 24 characters in length and
344
+ # use any alphanumeric and underscore only
345
+ # @param job_resource [JobResource] Job details from request body.
346
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
347
+ # will be added to the HTTP request.
348
+ #
349
+ # @return [Concurrent::Promise] promise which provides async access to http
350
+ # response.
351
+ #
352
+ def create_async(resource_group_name, job_name, job_resource, custom_headers:nil)
353
+ # Send request
354
+ promise = begin_create_async(resource_group_name, job_name, job_resource, custom_headers:custom_headers)
355
+
356
+ promise = promise.then do |response|
357
+ # Defining deserialization method.
358
+ deserialize_method = lambda do |parsed_response|
359
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.mapper()
360
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
361
+ end
362
+
363
+ # Waiting for response.
364
+ @client.get_long_running_operation_result(response, deserialize_method)
365
+ end
366
+
367
+ promise
368
+ end
369
+
370
+ #
371
+ # Deletes a job.
372
+ #
373
+ # @param resource_group_name [String] The Resource Group Name
374
+ # @param job_name [String] The name of the job Resource within the specified
375
+ # resource group. job names must be between 3 and 24 characters in length and
376
+ # use any alphanumeric and underscore only
377
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
378
+ # will be added to the HTTP request.
379
+ #
380
+ def delete(resource_group_name, job_name, custom_headers:nil)
381
+ response = delete_async(resource_group_name, job_name, custom_headers:custom_headers).value!
382
+ nil
383
+ end
384
+
385
+ #
386
+ # @param resource_group_name [String] The Resource Group Name
387
+ # @param job_name [String] The name of the job Resource within the specified
388
+ # resource group. job names must be between 3 and 24 characters in length and
389
+ # use any alphanumeric and underscore only
390
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
391
+ # will be added to the HTTP request.
392
+ #
393
+ # @return [Concurrent::Promise] promise which provides async access to http
394
+ # response.
395
+ #
396
+ def delete_async(resource_group_name, job_name, custom_headers:nil)
397
+ # Send request
398
+ promise = begin_delete_async(resource_group_name, job_name, custom_headers:custom_headers)
399
+
400
+ promise = promise.then do |response|
401
+ # Defining deserialization method.
402
+ deserialize_method = lambda do |parsed_response|
403
+ end
404
+
405
+ # Waiting for response.
406
+ @client.get_long_running_operation_result(response, deserialize_method)
407
+ end
408
+
409
+ promise
410
+ end
411
+
412
+ #
413
+ # Updates the properties of an existing job.
414
+ #
415
+ # @param resource_group_name [String] The Resource Group Name
416
+ # @param job_name [String] The name of the job Resource within the specified
417
+ # resource group. job names must be between 3 and 24 characters in length and
418
+ # use any alphanumeric and underscore only
419
+ # @param job_resource_update_parameter [JobResourceUpdateParameter] Job update
420
+ # parameters from request body.
421
+ # @param if_match [String] Defines the If-Match condition. The patch will be
422
+ # performed only if the ETag of the job on the server matches this value.
423
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
424
+ # will be added to the HTTP request.
425
+ #
426
+ # @return [JobResource] operation results.
427
+ #
428
+ def update(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil)
429
+ response = update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:if_match, custom_headers:custom_headers).value!
430
+ response.body unless response.nil?
431
+ end
432
+
433
+ #
434
+ # @param resource_group_name [String] The Resource Group Name
435
+ # @param job_name [String] The name of the job Resource within the specified
436
+ # resource group. job names must be between 3 and 24 characters in length and
437
+ # use any alphanumeric and underscore only
438
+ # @param job_resource_update_parameter [JobResourceUpdateParameter] Job update
439
+ # parameters from request body.
440
+ # @param if_match [String] Defines the If-Match condition. The patch will be
441
+ # performed only if the ETag of the job on the server matches this value.
442
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
443
+ # will be added to the HTTP request.
444
+ #
445
+ # @return [Concurrent::Promise] promise which provides async access to http
446
+ # response.
447
+ #
448
+ def update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil)
449
+ # Send request
450
+ promise = begin_update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:if_match, custom_headers:custom_headers)
451
+
452
+ promise = promise.then do |response|
453
+ # Defining deserialization method.
454
+ deserialize_method = lambda do |parsed_response|
455
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.mapper()
456
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
457
+ end
458
+
459
+ # Waiting for response.
460
+ @client.get_long_running_operation_result(response, deserialize_method)
461
+ end
462
+
463
+ promise
464
+ end
465
+
466
+ #
467
+ # Book shipment pick up.
468
+ #
469
+ # @param resource_group_name [String] The Resource Group Name
470
+ # @param job_name [String] The name of the job Resource within the specified
471
+ # resource group. job names must be between 3 and 24 characters in length and
472
+ # use any alphanumeric and underscore only
473
+ # @param shipment_pick_up_request [ShipmentPickUpRequest] Details of shipment
474
+ # pick up request.
475
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
476
+ # will be added to the HTTP request.
477
+ #
478
+ # @return [ShipmentPickUpResponse] operation results.
479
+ #
480
+ def book_shipment_pick_up(resource_group_name, job_name, shipment_pick_up_request, custom_headers:nil)
481
+ response = book_shipment_pick_up_async(resource_group_name, job_name, shipment_pick_up_request, custom_headers:custom_headers).value!
482
+ response.body unless response.nil?
483
+ end
484
+
485
+ #
486
+ # Book shipment pick up.
487
+ #
488
+ # @param resource_group_name [String] The Resource Group Name
489
+ # @param job_name [String] The name of the job Resource within the specified
490
+ # resource group. job names must be between 3 and 24 characters in length and
491
+ # use any alphanumeric and underscore only
492
+ # @param shipment_pick_up_request [ShipmentPickUpRequest] Details of shipment
493
+ # pick up request.
494
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
495
+ # will be added to the HTTP request.
496
+ #
497
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
498
+ #
499
+ def book_shipment_pick_up_with_http_info(resource_group_name, job_name, shipment_pick_up_request, custom_headers:nil)
500
+ book_shipment_pick_up_async(resource_group_name, job_name, shipment_pick_up_request, custom_headers:custom_headers).value!
501
+ end
502
+
503
+ #
504
+ # Book shipment pick up.
505
+ #
506
+ # @param resource_group_name [String] The Resource Group Name
507
+ # @param job_name [String] The name of the job Resource within the specified
508
+ # resource group. job names must be between 3 and 24 characters in length and
509
+ # use any alphanumeric and underscore only
510
+ # @param shipment_pick_up_request [ShipmentPickUpRequest] Details of shipment
511
+ # pick up request.
512
+ # @param [Hash{String => String}] A hash of custom headers that will be added
513
+ # to the HTTP request.
514
+ #
515
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
516
+ #
517
+ def book_shipment_pick_up_async(resource_group_name, job_name, shipment_pick_up_request, custom_headers:nil)
518
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
519
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
520
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
521
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
522
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
523
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
524
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
525
+ fail ArgumentError, 'shipment_pick_up_request is nil' if shipment_pick_up_request.nil?
526
+
527
+
528
+ request_headers = {}
529
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
530
+
531
+ # Set Headers
532
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
533
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
534
+
535
+ # Serialize Request
536
+ request_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::ShipmentPickUpRequest.mapper()
537
+ request_content = @client.serialize(request_mapper, shipment_pick_up_request)
538
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
539
+
540
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/bookShipmentPickUp'
541
+
542
+ request_url = @base_url || @client.base_url
543
+
544
+ options = {
545
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
546
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
547
+ query_params: {'api-version' => @client.api_version},
548
+ body: request_content,
549
+ headers: request_headers.merge(custom_headers || {}),
550
+ base_url: request_url
551
+ }
552
+ promise = @client.make_request_async(:post, path_template, options)
553
+
554
+ promise = promise.then do |result|
555
+ http_response = result.response
556
+ status_code = http_response.status
557
+ response_content = http_response.body
558
+ unless status_code == 200
559
+ error_model = JSON.load(response_content)
560
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
561
+ end
562
+
563
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
564
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
565
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
566
+ # Deserialize Response
567
+ if status_code == 200
568
+ begin
569
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
570
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::ShipmentPickUpResponse.mapper()
571
+ result.body = @client.deserialize(result_mapper, parsed_response)
572
+ rescue Exception => e
573
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
574
+ end
575
+ end
576
+
577
+ result
578
+ end
579
+
580
+ promise.execute
581
+ end
582
+
583
+ #
584
+ # CancelJob.
585
+ #
586
+ # @param resource_group_name [String] The Resource Group Name
587
+ # @param job_name [String] The name of the job Resource within the specified
588
+ # resource group. job names must be between 3 and 24 characters in length and
589
+ # use any alphanumeric and underscore only
590
+ # @param cancellation_reason [CancellationReason] Reason for cancellation.
591
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
592
+ # will be added to the HTTP request.
593
+ #
594
+ #
595
+ def cancel(resource_group_name, job_name, cancellation_reason, custom_headers:nil)
596
+ response = cancel_async(resource_group_name, job_name, cancellation_reason, custom_headers:custom_headers).value!
597
+ nil
598
+ end
599
+
600
+ #
601
+ # CancelJob.
602
+ #
603
+ # @param resource_group_name [String] The Resource Group Name
604
+ # @param job_name [String] The name of the job Resource within the specified
605
+ # resource group. job names must be between 3 and 24 characters in length and
606
+ # use any alphanumeric and underscore only
607
+ # @param cancellation_reason [CancellationReason] Reason for cancellation.
608
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
609
+ # will be added to the HTTP request.
610
+ #
611
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
612
+ #
613
+ def cancel_with_http_info(resource_group_name, job_name, cancellation_reason, custom_headers:nil)
614
+ cancel_async(resource_group_name, job_name, cancellation_reason, custom_headers:custom_headers).value!
615
+ end
616
+
617
+ #
618
+ # CancelJob.
619
+ #
620
+ # @param resource_group_name [String] The Resource Group Name
621
+ # @param job_name [String] The name of the job Resource within the specified
622
+ # resource group. job names must be between 3 and 24 characters in length and
623
+ # use any alphanumeric and underscore only
624
+ # @param cancellation_reason [CancellationReason] Reason for cancellation.
625
+ # @param [Hash{String => String}] A hash of custom headers that will be added
626
+ # to the HTTP request.
627
+ #
628
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
629
+ #
630
+ def cancel_async(resource_group_name, job_name, cancellation_reason, custom_headers:nil)
631
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
632
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
633
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
634
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
635
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
636
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
637
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
638
+ fail ArgumentError, 'cancellation_reason is nil' if cancellation_reason.nil?
639
+
640
+
641
+ request_headers = {}
642
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
643
+
644
+ # Set Headers
645
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
646
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
647
+
648
+ # Serialize Request
649
+ request_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::CancellationReason.mapper()
650
+ request_content = @client.serialize(request_mapper, cancellation_reason)
651
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
652
+
653
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/cancel'
654
+
655
+ request_url = @base_url || @client.base_url
656
+
657
+ options = {
658
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
659
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
660
+ query_params: {'api-version' => @client.api_version},
661
+ body: request_content,
662
+ headers: request_headers.merge(custom_headers || {}),
663
+ base_url: request_url
664
+ }
665
+ promise = @client.make_request_async(:post, path_template, options)
666
+
667
+ promise = promise.then do |result|
668
+ http_response = result.response
669
+ status_code = http_response.status
670
+ response_content = http_response.body
671
+ unless status_code == 204
672
+ error_model = JSON.load(response_content)
673
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
674
+ end
675
+
676
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
677
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
678
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
679
+
680
+ result
681
+ end
682
+
683
+ promise.execute
684
+ end
685
+
686
+ #
687
+ # This method gets the unencrypted secrets related to the job.
688
+ #
689
+ # @param resource_group_name [String] The Resource Group Name
690
+ # @param job_name [String] The name of the job Resource within the specified
691
+ # resource group. job names must be between 3 and 24 characters in length and
692
+ # use any alphanumeric and underscore only
693
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
694
+ # will be added to the HTTP request.
695
+ #
696
+ # @return [UnencryptedCredentialsList] operation results.
697
+ #
698
+ def list_credentials(resource_group_name, job_name, custom_headers:nil)
699
+ response = list_credentials_async(resource_group_name, job_name, custom_headers:custom_headers).value!
700
+ response.body unless response.nil?
701
+ end
702
+
703
+ #
704
+ # This method gets the unencrypted secrets related to the job.
705
+ #
706
+ # @param resource_group_name [String] The Resource Group Name
707
+ # @param job_name [String] The name of the job Resource within the specified
708
+ # resource group. job names must be between 3 and 24 characters in length and
709
+ # use any alphanumeric and underscore only
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_credentials_with_http_info(resource_group_name, job_name, custom_headers:nil)
716
+ list_credentials_async(resource_group_name, job_name, custom_headers:custom_headers).value!
717
+ end
718
+
719
+ #
720
+ # This method gets the unencrypted secrets related to the job.
721
+ #
722
+ # @param resource_group_name [String] The Resource Group Name
723
+ # @param job_name [String] The name of the job Resource within the specified
724
+ # resource group. job names must be between 3 and 24 characters in length and
725
+ # use any alphanumeric and underscore only
726
+ # @param [Hash{String => String}] A hash of custom headers that will be added
727
+ # to the HTTP request.
728
+ #
729
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
730
+ #
731
+ def list_credentials_async(resource_group_name, job_name, custom_headers:nil)
732
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
733
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
734
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
735
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
736
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
737
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
738
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
739
+
740
+
741
+ request_headers = {}
742
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
743
+
744
+ # Set Headers
745
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
746
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
747
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}/listCredentials'
748
+
749
+ request_url = @base_url || @client.base_url
750
+
751
+ options = {
752
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
753
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
754
+ query_params: {'api-version' => @client.api_version},
755
+ headers: request_headers.merge(custom_headers || {}),
756
+ base_url: request_url
757
+ }
758
+ promise = @client.make_request_async(:post, path_template, options)
759
+
760
+ promise = promise.then do |result|
761
+ http_response = result.response
762
+ status_code = http_response.status
763
+ response_content = http_response.body
764
+ unless status_code == 200
765
+ error_model = JSON.load(response_content)
766
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
767
+ end
768
+
769
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
770
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
771
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
772
+ # Deserialize Response
773
+ if status_code == 200
774
+ begin
775
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
776
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::UnencryptedCredentialsList.mapper()
777
+ result.body = @client.deserialize(result_mapper, parsed_response)
778
+ rescue Exception => e
779
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
780
+ end
781
+ end
782
+
783
+ result
784
+ end
785
+
786
+ promise.execute
787
+ end
788
+
789
+ #
790
+ # Creates a new job with the specified parameters. Existing job cannot be
791
+ # updated with this API and should instead be updated with the Update job API.
792
+ #
793
+ # @param resource_group_name [String] The Resource Group Name
794
+ # @param job_name [String] The name of the job Resource within the specified
795
+ # resource group. job names must be between 3 and 24 characters in length and
796
+ # use any alphanumeric and underscore only
797
+ # @param job_resource [JobResource] Job details from request body.
798
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
799
+ # will be added to the HTTP request.
800
+ #
801
+ # @return [JobResource] operation results.
802
+ #
803
+ def begin_create(resource_group_name, job_name, job_resource, custom_headers:nil)
804
+ response = begin_create_async(resource_group_name, job_name, job_resource, custom_headers:custom_headers).value!
805
+ response.body unless response.nil?
806
+ end
807
+
808
+ #
809
+ # Creates a new job with the specified parameters. Existing job cannot be
810
+ # updated with this API and should instead be updated with the Update job API.
811
+ #
812
+ # @param resource_group_name [String] The Resource Group Name
813
+ # @param job_name [String] The name of the job Resource within the specified
814
+ # resource group. job names must be between 3 and 24 characters in length and
815
+ # use any alphanumeric and underscore only
816
+ # @param job_resource [JobResource] Job details from request body.
817
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
818
+ # will be added to the HTTP request.
819
+ #
820
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
821
+ #
822
+ def begin_create_with_http_info(resource_group_name, job_name, job_resource, custom_headers:nil)
823
+ begin_create_async(resource_group_name, job_name, job_resource, custom_headers:custom_headers).value!
824
+ end
825
+
826
+ #
827
+ # Creates a new job with the specified parameters. Existing job cannot be
828
+ # updated with this API and should instead be updated with the Update job API.
829
+ #
830
+ # @param resource_group_name [String] The Resource Group Name
831
+ # @param job_name [String] The name of the job Resource within the specified
832
+ # resource group. job names must be between 3 and 24 characters in length and
833
+ # use any alphanumeric and underscore only
834
+ # @param job_resource [JobResource] Job details from request body.
835
+ # @param [Hash{String => String}] A hash of custom headers that will be added
836
+ # to the HTTP request.
837
+ #
838
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
839
+ #
840
+ def begin_create_async(resource_group_name, job_name, job_resource, custom_headers:nil)
841
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
842
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
843
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
844
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
845
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
846
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
847
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
848
+ fail ArgumentError, 'job_resource is nil' if job_resource.nil?
849
+
850
+
851
+ request_headers = {}
852
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
853
+
854
+ # Set Headers
855
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
856
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
857
+
858
+ # Serialize Request
859
+ request_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.mapper()
860
+ request_content = @client.serialize(request_mapper, job_resource)
861
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
862
+
863
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'
864
+
865
+ request_url = @base_url || @client.base_url
866
+
867
+ options = {
868
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
869
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
870
+ query_params: {'api-version' => @client.api_version},
871
+ body: request_content,
872
+ headers: request_headers.merge(custom_headers || {}),
873
+ base_url: request_url
874
+ }
875
+ promise = @client.make_request_async(:put, path_template, options)
876
+
877
+ promise = promise.then do |result|
878
+ http_response = result.response
879
+ status_code = http_response.status
880
+ response_content = http_response.body
881
+ unless status_code == 200 || status_code == 202
882
+ error_model = JSON.load(response_content)
883
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
884
+ end
885
+
886
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
887
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
888
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
889
+ # Deserialize Response
890
+ if status_code == 200
891
+ begin
892
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
893
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.mapper()
894
+ result.body = @client.deserialize(result_mapper, parsed_response)
895
+ rescue Exception => e
896
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
897
+ end
898
+ end
899
+
900
+ result
901
+ end
902
+
903
+ promise.execute
904
+ end
905
+
906
+ #
907
+ # Deletes a job.
908
+ #
909
+ # @param resource_group_name [String] The Resource Group Name
910
+ # @param job_name [String] The name of the job Resource within the specified
911
+ # resource group. job names must be between 3 and 24 characters in length and
912
+ # use any alphanumeric and underscore only
913
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
914
+ # will be added to the HTTP request.
915
+ #
916
+ #
917
+ def begin_delete(resource_group_name, job_name, custom_headers:nil)
918
+ response = begin_delete_async(resource_group_name, job_name, custom_headers:custom_headers).value!
919
+ nil
920
+ end
921
+
922
+ #
923
+ # Deletes a job.
924
+ #
925
+ # @param resource_group_name [String] The Resource Group Name
926
+ # @param job_name [String] The name of the job Resource within the specified
927
+ # resource group. job names must be between 3 and 24 characters in length and
928
+ # use any alphanumeric and underscore only
929
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
930
+ # will be added to the HTTP request.
931
+ #
932
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
933
+ #
934
+ def begin_delete_with_http_info(resource_group_name, job_name, custom_headers:nil)
935
+ begin_delete_async(resource_group_name, job_name, custom_headers:custom_headers).value!
936
+ end
937
+
938
+ #
939
+ # Deletes a job.
940
+ #
941
+ # @param resource_group_name [String] The Resource Group Name
942
+ # @param job_name [String] The name of the job Resource within the specified
943
+ # resource group. job names must be between 3 and 24 characters in length and
944
+ # use any alphanumeric and underscore only
945
+ # @param [Hash{String => String}] A hash of custom headers that will be added
946
+ # to the HTTP request.
947
+ #
948
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
949
+ #
950
+ def begin_delete_async(resource_group_name, job_name, custom_headers:nil)
951
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
952
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
953
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
954
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
955
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
956
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
957
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
958
+
959
+
960
+ request_headers = {}
961
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
962
+
963
+ # Set Headers
964
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
965
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
966
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'
967
+
968
+ request_url = @base_url || @client.base_url
969
+
970
+ options = {
971
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
972
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
973
+ query_params: {'api-version' => @client.api_version},
974
+ headers: request_headers.merge(custom_headers || {}),
975
+ base_url: request_url
976
+ }
977
+ promise = @client.make_request_async(:delete, path_template, options)
978
+
979
+ promise = promise.then do |result|
980
+ http_response = result.response
981
+ status_code = http_response.status
982
+ response_content = http_response.body
983
+ unless status_code == 202 || status_code == 204
984
+ error_model = JSON.load(response_content)
985
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
986
+ end
987
+
988
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
989
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
990
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
991
+
992
+ result
993
+ end
994
+
995
+ promise.execute
996
+ end
997
+
998
+ #
999
+ # Updates the properties of an existing job.
1000
+ #
1001
+ # @param resource_group_name [String] The Resource Group Name
1002
+ # @param job_name [String] The name of the job Resource within the specified
1003
+ # resource group. job names must be between 3 and 24 characters in length and
1004
+ # use any alphanumeric and underscore only
1005
+ # @param job_resource_update_parameter [JobResourceUpdateParameter] Job update
1006
+ # parameters from request body.
1007
+ # @param if_match [String] Defines the If-Match condition. The patch will be
1008
+ # performed only if the ETag of the job on the server matches this value.
1009
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1010
+ # will be added to the HTTP request.
1011
+ #
1012
+ # @return [JobResource] operation results.
1013
+ #
1014
+ def begin_update(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil)
1015
+ response = begin_update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:if_match, custom_headers:custom_headers).value!
1016
+ response.body unless response.nil?
1017
+ end
1018
+
1019
+ #
1020
+ # Updates the properties of an existing job.
1021
+ #
1022
+ # @param resource_group_name [String] The Resource Group Name
1023
+ # @param job_name [String] The name of the job Resource within the specified
1024
+ # resource group. job names must be between 3 and 24 characters in length and
1025
+ # use any alphanumeric and underscore only
1026
+ # @param job_resource_update_parameter [JobResourceUpdateParameter] Job update
1027
+ # parameters from request body.
1028
+ # @param if_match [String] Defines the If-Match condition. The patch will be
1029
+ # performed only if the ETag of the job on the server matches this value.
1030
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1031
+ # will be added to the HTTP request.
1032
+ #
1033
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1034
+ #
1035
+ def begin_update_with_http_info(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil)
1036
+ begin_update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:if_match, custom_headers:custom_headers).value!
1037
+ end
1038
+
1039
+ #
1040
+ # Updates the properties of an existing job.
1041
+ #
1042
+ # @param resource_group_name [String] The Resource Group Name
1043
+ # @param job_name [String] The name of the job Resource within the specified
1044
+ # resource group. job names must be between 3 and 24 characters in length and
1045
+ # use any alphanumeric and underscore only
1046
+ # @param job_resource_update_parameter [JobResourceUpdateParameter] Job update
1047
+ # parameters from request body.
1048
+ # @param if_match [String] Defines the If-Match condition. The patch will be
1049
+ # performed only if the ETag of the job on the server matches this value.
1050
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1051
+ # to the HTTP request.
1052
+ #
1053
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1054
+ #
1055
+ def begin_update_async(resource_group_name, job_name, job_resource_update_parameter, if_match:nil, custom_headers:nil)
1056
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1057
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1058
+ fail ArgumentError, 'job_name is nil' if job_name.nil?
1059
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MaxLength': '24'" if !job_name.nil? && job_name.length > 24
1060
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'MinLength': '3'" if !job_name.nil? && job_name.length < 3
1061
+ fail ArgumentError, "'job_name' should satisfy the constraint - 'Pattern': '^[-\w\.]+$'" if !job_name.nil? && job_name.match(Regexp.new('^^[-\w\.]+$$')).nil?
1062
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1063
+ fail ArgumentError, 'job_resource_update_parameter is nil' if job_resource_update_parameter.nil?
1064
+
1065
+
1066
+ request_headers = {}
1067
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1068
+
1069
+ # Set Headers
1070
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1071
+ request_headers['If-Match'] = if_match unless if_match.nil?
1072
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1073
+
1074
+ # Serialize Request
1075
+ request_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResourceUpdateParameter.mapper()
1076
+ request_content = @client.serialize(request_mapper, job_resource_update_parameter)
1077
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1078
+
1079
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/jobs/{jobName}'
1080
+
1081
+ request_url = @base_url || @client.base_url
1082
+
1083
+ options = {
1084
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1085
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name},
1086
+ query_params: {'api-version' => @client.api_version},
1087
+ body: request_content,
1088
+ headers: request_headers.merge(custom_headers || {}),
1089
+ base_url: request_url
1090
+ }
1091
+ promise = @client.make_request_async(:patch, path_template, options)
1092
+
1093
+ promise = promise.then do |result|
1094
+ http_response = result.response
1095
+ status_code = http_response.status
1096
+ response_content = http_response.body
1097
+ unless status_code == 200 || status_code == 202
1098
+ error_model = JSON.load(response_content)
1099
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1100
+ end
1101
+
1102
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1103
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1104
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1105
+ # Deserialize Response
1106
+ if status_code == 200
1107
+ begin
1108
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1109
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResource.mapper()
1110
+ result.body = @client.deserialize(result_mapper, parsed_response)
1111
+ rescue Exception => e
1112
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1113
+ end
1114
+ end
1115
+
1116
+ result
1117
+ end
1118
+
1119
+ promise.execute
1120
+ end
1121
+
1122
+ #
1123
+ # Lists all the jobs available under the subscription.
1124
+ #
1125
+ # @param next_page_link [String] The NextLink from the previous successful call
1126
+ # to List operation.
1127
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1128
+ # will be added to the HTTP request.
1129
+ #
1130
+ # @return [JobResourceList] operation results.
1131
+ #
1132
+ def list_next(next_page_link, custom_headers:nil)
1133
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
1134
+ response.body unless response.nil?
1135
+ end
1136
+
1137
+ #
1138
+ # Lists all the jobs available under the subscription.
1139
+ #
1140
+ # @param next_page_link [String] The NextLink from the previous successful call
1141
+ # to List operation.
1142
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1143
+ # will be added to the HTTP request.
1144
+ #
1145
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1146
+ #
1147
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
1148
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
1149
+ end
1150
+
1151
+ #
1152
+ # Lists all the jobs available under the subscription.
1153
+ #
1154
+ # @param next_page_link [String] The NextLink from the previous successful call
1155
+ # to List operation.
1156
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1157
+ # to the HTTP request.
1158
+ #
1159
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1160
+ #
1161
+ def list_next_async(next_page_link, custom_headers:nil)
1162
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1163
+
1164
+
1165
+ request_headers = {}
1166
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1167
+
1168
+ # Set Headers
1169
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1170
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1171
+ path_template = '{nextLink}'
1172
+
1173
+ request_url = @base_url || @client.base_url
1174
+
1175
+ options = {
1176
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1177
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1178
+ headers: request_headers.merge(custom_headers || {}),
1179
+ base_url: request_url
1180
+ }
1181
+ promise = @client.make_request_async(:get, path_template, options)
1182
+
1183
+ promise = promise.then do |result|
1184
+ http_response = result.response
1185
+ status_code = http_response.status
1186
+ response_content = http_response.body
1187
+ unless status_code == 200
1188
+ error_model = JSON.load(response_content)
1189
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1190
+ end
1191
+
1192
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1193
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1194
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1195
+ # Deserialize Response
1196
+ if status_code == 200
1197
+ begin
1198
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1199
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResourceList.mapper()
1200
+ result.body = @client.deserialize(result_mapper, parsed_response)
1201
+ rescue Exception => e
1202
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1203
+ end
1204
+ end
1205
+
1206
+ result
1207
+ end
1208
+
1209
+ promise.execute
1210
+ end
1211
+
1212
+ #
1213
+ # Lists all the jobs available under the given resource group.
1214
+ #
1215
+ # @param next_page_link [String] The NextLink from the previous successful call
1216
+ # to List operation.
1217
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1218
+ # will be added to the HTTP request.
1219
+ #
1220
+ # @return [JobResourceList] operation results.
1221
+ #
1222
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
1223
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1224
+ response.body unless response.nil?
1225
+ end
1226
+
1227
+ #
1228
+ # Lists all the jobs available under the given resource group.
1229
+ #
1230
+ # @param next_page_link [String] The NextLink from the previous successful call
1231
+ # to List operation.
1232
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1233
+ # will be added to the HTTP request.
1234
+ #
1235
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1236
+ #
1237
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
1238
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
1239
+ end
1240
+
1241
+ #
1242
+ # Lists all the jobs available under the given resource group.
1243
+ #
1244
+ # @param next_page_link [String] The NextLink from the previous successful call
1245
+ # to List operation.
1246
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1247
+ # to the HTTP request.
1248
+ #
1249
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1250
+ #
1251
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
1252
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1253
+
1254
+
1255
+ request_headers = {}
1256
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1257
+
1258
+ # Set Headers
1259
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1260
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1261
+ path_template = '{nextLink}'
1262
+
1263
+ request_url = @base_url || @client.base_url
1264
+
1265
+ options = {
1266
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1267
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1268
+ headers: request_headers.merge(custom_headers || {}),
1269
+ base_url: request_url
1270
+ }
1271
+ promise = @client.make_request_async(:get, path_template, options)
1272
+
1273
+ promise = promise.then do |result|
1274
+ http_response = result.response
1275
+ status_code = http_response.status
1276
+ response_content = http_response.body
1277
+ unless status_code == 200
1278
+ error_model = JSON.load(response_content)
1279
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1280
+ end
1281
+
1282
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1283
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1284
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1285
+ # Deserialize Response
1286
+ if status_code == 200
1287
+ begin
1288
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1289
+ result_mapper = Azure::DataBox::Mgmt::V2018_01_01::Models::JobResourceList.mapper()
1290
+ result.body = @client.deserialize(result_mapper, parsed_response)
1291
+ rescue Exception => e
1292
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1293
+ end
1294
+ end
1295
+
1296
+ result
1297
+ end
1298
+
1299
+ promise.execute
1300
+ end
1301
+
1302
+ #
1303
+ # Lists all the jobs available under the subscription.
1304
+ #
1305
+ # @param skip_token [String] $skipToken is supported on Get list of jobs, which
1306
+ # provides the next page in the list of jobs.
1307
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1308
+ # will be added to the HTTP request.
1309
+ #
1310
+ # @return [JobResourceList] which provide lazy access to pages of the response.
1311
+ #
1312
+ def list_as_lazy(skip_token:nil, custom_headers:nil)
1313
+ response = list_async(skip_token:skip_token, custom_headers:custom_headers).value!
1314
+ unless response.nil?
1315
+ page = response.body
1316
+ page.next_method = Proc.new do |next_page_link|
1317
+ list_next_async(next_page_link, custom_headers:custom_headers)
1318
+ end
1319
+ page
1320
+ end
1321
+ end
1322
+
1323
+ #
1324
+ # Lists all the jobs available under the given resource group.
1325
+ #
1326
+ # @param resource_group_name [String] The Resource Group Name
1327
+ # @param skip_token [String] $skipToken is supported on Get list of jobs, which
1328
+ # provides the next page in the list of jobs.
1329
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1330
+ # will be added to the HTTP request.
1331
+ #
1332
+ # @return [JobResourceList] which provide lazy access to pages of the response.
1333
+ #
1334
+ def list_by_resource_group_as_lazy(resource_group_name, skip_token:nil, custom_headers:nil)
1335
+ response = list_by_resource_group_async(resource_group_name, skip_token:skip_token, custom_headers:custom_headers).value!
1336
+ unless response.nil?
1337
+ page = response.body
1338
+ page.next_method = Proc.new do |next_page_link|
1339
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
1340
+ end
1341
+ page
1342
+ end
1343
+ end
1344
+
1345
+ end
1346
+ end