Class: Azure::SQL::Mgmt::V2017_03_01_preview::LongTermRetentionBackups

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb

Overview

The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ LongTermRetentionBackups

Creates and initializes a new instance of the LongTermRetentionBackups class.

Parameters:

  • client

    service class for accessing basic functionality.



20
21
22
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 20

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSqlManagementClient (readonly)

Returns reference to the SqlManagementClient.

Returns:



25
26
27
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 25

def client
  @client
end

Instance Method Details

#begin_delete(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ Object

Deletes a long term retention backup.

will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that



1127
1128
1129
1130
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1127

def begin_delete(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  response = begin_delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
  nil
end

#begin_delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a long term retention backup.

to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1160

def begin_delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  fail ArgumentError, 'location_name is nil' if location_name.nil?
  fail ArgumentError, 'long_term_retention_server_name is nil' if long_term_retention_server_name.nil?
  fail ArgumentError, 'long_term_retention_database_name is nil' if long_term_retention_database_name.nil?
  fail ArgumentError, 'backup_name is nil' if backup_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'locationName' => location_name,'longTermRetentionServerName' => long_term_retention_server_name,'longTermRetentionDatabaseName' => long_term_retention_database_name,'backupName' => backup_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_delete_by_resource_group(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ Object

Deletes a long term retention backup.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that



1029
1030
1031
1032
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1029

def begin_delete_by_resource_group(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  response = begin_delete_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
  nil
end

#begin_delete_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a long term retention backup.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1068

def begin_delete_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'location_name is nil' if location_name.nil?
  fail ArgumentError, 'long_term_retention_server_name is nil' if long_term_retention_server_name.nil?
  fail ArgumentError, 'long_term_retention_database_name is nil' if long_term_retention_database_name.nil?
  fail ArgumentError, 'backup_name is nil' if backup_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'locationName' => location_name,'longTermRetentionServerName' => long_term_retention_server_name,'longTermRetentionDatabaseName' => long_term_retention_database_name,'backupName' => backup_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_delete_by_resource_group_with_http_info(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a long term retention backup.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1049
1050
1051
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1049

def begin_delete_by_resource_group_with_http_info(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  begin_delete_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
end

#begin_delete_with_http_info(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a long term retention backup.

will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1144
1145
1146
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1144

def begin_delete_with_http_info(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  begin_delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
end

#delete(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ Object

Deletes a long term retention backup.

will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that



656
657
658
659
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 656

def delete(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  response = delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
  nil
end

#delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 672

def delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#delete_by_resource_group(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ Object

Deletes a long term retention backup.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that



152
153
154
155
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 152

def delete_by_resource_group(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  response = delete_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
  nil
end

#delete_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 171

def delete_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  # Send request
  promise = begin_delete_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#get(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ LongTermRetentionBackup

Gets a long term retention backup.

will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database.

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackup)

    operation results.



556
557
558
559
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 556

def get(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  response = get_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a long term retention backup.

to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database.

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 589

def get_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  fail ArgumentError, 'location_name is nil' if location_name.nil?
  fail ArgumentError, 'long_term_retention_server_name is nil' if long_term_retention_server_name.nil?
  fail ArgumentError, 'long_term_retention_database_name is nil' if long_term_retention_database_name.nil?
  fail ArgumentError, 'backup_name is nil' if backup_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'locationName' => location_name,'longTermRetentionServerName' => long_term_retention_server_name,'longTermRetentionDatabaseName' => long_term_retention_database_name,'backupName' => backup_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackup.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_by_resource_group(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ LongTermRetentionBackup

Gets a long term retention backup.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database.

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackup)

    operation results.



42
43
44
45
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 42

def get_by_resource_group(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  response = get_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a long term retention backup.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database.

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 81

def get_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'location_name is nil' if location_name.nil?
  fail ArgumentError, 'long_term_retention_server_name is nil' if long_term_retention_server_name.nil?
  fail ArgumentError, 'long_term_retention_database_name is nil' if long_term_retention_database_name.nil?
  fail ArgumentError, 'backup_name is nil' if backup_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'locationName' => location_name,'longTermRetentionServerName' => long_term_retention_server_name,'longTermRetentionDatabaseName' => long_term_retention_database_name,'backupName' => backup_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackup.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_by_resource_group_with_http_info(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a long term retention backup.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database.

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



62
63
64
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 62

def get_by_resource_group_with_http_info(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  get_by_resource_group_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
end

#get_with_http_info(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a long term retention backup.

will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database.

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • backup_name (String)

    The backup name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



573
574
575
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 573

def get_with_http_info(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:nil)
  get_async(location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers:custom_headers).value!
end

#list_by_database(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Array<LongTermRetentionBackup>

Lists all long term retention backups for a database.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (Array<LongTermRetentionBackup>)

    operation results.



704
705
706
707
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 704

def list_by_database(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  first_page = list_by_database_as_lazy(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_database_as_lazy(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists all long term retention backups for a database.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

pages of the response.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    which provide lazy access to



1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1854

def list_by_database_as_lazy(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  response = list_by_database_async(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_database_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_database_async(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Concurrent::Promise

Lists all long term retention backups for a database.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 745

def list_by_database_async(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  fail ArgumentError, 'location_name is nil' if location_name.nil?
  fail ArgumentError, 'long_term_retention_server_name is nil' if long_term_retention_server_name.nil?
  fail ArgumentError, 'long_term_retention_database_name is nil' if long_term_retention_database_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'locationName' => location_name,'longTermRetentionServerName' => long_term_retention_server_name,'longTermRetentionDatabaseName' => long_term_retention_database_name,'subscriptionId' => @client.subscription_id},
      query_params: {'onlyLatestPerDatabase' => only_latest_per_database,'databaseState' => database_state,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_database_next(next_page_link, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists all long term retention backups for a database.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    operation results.



1487
1488
1489
1490
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1487

def list_by_database_next(next_page_link, custom_headers:nil)
  response = list_by_database_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_database_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Lists all long term retention backups for a database.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1516

def list_by_database_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_database_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all long term retention backups for a database.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1502
1503
1504
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1502

def list_by_database_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_database_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_database_with_http_info(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all long term retention backups for a database.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



725
726
727
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 725

def list_by_database_with_http_info(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  list_by_database_async(location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
end

#list_by_location(location_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Array<LongTermRetentionBackup>

Lists the long term retention backups for a given location.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (Array<LongTermRetentionBackup>)

    operation results.



815
816
817
818
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 815

def list_by_location(location_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  first_page = list_by_location_as_lazy(location_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_location_as_lazy(location_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists the long term retention backups for a given location.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

pages of the response.

Parameters:

  • location_name (String)

    The location of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    which provide lazy access to



1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1880

def list_by_location_as_lazy(location_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  response = list_by_location_async(location_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_location_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_location_async(location_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Concurrent::Promise

Lists the long term retention backups for a given location.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 852

def list_by_location_async(location_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  fail ArgumentError, 'location_name is nil' if location_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'locationName' => location_name,'subscriptionId' => @client.subscription_id},
      query_params: {'onlyLatestPerDatabase' => only_latest_per_database,'databaseState' => database_state,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_location_next(next_page_link, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists the long term retention backups for a given location.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    operation results.



1577
1578
1579
1580
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1577

def list_by_location_next(next_page_link, custom_headers:nil)
  response = list_by_location_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_location_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Lists the long term retention backups for a given location.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1606

def list_by_location_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_location_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the long term retention backups for a given location.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1592
1593
1594
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1592

def list_by_location_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_location_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_location_with_http_info(location_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the long term retention backups for a given location.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



834
835
836
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 834

def list_by_location_with_http_info(location_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  list_by_location_async(location_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
end

#list_by_resource_group_database(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Array<LongTermRetentionBackup>

Lists all long term retention backups for a database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (Array<LongTermRetentionBackup>)

    operation results.



206
207
208
209
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 206

def list_by_resource_group_database(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  first_page = list_by_resource_group_database_as_lazy(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_resource_group_database_as_lazy(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists all long term retention backups for a database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

pages of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    which provide lazy access to



1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1767

def list_by_resource_group_database_as_lazy(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  response = list_by_resource_group_database_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_database_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_resource_group_database_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Concurrent::Promise

Lists all long term retention backups for a database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 253

def list_by_resource_group_database_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'location_name is nil' if location_name.nil?
  fail ArgumentError, 'long_term_retention_server_name is nil' if long_term_retention_server_name.nil?
  fail ArgumentError, 'long_term_retention_database_name is nil' if long_term_retention_database_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'locationName' => location_name,'longTermRetentionServerName' => long_term_retention_server_name,'longTermRetentionDatabaseName' => long_term_retention_database_name,'subscriptionId' => @client.subscription_id},
      query_params: {'onlyLatestPerDatabase' => only_latest_per_database,'databaseState' => database_state,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_database_next(next_page_link, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists all long term retention backups for a database.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    operation results.



1217
1218
1219
1220
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1217

def list_by_resource_group_database_next(next_page_link, custom_headers:nil)
  response = list_by_resource_group_database_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_database_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Lists all long term retention backups for a database.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1246

def list_by_resource_group_database_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_database_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all long term retention backups for a database.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1232
1233
1234
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1232

def list_by_resource_group_database_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_resource_group_database_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_resource_group_database_with_http_info(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all long term retention backups for a database.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • long_term_retention_database_name (String)

    The name of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



230
231
232
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 230

def list_by_resource_group_database_with_http_info(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  list_by_resource_group_database_async(resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
end

#list_by_resource_group_location(resource_group_name, location_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Array<LongTermRetentionBackup>

Lists the long term retention backups for a given location.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (Array<LongTermRetentionBackup>)

    operation results.



327
328
329
330
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 327

def list_by_resource_group_location(resource_group_name, location_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  first_page = list_by_resource_group_location_as_lazy(resource_group_name, location_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_resource_group_location_as_lazy(resource_group_name, location_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists the long term retention backups for a given location.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

pages of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    which provide lazy access to



1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1796

def list_by_resource_group_location_as_lazy(resource_group_name, location_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  response = list_by_resource_group_location_async(resource_group_name, location_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_location_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_resource_group_location_async(resource_group_name, location_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Concurrent::Promise

Lists the long term retention backups for a given location.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 370

def list_by_resource_group_location_async(resource_group_name, location_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'location_name is nil' if location_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'locationName' => location_name,'subscriptionId' => @client.subscription_id},
      query_params: {'onlyLatestPerDatabase' => only_latest_per_database,'databaseState' => database_state,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_location_next(next_page_link, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists the long term retention backups for a given location.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    operation results.



1307
1308
1309
1310
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1307

def list_by_resource_group_location_next(next_page_link, custom_headers:nil)
  response = list_by_resource_group_location_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_location_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Lists the long term retention backups for a given location.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1336

def list_by_resource_group_location_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_location_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the long term retention backups for a given location.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1322
1323
1324
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1322

def list_by_resource_group_location_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_resource_group_location_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_resource_group_location_with_http_info(resource_group_name, location_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the long term retention backups for a given location.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



349
350
351
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 349

def list_by_resource_group_location_with_http_info(resource_group_name, location_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  list_by_resource_group_location_async(resource_group_name, location_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
end

#list_by_resource_group_server(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Array<LongTermRetentionBackup>

Lists the long term retention backups for a given server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (Array<LongTermRetentionBackup>)

    operation results.



443
444
445
446
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 443

def list_by_resource_group_server(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  first_page = list_by_resource_group_server_as_lazy(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_resource_group_server_as_lazy(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists the long term retention backups for a given server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

pages of the response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    which provide lazy access to



1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1826

def list_by_resource_group_server_as_lazy(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  response = list_by_resource_group_server_async(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_resource_group_server_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_resource_group_server_async(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Concurrent::Promise

Lists the long term retention backups for a given server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 488

def list_by_resource_group_server_async(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'location_name is nil' if location_name.nil?
  fail ArgumentError, 'long_term_retention_server_name is nil' if long_term_retention_server_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'locationName' => location_name,'longTermRetentionServerName' => long_term_retention_server_name,'subscriptionId' => @client.subscription_id},
      query_params: {'onlyLatestPerDatabase' => only_latest_per_database,'databaseState' => database_state,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_server_next(next_page_link, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists the long term retention backups for a given server.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    operation results.



1397
1398
1399
1400
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1397

def list_by_resource_group_server_next(next_page_link, custom_headers:nil)
  response = list_by_resource_group_server_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_server_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Lists the long term retention backups for a given server.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1426

def list_by_resource_group_server_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_server_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the long term retention backups for a given server.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1412
1413
1414
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1412

def list_by_resource_group_server_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_resource_group_server_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_resource_group_server_with_http_info(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the long term retention backups for a given server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



466
467
468
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 466

def list_by_resource_group_server_with_http_info(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  list_by_resource_group_server_async(resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
end

#list_by_server(location_name, long_term_retention_server_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Array<LongTermRetentionBackup>

Lists the long term retention backups for a given server.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (Array<LongTermRetentionBackup>)

    operation results.



921
922
923
924
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 921

def list_by_server(location_name, long_term_retention_server_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  first_page = list_by_server_as_lazy(location_name, long_term_retention_server_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_server_as_lazy(location_name, long_term_retention_server_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists the long term retention backups for a given server.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

pages of the response.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    which provide lazy access to



1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1907

def list_by_server_as_lazy(location_name, long_term_retention_server_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  response = list_by_server_async(location_name, long_term_retention_server_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_server_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_server_async(location_name, long_term_retention_server_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ Concurrent::Promise

Lists the long term retention backups for a given server.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 960

def list_by_server_async(location_name, long_term_retention_server_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  fail ArgumentError, 'location_name is nil' if location_name.nil?
  fail ArgumentError, 'long_term_retention_server_name is nil' if long_term_retention_server_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'locationName' => location_name,'longTermRetentionServerName' => long_term_retention_server_name,'subscriptionId' => @client.subscription_id},
      query_params: {'onlyLatestPerDatabase' => only_latest_per_database,'databaseState' => database_state,'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_server_next(next_page_link, custom_headers: nil) ⇒ LongTermRetentionBackupListResult

Lists the long term retention backups for a given server.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (LongTermRetentionBackupListResult)

    operation results.



1667
1668
1669
1670
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1667

def list_by_server_next(next_page_link, custom_headers:nil)
  response = list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_server_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Lists the long term retention backups for a given server.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1696

def list_by_server_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2017_03_01_preview::Models::LongTermRetentionBackupListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_server_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the long term retention backups for a given server.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1682
1683
1684
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 1682

def list_by_server_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_server_with_http_info(location_name, long_term_retention_server_name, only_latest_per_database: nil, database_state: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the long term retention backups for a given server.

latest backup for each database. against just live databases, just deleted databases, or all databases. Possible values include: ‘All’, ‘Live’, ‘Deleted’ will be added to the HTTP request.

Parameters:

  • location_name (String)

    The location of the database

  • long_term_retention_server_name (String)

    The name of the server

  • only_latest_per_database (Boolean) (defaults to: nil)

    Whether or not to only get the

  • database_state (LongTermRetentionDatabaseState) (defaults to: nil)

    Whether to query

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



941
942
943
# File 'lib/2017-03-01-preview/generated/azure_mgmt_sql/long_term_retention_backups.rb', line 941

def list_by_server_with_http_info(location_name, long_term_retention_server_name, only_latest_per_database:nil, database_state:nil, custom_headers:nil)
  list_by_server_async(location_name, long_term_retention_server_name, only_latest_per_database:only_latest_per_database, database_state:database_state, custom_headers:custom_headers).value!
end