Class: Azure::RecoveryServicesBackup::Mgmt::V2016_12_01::RecoveryServicesBackupClient

Inherits:
MsRestAzure::AzureServiceClient
  • Object
show all
Includes:
MsRestAzure, MsRestAzure::Serialization
Defined in:
lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb

Overview

A service client - single point of access to the REST API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials = nil, base_url = nil, options = nil) ⇒ RecoveryServicesBackupClient

Creates initializes a new instance of the RecoveryServicesBackupClient class.

Parameters:

  • credentials (MsRest::ServiceClientCredentials) (defaults to: nil)

    credentials to authorize HTTP requests made by the service client.

  • base_url (String) (defaults to: nil)

    the base URI of the service.

  • options (Array) (defaults to: nil)

    filters to be applied to the HTTP requests.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 128

def initialize(credentials = nil, base_url = nil, options = nil)
  super(credentials, options)
  @base_url = base_url || 'https://management.azure.com'

  fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
  @credentials = credentials

  @backup_resource_vault_configs = BackupResourceVaultConfigs.new(self)
  @backup_engines = BackupEngines.new(self)
  @protection_container_refresh_operation_results = ProtectionContainerRefreshOperationResults.new(self)
  @protectable_containers = ProtectableContainers.new(self)
  @protection_containers = ProtectionContainers.new(self)
  @backup_workload_items = BackupWorkloadItems.new(self)
  @protection_container_operation_results = ProtectionContainerOperationResults.new(self)
  @protected_items = ProtectedItems.new(self)
  @backups = Backups.new(self)
  @protected_item_operation_results = ProtectedItemOperationResults.new(self)
  @protected_item_operation_statuses = ProtectedItemOperationStatuses.new(self)
  @recovery_points = RecoveryPoints.new(self)
  @item_level_recovery_connections = ItemLevelRecoveryConnections.new(self)
  @restores = Restores.new(self)
  @job_cancellations = JobCancellations.new(self)
  @job_operation_results = JobOperationResults.new(self)
  @backup_operation_results = BackupOperationResults.new(self)
  @backup_operation_statuses = BackupOperationStatuses.new(self)
  @protection_policies = ProtectionPolicies.new(self)
  @protection_policy_operation_results = ProtectionPolicyOperationResults.new(self)
  @protection_policy_operation_statuses = ProtectionPolicyOperationStatuses.new(self)
  @backup_protectable_items = BackupProtectableItems.new(self)
  @backup_protection_containers = BackupProtectionContainers.new(self)
  @security_pins = SecurityPINs.new(self)
  @backup_resource_storage_configs = BackupResourceStorageConfigs.new(self)
  @api_version = '2016-12-01'
  @accept_language = 'en-US'
  @long_running_operation_retry_timeout = 30
  @generate_client_request_id = true
  add_telemetry
end

Instance Attribute Details

#accept_languageString

Returns The preferred language for the response.

Returns:

  • (String)

    The preferred language for the response.



31
32
33
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 31

def accept_language
  @accept_language
end

#api_versionString (readonly)

Returns Client Api Version.

Returns:

  • (String)

    Client Api Version.



28
29
30
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 28

def api_version
  @api_version
end

#backup_enginesBackupEngines (readonly)

Returns backup_engines.

Returns:



46
47
48
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 46

def backup_engines
  @backup_engines
end

#backup_operation_resultsBackupOperationResults (readonly)

Returns backup_operation_results.

Returns:



94
95
96
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 94

def backup_operation_results
  @backup_operation_results
end

#backup_operation_statusesBackupOperationStatuses (readonly)

Returns backup_operation_statuses.

Returns:



97
98
99
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 97

def backup_operation_statuses
  @backup_operation_statuses
end

#backup_protectable_itemsBackupProtectableItems (readonly)

Returns backup_protectable_items.

Returns:



111
112
113
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 111

def backup_protectable_items
  @backup_protectable_items
end

#backup_protection_containersBackupProtectionContainers (readonly)

Returns backup_protection_containers.

Returns:



114
115
116
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 114

def backup_protection_containers
  @backup_protection_containers
end

#backup_resource_storage_configsBackupResourceStorageConfigs (readonly)

Returns backup_resource_storage_configs.

Returns:



120
121
122
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 120

def backup_resource_storage_configs
  @backup_resource_storage_configs
end

#backup_resource_vault_configsBackupResourceVaultConfigs (readonly)

Returns backup_resource_vault_configs.

Returns:



43
44
45
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 43

def backup_resource_vault_configs
  @backup_resource_vault_configs
end

#backup_workload_itemsBackupWorkloadItems (readonly)

Returns backup_workload_items.

Returns:



59
60
61
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 59

def backup_workload_items
  @backup_workload_items
end

#backupsBackups (readonly)

Returns backups.

Returns:



69
70
71
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 69

def backups
  @backups
end

#base_urlString

Returns the base URI of the service.

Returns:

  • (String)

    the base URI of the service.



19
20
21
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 19

def base_url
  @base_url
end

#credentialsObject (readonly)

Returns Credentials needed for the client to connect to Azure.

Returns:

  • Credentials needed for the client to connect to Azure.



22
23
24
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 22

def credentials
  @credentials
end

#generate_client_request_idBoolean

generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.

Returns:

  • (Boolean)

    Whether a unique x-ms-client-request-id should be



40
41
42
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 40

def generate_client_request_id
  @generate_client_request_id
end

#item_level_recovery_connectionsItemLevelRecoveryConnections (readonly)

Returns item_level_recovery_connections.

Returns:



82
83
84
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 82

def item_level_recovery_connections
  @item_level_recovery_connections
end

#job_cancellationsJobCancellations (readonly)

Returns job_cancellations.

Returns:



88
89
90
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 88

def job_cancellations
  @job_cancellations
end

#job_operation_resultsJobOperationResults (readonly)

Returns job_operation_results.

Returns:



91
92
93
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 91

def job_operation_results
  @job_operation_results
end

#long_running_operation_retry_timeoutInteger

Operations. Default value is 30.

Returns:

  • (Integer)

    The retry timeout in seconds for Long Running



35
36
37
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 35

def long_running_operation_retry_timeout
  @long_running_operation_retry_timeout
end

#protectable_containersProtectableContainers (readonly)

Returns protectable_containers.

Returns:



53
54
55
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 53

def protectable_containers
  @protectable_containers
end

#protected_item_operation_resultsProtectedItemOperationResults (readonly)

Returns protected_item_operation_results.

Returns:



72
73
74
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 72

def protected_item_operation_results
  @protected_item_operation_results
end

#protected_item_operation_statusesProtectedItemOperationStatuses (readonly)

protected_item_operation_statuses



76
77
78
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 76

def protected_item_operation_statuses
  @protected_item_operation_statuses
end

#protected_itemsProtectedItems (readonly)

Returns protected_items.

Returns:



66
67
68
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 66

def protected_items
  @protected_items
end

#protection_container_operation_resultsProtectionContainerOperationResults (readonly)

protection_container_operation_results



63
64
65
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 63

def protection_container_operation_results
  @protection_container_operation_results
end

#protection_container_refresh_operation_resultsProtectionContainerRefreshOperationResults (readonly)

protection_container_refresh_operation_results



50
51
52
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 50

def protection_container_refresh_operation_results
  @protection_container_refresh_operation_results
end

#protection_containersProtectionContainers (readonly)

Returns protection_containers.

Returns:



56
57
58
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 56

def protection_containers
  @protection_containers
end

#protection_policiesProtectionPolicies (readonly)

Returns protection_policies.

Returns:



100
101
102
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 100

def protection_policies
  @protection_policies
end

#protection_policy_operation_resultsProtectionPolicyOperationResults (readonly)

protection_policy_operation_results



104
105
106
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 104

def protection_policy_operation_results
  @protection_policy_operation_results
end

#protection_policy_operation_statusesProtectionPolicyOperationStatuses (readonly)

protection_policy_operation_statuses



108
109
110
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 108

def protection_policy_operation_statuses
  @protection_policy_operation_statuses
end

#recovery_pointsRecoveryPoints (readonly)

Returns recovery_points.

Returns:



79
80
81
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 79

def recovery_points
  @recovery_points
end

#restoresRestores (readonly)

Returns restores.

Returns:



85
86
87
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 85

def restores
  @restores
end

#security_pinsSecurityPINs (readonly)

Returns security_pins.

Returns:



117
118
119
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 117

def security_pins
  @security_pins
end

#subscription_idString

Returns The subscription Id.

Returns:

  • (String)

    The subscription Id.



25
26
27
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 25

def subscription_id
  @subscription_id
end

Instance Method Details

#make_request(method, path, options = {}) ⇒ Hash{String=>String}

Makes a request and returns the body of the response. Example:

request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
path = "/path"
options = {
  body: request_content,
  query_params: {'api-version' => '2016-02-01'}
}
result = @client.make_request(:put, path, options)

Parameters:

  • method (Symbol)

    with any of the following values :get, :put, :post, :patch, :delete.

  • path (String)

    the path, relative to #base_url.

  • options (Hash{String=>String}) (defaults to: {})

    specifying any request options like :body.

Returns:

  • (Hash{String=>String})

    containing the body of the response.



183
184
185
186
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 183

def make_request(method, path, options = {})
  result = make_request_with_http_info(method, path, options)
  result.body unless result.nil?
end

#make_request_async(method, path, options = {}) ⇒ Concurrent::Promise

Makes a request asynchronously.

Parameters:

  • method (Symbol)

    with any of the following values :get, :put, :post, :patch, :delete.

  • path (String)

    the path, relative to #base_url.

  • options (Hash{String=>String}) (defaults to: {})

    specifying any request options like :body.

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 208

def make_request_async(method, path, options = {})
  fail ArgumentError, 'method is nil' if method.nil?
  fail ArgumentError, 'path is nil' if path.nil?

  request_url = options[:base_url] || @base_url
  if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
    @request_headers['Content-Type'] = options[:headers]['Content-Type']
  end

  request_headers = @request_headers
  request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
  options.merge!({headers: request_headers.merge(options[:headers] || {})})
  options.merge!({credentials: @credentials}) unless @credentials.nil?

  super(request_url, method, path, options)
end

#make_request_with_http_info(method, path, options = {}) ⇒ MsRestAzure::AzureOperationResponse

Makes a request and returns the operation response.

Parameters:

  • method (Symbol)

    with any of the following values :get, :put, :post, :patch, :delete.

  • path (String)

    the path, relative to #base_url.

  • options (Hash{String=>String}) (defaults to: {})

    specifying any request options like :body.

Returns:

  • (MsRestAzure::AzureOperationResponse)

    Operation response containing the request, response and status.



195
196
197
198
199
# File 'lib/2016-12-01/generated/azure_mgmt_recovery_services_backup/recovery_services_backup_client.rb', line 195

def make_request_with_http_info(method, path, options = {})
  result = make_request_async(method, path, options).value!
  result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
  result
end