Class: Azure::Locks::Mgmt::V2016_09_01::ManagementLocks

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb

Overview

Azure resources can be locked to prevent other users in your organization from deleting or modifying resources.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ManagementLocks

Creates and initializes a new instance of the ManagementLocks class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientManagementLockClient (readonly)

Returns reference to the ManagementLockClient.

Returns:



23
24
25
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 23

def client
  @client
end

Instance Method Details

#create_or_update_at_resource_group_level(resource_group_name, lock_name, parameters, custom_headers: nil) ⇒ ManagementLockObject

Creates or updates a management lock at the resource group level.

When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

260 characters. It cannot contain <, > %, &, :, , ?, /, or any control characters. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to lock.

  • lock_name (String)

    The lock name. The lock name can be a maximum of

  • parameters (ManagementLockObject)

    The management lock parameters.

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

    A hash of custom headers that

Returns:

  • (ManagementLockObject)

    operation results.



44
45
46
47
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 44

def create_or_update_at_resource_group_level(resource_group_name, lock_name, parameters, custom_headers:nil)
  response = create_or_update_at_resource_group_level_async(resource_group_name, lock_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_at_resource_group_level_async(resource_group_name, lock_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates a management lock at the resource group level.

When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

260 characters. It cannot contain <, > %, &, :, , ?, /, or any control characters. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to lock.

  • lock_name (String)

    The lock name. The lock name can be a maximum of

  • parameters (ManagementLockObject)

    The management lock parameters.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 91

def create_or_update_at_resource_group_level_async(resource_group_name, lock_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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?

  # Serialize Request
  request_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, 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 == 201
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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

#create_or_update_at_resource_group_level_with_http_info(resource_group_name, lock_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a management lock at the resource group level.

When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

260 characters. It cannot contain <, > %, &, :, , ?, /, or any control characters. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group to lock.

  • lock_name (String)

    The lock name. The lock name can be a maximum of

  • parameters (ManagementLockObject)

    The management lock parameters.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



68
69
70
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 68

def create_or_update_at_resource_group_level_with_http_info(resource_group_name, lock_name, parameters, custom_headers:nil)
  create_or_update_at_resource_group_level_async(resource_group_name, lock_name, parameters, custom_headers:custom_headers).value!
end

#create_or_update_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers: nil) ⇒ ManagementLockObject

Creates or updates a management lock at the resource level or any level below the resource.

When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

the resource to lock. of the resource to lock. 260 characters. It cannot contain <, > %, &, :, , ?, /, or any control characters. a management lock. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The resource provider namespace

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to lock.

  • resource_name (String)

    The name of the resource to lock.

  • lock_name (String)

    The name of lock. The lock name can be a maximum of

  • parameters (ManagementLockObject)

    Parameters for creating or updating

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

    A hash of custom headers that

Returns:

  • (ManagementLockObject)

    operation results.



687
688
689
690
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 687

def create_or_update_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers:nil)
  response = create_or_update_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates a management lock at the resource level or any level below the resource.

When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

the resource to lock. of the resource to lock. 260 characters. It cannot contain <, > %, &, :, , ?, /, or any control characters. a management lock. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The resource provider namespace

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to lock.

  • resource_name (String)

    The name of the resource to lock.

  • lock_name (String)

    The name of lock. The lock name can be a maximum of

  • parameters (ManagementLockObject)

    Parameters for creating or updating

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 750

def create_or_update_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
  fail ArgumentError, 'resource_type is nil' if resource_type.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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?

  # Serialize Request
  request_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
      skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, 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 == 201
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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

#create_or_update_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a management lock at the resource level or any level below the resource.

When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

the resource to lock. of the resource to lock. 260 characters. It cannot contain <, > %, &, :, , ?, /, or any control characters. a management lock. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The resource provider namespace

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource to lock.

  • resource_name (String)

    The name of the resource to lock.

  • lock_name (String)

    The name of lock. The lock name can be a maximum of

  • parameters (ManagementLockObject)

    Parameters for creating or updating

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



719
720
721
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 719

def create_or_update_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers:nil)
  create_or_update_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, parameters, custom_headers:custom_headers).value!
end

#create_or_update_at_subscription_level(lock_name, parameters, custom_headers: nil) ⇒ ManagementLockObject

Creates or updates a management lock at the subscription level.

When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

260 characters. It cannot contain <, > %, &, :, , ?, /, or any control characters. will be added to the HTTP request.

Parameters:

  • lock_name (String)

    The name of lock. The lock name can be a maximum of

  • parameters (ManagementLockObject)

    The management lock parameters.

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

    A hash of custom headers that

Returns:

  • (ManagementLockObject)

    operation results.



1090
1091
1092
1093
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1090

def create_or_update_at_subscription_level(lock_name, parameters, custom_headers:nil)
  response = create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates a management lock at the subscription level.

When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

260 characters. It cannot contain <, > %, &, :, , ?, /, or any control characters. to the HTTP request.

Parameters:

  • lock_name (String)

    The name of lock. The lock name can be a maximum of

  • parameters (ManagementLockObject)

    The management lock parameters.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
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
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1135

def create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers:nil)
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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?

  # Serialize Request
  request_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, 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 == 201 || 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?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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

#create_or_update_at_subscription_level_with_http_info(lock_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a management lock at the subscription level.

When you apply a lock at a parent scope, all child resources inherit the same lock. To create management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

260 characters. It cannot contain <, > %, &, :, , ?, /, or any control characters. will be added to the HTTP request.

Parameters:

  • lock_name (String)

    The name of lock. The lock name can be a maximum of

  • parameters (ManagementLockObject)

    The management lock parameters.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1113
1114
1115
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1113

def create_or_update_at_subscription_level_with_http_info(lock_name, parameters, custom_headers:nil)
  create_or_update_at_subscription_level_async(lock_name, parameters, custom_headers:custom_headers).value!
end

#create_or_update_by_scope(scope, lock_name, parameters, custom_headers: nil) ⇒ ManagementLockObject

Create or update a management lock by scope.

assignment, use ‘/subscriptions/subscriptionId’ for subscriptions, ‘/subscriptions/subscriptionId/resourcegroups/resourceGroupName’ for resource groups, and ‘/subscriptions/subscriptionId/resourcegroups/resourceGroupName/providers/resourceProviderNamespace/parentResourcePathIfPresent/resourceType/resourceName’ for resources. parameters. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope for the lock. When providing a scope for the

  • lock_name (String)

    The name of lock.

  • parameters (ManagementLockObject)

    Create or update management lock

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

    A hash of custom headers that

Returns:

  • (ManagementLockObject)

    operation results.



376
377
378
379
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 376

def create_or_update_by_scope(scope, lock_name, parameters, custom_headers:nil)
  response = create_or_update_by_scope_async(scope, lock_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_by_scope_async(scope, lock_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Create or update a management lock by scope.

assignment, use ‘/subscriptions/subscriptionId’ for subscriptions, ‘/subscriptions/subscriptionId/resourcegroups/resourceGroupName’ for resource groups, and ‘/subscriptions/subscriptionId/resourcegroups/resourceGroupName/providers/resourceProviderNamespace/parentResourcePathIfPresent/resourceType/resourceName’ for resources. parameters. to the HTTP request.

Parameters:

  • scope (String)

    The scope for the lock. When providing a scope for the

  • lock_name (String)

    The name of lock.

  • parameters (ManagementLockObject)

    Create or update management lock

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 419

def create_or_update_by_scope_async(scope, lock_name, parameters, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  # Serialize Request
  request_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '{scope}/providers/Microsoft.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'scope' => scope,'lockName' => lock_name},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, 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 == 201
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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

#create_or_update_by_scope_with_http_info(scope, lock_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Create or update a management lock by scope.

assignment, use ‘/subscriptions/subscriptionId’ for subscriptions, ‘/subscriptions/subscriptionId/resourcegroups/resourceGroupName’ for resource groups, and ‘/subscriptions/subscriptionId/resourcegroups/resourceGroupName/providers/resourceProviderNamespace/parentResourcePathIfPresent/resourceType/resourceName’ for resources. parameters. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope for the lock. When providing a scope for the

  • lock_name (String)

    The name of lock.

  • parameters (ManagementLockObject)

    Create or update management lock

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



398
399
400
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 398

def create_or_update_by_scope_with_http_info(scope, lock_name, parameters, custom_headers:nil)
  create_or_update_by_scope_async(scope, lock_name, parameters, custom_headers:custom_headers).value!
end

#delete_at_resource_group_level(resource_group_name, lock_name, custom_headers: nil) ⇒ Object

Deletes a management lock at the resource group level.

To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

the lock. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • lock_name (String)

    The name of lock to delete.

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

    A hash of custom headers that



179
180
181
182
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 179

def delete_at_resource_group_level(resource_group_name, lock_name, custom_headers:nil)
  response = delete_at_resource_group_level_async(resource_group_name, lock_name, custom_headers:custom_headers).value!
  nil
end

#delete_at_resource_group_level_async(resource_group_name, lock_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a management lock at the resource group level.

To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

the lock. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • lock_name (String)

    The name of lock to delete.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 218

def delete_at_resource_group_level_async(resource_group_name, lock_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'lockName' => lock_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 == 204 || 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
  end

  promise.execute
end

#delete_at_resource_group_level_with_http_info(resource_group_name, lock_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a management lock at the resource group level.

To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

the lock. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • lock_name (String)

    The name of lock to delete.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



199
200
201
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 199

def delete_at_resource_group_level_with_http_info(resource_group_name, lock_name, custom_headers:nil)
  delete_at_resource_group_level_async(resource_group_name, lock_name, custom_headers:custom_headers).value!
end

#delete_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers: nil) ⇒ Object

Deletes the management lock of a resource or any level below the resource.

To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

the resource with the lock to delete. of the resource with the lock to delete. to delete. delete. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The resource provider namespace

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource with the lock

  • resource_name (String)

    The name of the resource with the lock to

  • lock_name (String)

    The name of the lock to delete.

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

    A hash of custom headers that



850
851
852
853
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 850

def delete_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers:nil)
  response = delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers:custom_headers).value!
  nil
end

#delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes the management lock of a resource or any level below the resource.

To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

the resource with the lock to delete. of the resource with the lock to delete. to delete. delete. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The resource provider namespace

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource with the lock

  • resource_name (String)

    The name of the resource with the lock to

  • lock_name (String)

    The name of the lock to delete.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 903

def delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
  fail ArgumentError, 'resource_type is nil' if resource_type.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
      skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
      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 == 204 || 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
  end

  promise.execute
end

#delete_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes the management lock of a resource or any level below the resource.

To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

the resource with the lock to delete. of the resource with the lock to delete. to delete. delete. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The resource provider namespace

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the resource with the lock

  • resource_name (String)

    The name of the resource with the lock to

  • lock_name (String)

    The name of the lock to delete.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



877
878
879
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 877

def delete_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers:nil)
  delete_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers:custom_headers).value!
end

#delete_at_subscription_level(lock_name, custom_headers: nil) ⇒ Object

Deletes the management lock at the subscription level.

To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

will be added to the HTTP request.

Parameters:

  • lock_name (String)

    The name of lock to delete.

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

    A hash of custom headers that



1217
1218
1219
1220
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1217

def delete_at_subscription_level(lock_name, custom_headers:nil)
  response = delete_at_subscription_level_async(lock_name, custom_headers:custom_headers).value!
  nil
end

#delete_at_subscription_level_async(lock_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes the management lock at the subscription level.

To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

to the HTTP request.

Parameters:

  • lock_name (String)

    The name of lock to delete.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1252

def delete_at_subscription_level_async(lock_name, custom_headers:nil)
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'lockName' => lock_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 == 204 || 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
  end

  promise.execute
end

#delete_at_subscription_level_with_http_info(lock_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes the management lock at the subscription level.

To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.

will be added to the HTTP request.

Parameters:

  • lock_name (String)

    The name of lock to delete.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1235
1236
1237
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1235

def delete_at_subscription_level_with_http_info(lock_name, custom_headers:nil)
  delete_at_subscription_level_async(lock_name, custom_headers:custom_headers).value!
end

#delete_by_scope(scope, lock_name, custom_headers: nil) ⇒ Object

Delete a management lock by scope.

will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope for the lock.

  • lock_name (String)

    The name of lock.

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

    A hash of custom headers that



498
499
500
501
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 498

def delete_by_scope(scope, lock_name, custom_headers:nil)
  response = delete_by_scope_async(scope, lock_name, custom_headers:custom_headers).value!
  nil
end

#delete_by_scope_async(scope, lock_name, custom_headers: nil) ⇒ Concurrent::Promise

Delete a management lock by scope.

to the HTTP request.

Parameters:

  • scope (String)

    The scope for the lock.

  • lock_name (String)

    The name of lock.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 527

def delete_by_scope_async(scope, lock_name, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'lock_name is nil' if lock_name.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 = '{scope}/providers/Microsoft.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'scope' => scope,'lockName' => lock_name},
      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 == 204 || 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
  end

  promise.execute
end

#delete_by_scope_with_http_info(scope, lock_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Delete a management lock by scope.

will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope for the lock.

  • lock_name (String)

    The name of lock.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



513
514
515
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 513

def delete_by_scope_with_http_info(scope, lock_name, custom_headers:nil)
  delete_by_scope_async(scope, lock_name, custom_headers:custom_headers).value!
end

#get_at_resource_group_level(resource_group_name, lock_name, custom_headers: nil) ⇒ ManagementLockObject

Gets a management lock at the resource group level.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the locked resource group.

  • lock_name (String)

    The name of the lock to get.

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

    A hash of custom headers that

Returns:

  • (ManagementLockObject)

    operation results.



274
275
276
277
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 274

def get_at_resource_group_level(resource_group_name, lock_name, custom_headers:nil)
  response = get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a management lock at the resource group level.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the locked resource group.

  • lock_name (String)

    The name of the lock to get.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 303

def get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'lockName' => lock_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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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_at_resource_group_level_with_http_info(resource_group_name, lock_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a management lock at the resource group level.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the locked resource group.

  • lock_name (String)

    The name of the lock to get.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



289
290
291
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 289

def get_at_resource_group_level_with_http_info(resource_group_name, lock_name, custom_headers:nil)
  get_at_resource_group_level_async(resource_group_name, lock_name, custom_headers:custom_headers).value!
end

#get_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers: nil) ⇒ ManagementLockObject

Get the management lock of a resource or any level below resource.

provider. services, like SQL Databases. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    An extra path parameter needed in some

  • resource_type (String)

    The type of the resource.

  • resource_name (String)

    The name of the resource.

  • lock_name (String)

    The name of lock.

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

    A hash of custom headers that

Returns:

  • (ManagementLockObject)

    operation results.



970
971
972
973
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 970

def get_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers:nil)
  response = get_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers: nil) ⇒ Concurrent::Promise

Get the management lock of a resource or any level below resource.

provider. services, like SQL Databases. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    An extra path parameter needed in some

  • resource_type (String)

    The type of the resource.

  • resource_name (String)

    The name of the resource.

  • lock_name (String)

    The name of lock.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1011

def get_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
  fail ArgumentError, 'resource_type is nil' if resource_type.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'lockName' => lock_name,'subscriptionId' => @client.subscription_id},
      skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get the management lock of a resource or any level below resource.

provider. services, like SQL Databases. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    An extra path parameter needed in some

  • resource_type (String)

    The type of the resource.

  • resource_name (String)

    The name of the resource.

  • lock_name (String)

    The name of lock.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



991
992
993
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 991

def get_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers:nil)
  get_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, lock_name, custom_headers:custom_headers).value!
end

#get_at_subscription_level(lock_name, custom_headers: nil) ⇒ ManagementLockObject

Gets a management lock at the subscription level.

will be added to the HTTP request.

Parameters:

  • lock_name (String)

    The name of the lock to get.

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

    A hash of custom headers that

Returns:

  • (ManagementLockObject)

    operation results.



1303
1304
1305
1306
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1303

def get_at_subscription_level(lock_name, custom_headers:nil)
  response = get_at_subscription_level_async(lock_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_at_subscription_level_async(lock_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a management lock at the subscription level.

to the HTTP request.

Parameters:

  • lock_name (String)

    The name of the lock to get.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1330
1331
1332
1333
1334
1335
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
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1330

def get_at_subscription_level_async(lock_name, custom_headers:nil)
  fail ArgumentError, 'lock_name is nil' if lock_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'lockName' => lock_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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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_at_subscription_level_with_http_info(lock_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a management lock at the subscription level.

will be added to the HTTP request.

Parameters:

  • lock_name (String)

    The name of the lock to get.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1317
1318
1319
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1317

def get_at_subscription_level_with_http_info(lock_name, custom_headers:nil)
  get_at_subscription_level_async(lock_name, custom_headers:custom_headers).value!
end

#get_by_scope(scope, lock_name, custom_headers: nil) ⇒ ManagementLockObject

Get a management lock by scope.

will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope for the lock.

  • lock_name (String)

    The name of lock.

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

    A hash of custom headers that

Returns:

  • (ManagementLockObject)

    operation results.



579
580
581
582
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 579

def get_by_scope(scope, lock_name, custom_headers:nil)
  response = get_by_scope_async(scope, lock_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_by_scope_async(scope, lock_name, custom_headers: nil) ⇒ Concurrent::Promise

Get a management lock by scope.

to the HTTP request.

Parameters:

  • scope (String)

    The scope for the lock.

  • lock_name (String)

    The name of lock.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
645
646
647
648
649
650
651
652
653
654
655
656
657
658
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 608

def get_by_scope_async(scope, lock_name, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, 'lock_name is nil' if lock_name.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 = '{scope}/providers/Microsoft.Authorization/locks/{lockName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'scope' => scope,'lockName' => lock_name},
      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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockObject.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_scope_with_http_info(scope, lock_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Get a management lock by scope.

will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope for the lock.

  • lock_name (String)

    The name of lock.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



594
595
596
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 594

def get_by_scope_with_http_info(scope, lock_name, custom_headers:nil)
  get_by_scope_async(scope, lock_name, custom_headers:custom_headers).value!
end

#list_at_resource_group_level(resource_group_name, filter: nil, custom_headers: nil) ⇒ Array<ManagementLockObject>

Gets all the management locks for a resource group.

the locks to get. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

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

    A hash of custom headers that

Returns:

  • (Array<ManagementLockObject>)

    operation results.



1393
1394
1395
1396
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1393

def list_at_resource_group_level(resource_group_name, filter:nil, custom_headers:nil)
  first_page = list_at_resource_group_level_as_lazy(resource_group_name, filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_at_resource_group_level_as_lazy(resource_group_name, filter: nil, custom_headers: nil) ⇒ ManagementLockListResult

Gets all the management locks for a resource group.

the locks to get. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

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

    A hash of custom headers that

Returns:

  • (ManagementLockListResult)

    which provide lazy access to pages of the



1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1959

def list_at_resource_group_level_as_lazy(resource_group_name, filter:nil, custom_headers:nil)
  response = list_at_resource_group_level_async(resource_group_name, filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_at_resource_group_level_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_at_resource_group_level_async(resource_group_name, filter: nil, custom_headers: nil) ⇒ Concurrent::Promise

Gets all the management locks for a resource group.

the locks to get. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1424
1425
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
1476
1477
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1424

def list_at_resource_group_level_async(resource_group_name, filter:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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.Authorization/locks'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'$filter' => filter,'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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockListResult.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_at_resource_group_level_next(next_page_link, custom_headers: nil) ⇒ ManagementLockListResult

Gets all the management locks for a resource group.

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:

  • (ManagementLockListResult)

    operation results.



1693
1694
1695
1696
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1693

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

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

Gets all the management locks for a resource group.

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.



1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1722

def list_at_resource_group_level_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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockListResult.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_at_resource_group_level_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the management locks for a resource group.

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.



1708
1709
1710
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1708

def list_at_resource_group_level_next_with_http_info(next_page_link, custom_headers:nil)
  list_at_resource_group_level_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_at_resource_group_level_with_http_info(resource_group_name, filter: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the management locks for a resource group.

the locks to get. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1409
1410
1411
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1409

def list_at_resource_group_level_with_http_info(resource_group_name, filter:nil, custom_headers:nil)
  list_at_resource_group_level_async(resource_group_name, filter:filter, custom_headers:custom_headers).value!
end

#list_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter: nil, custom_headers: nil) ⇒ Array<ManagementLockObject>

Gets all the management locks for a resource or any level below resource.

the locked resource. The name is case insensitive. provider. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the locked resource.

  • resource_name (String)

    The name of the locked resource.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

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

    A hash of custom headers that

Returns:

  • (Array<ManagementLockObject>)

    operation results.



1495
1496
1497
1498
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1495

def list_at_resource_level(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
  first_page = list_at_resource_level_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_at_resource_level_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter: nil, custom_headers: nil) ⇒ ManagementLockListResult

Gets all the management locks for a resource or any level below resource.

the locked resource. The name is case insensitive. provider. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the locked resource.

  • resource_name (String)

    The name of the locked resource.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

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

    A hash of custom headers that

Returns:

  • (ManagementLockListResult)

    which provide lazy access to pages of the



1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1987

def list_at_resource_level_as_lazy(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
  response = list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_at_resource_level_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter: nil, custom_headers: nil) ⇒ Concurrent::Promise

Gets all the management locks for a resource or any level below resource.

the locked resource. The name is case insensitive. provider. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the locked resource.

  • resource_name (String)

    The name of the locked resource.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1536

def list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
  fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
  fail ArgumentError, 'resource_provider_namespace is nil' if resource_provider_namespace.nil?
  fail ArgumentError, 'parent_resource_path is nil' if parent_resource_path.nil?
  fail ArgumentError, 'resource_type is nil' if resource_type.nil?
  fail ArgumentError, 'resource_name is nil' if resource_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'resourceProviderNamespace' => resource_provider_namespace,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
      skip_encoding_path_params: {'parentResourcePath' => parent_resource_path,'resourceType' => resource_type},
      query_params: {'$filter' => filter,'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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockListResult.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_at_resource_level_next(next_page_link, custom_headers: nil) ⇒ ManagementLockListResult

Gets all the management locks for a resource or any level below resource.

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:

  • (ManagementLockListResult)

    operation results.



1781
1782
1783
1784
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1781

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

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

Gets all the management locks for a resource or any level below resource.

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.



1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1810

def list_at_resource_level_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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockListResult.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_at_resource_level_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the management locks for a resource or any level below resource.

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.



1796
1797
1798
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1796

def list_at_resource_level_next_with_http_info(next_page_link, custom_headers:nil)
  list_at_resource_level_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the management locks for a resource or any level below resource.

the locked resource. The name is case insensitive. provider. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group containing

  • resource_provider_namespace (String)

    The namespace of the resource

  • parent_resource_path (String)

    The parent resource identity.

  • resource_type (String)

    The resource type of the locked resource.

  • resource_name (String)

    The name of the locked resource.

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1516
1517
1518
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1516

def list_at_resource_level_with_http_info(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:nil, custom_headers:nil)
  list_at_resource_level_async(resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, filter:filter, custom_headers:custom_headers).value!
end

#list_at_subscription_level(filter: nil, custom_headers: nil) ⇒ Array<ManagementLockObject>

Gets all the management locks for a subscription.

will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

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

    A hash of custom headers that

Returns:

  • (Array<ManagementLockObject>)

    operation results.



1605
1606
1607
1608
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1605

def list_at_subscription_level(filter:nil, custom_headers:nil)
  first_page = list_at_subscription_level_as_lazy(filter:filter, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_at_subscription_level_as_lazy(filter: nil, custom_headers: nil) ⇒ ManagementLockListResult

Gets all the management locks for a subscription.

will be added to the HTTP request.

response.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

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

    A hash of custom headers that

Returns:

  • (ManagementLockListResult)

    which provide lazy access to pages of the



2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 2008

def list_at_subscription_level_as_lazy(filter:nil, custom_headers:nil)
  response = list_at_subscription_level_async(filter:filter, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_at_subscription_level_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_at_subscription_level_async(filter: nil, custom_headers: nil) ⇒ Concurrent::Promise

Gets all the management locks for a subscription.

to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1632

def list_at_subscription_level_async(filter:nil, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.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.Authorization/locks'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'$filter' => filter,'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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockListResult.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_at_subscription_level_next(next_page_link, custom_headers: nil) ⇒ ManagementLockListResult

Gets all the management locks for a subscription.

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:

  • (ManagementLockListResult)

    operation results.



1869
1870
1871
1872
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1869

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

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

Gets all the management locks for a subscription.

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.



1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1898

def list_at_subscription_level_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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::Locks::Mgmt::V2016_09_01::Models::ManagementLockListResult.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_at_subscription_level_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the management locks for a subscription.

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.



1884
1885
1886
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1884

def list_at_subscription_level_next_with_http_info(next_page_link, custom_headers:nil)
  list_at_subscription_level_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_at_subscription_level_with_http_info(filter: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets all the management locks for a subscription.

will be added to the HTTP request.

Parameters:

  • filter (String) (defaults to: nil)

    The filter to apply on the operation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1619
1620
1621
# File 'lib/2016-09-01/generated/azure_mgmt_locks/management_locks.rb', line 1619

def list_at_subscription_level_with_http_info(filter:nil, custom_headers:nil)
  list_at_subscription_level_async(filter:filter, custom_headers:custom_headers).value!
end