Class: Azure::ResourcesManagement::Mgmt::V2018_03_01_preview::Entities

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb

Overview

The Azure Management Groups API enables consolidation of multiple subscriptions/resources into an organizational hierarchy and centrally manage access control, policies, alerting and reporting for those resources.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Entities

Creates and initializes a new instance of the Entities class.

Parameters:

  • client

    service class for accessing basic functionality.



20
21
22
# File 'lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb', line 20

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientManagementGroupsAPI (readonly)

Returns reference to the ManagementGroupsAPI.

Returns:



25
26
27
# File 'lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb', line 25

def client
  @client
end

Instance Method Details

#list(skiptoken: nil, skip: nil, top: nil, select: nil, search: nil, filter: nil, view: nil, group_name: nil, cache_control: 'no-cache', custom_headers: nil) ⇒ Array<EntityInfo>

List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.

operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. results. Passing this in will override $skipToken. Passing this in will override $skipToken. response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. ‘$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain’. When specified the $select parameter can override select in $skipToken. $filter parameter to return three different outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user’s permissions. With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and first level of children that the user has either direct access to or indirect access via one of their descendants. Possible values include: ‘AllowedParents’, ‘AllowedChildren’, ‘ParentAndFirstLevelChildren’, ‘ParentOnly’, ‘ChildrenOnly’ name or display name fields. You can check for equality on the name field (e.g. name eq ‘entityName’) and you can check for substrings on either the name or display name fields(e.g. contains(name, ‘substringToSearch’), contains(displayName, ‘Note that the ‘{entityName’ and ‘substringToSearch’ fields are checked case insensitively. data that is returned by the getEntities call. Possible values include: ‘FullHierarchy’, ‘GroupsOnly’, ‘SubscriptionsOnly’, ‘Audit’ focus on a particular group (i.e. “$filter=name eq ‘groupName’”) any caches. will be added to the HTTP request.

Parameters:

  • skiptoken (String) (defaults to: nil)

    Page continuation token is only used if a previous

  • skip (Integer) (defaults to: nil)

    Number of entities to skip over when retrieving

  • top (Integer) (defaults to: nil)

    Number of elements to return when retrieving results.

  • select (String) (defaults to: nil)

    This parameter specifies the fields to include in the

  • search (Enum) (defaults to: nil)

    The $search parameter is used in conjunction with the

  • filter (String) (defaults to: nil)

    The filter parameter allows you to filter on the the

  • view (Enum) (defaults to: nil)

    The view parameter allows clients to filter the type of

  • group_name (String) (defaults to: nil)

    A filter which allows the get entities call to

  • cache_control (String) (defaults to: 'no-cache')

    Indicates that the request shouldn’t utilize

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

    A hash of custom headers that

Returns:

  • (Array<EntityInfo>)

    operation results.



73
74
75
76
# File 'lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb', line 73

def list(skiptoken:nil, skip:nil, top:nil, select:nil, search:nil, filter:nil, view:nil, group_name:nil, cache_control:'no-cache', custom_headers:nil)
  first_page = list_as_lazy(skiptoken:skiptoken, skip:skip, top:top, select:select, search:search, filter:filter, view:view, group_name:group_name, cache_control:cache_control, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_as_lazy(skiptoken: nil, skip: nil, top: nil, select: nil, search: nil, filter: nil, view: nil, group_name: nil, cache_control: 'no-cache', custom_headers: nil) ⇒ EntityListResult

List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.

operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. results. Passing this in will override $skipToken. Passing this in will override $skipToken. response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. ‘$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain’. When specified the $select parameter can override select in $skipToken. $filter parameter to return three different outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user’s permissions. With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and first level of children that the user has either direct access to or indirect access via one of their descendants. Possible values include: ‘AllowedParents’, ‘AllowedChildren’, ‘ParentAndFirstLevelChildren’, ‘ParentOnly’, ‘ChildrenOnly’ name or display name fields. You can check for equality on the name field (e.g. name eq ‘entityName’) and you can check for substrings on either the name or display name fields(e.g. contains(name, ‘substringToSearch’), contains(displayName, ‘Note that the ‘{entityName’ and ‘substringToSearch’ fields are checked case insensitively. data that is returned by the getEntities call. Possible values include: ‘FullHierarchy’, ‘GroupsOnly’, ‘SubscriptionsOnly’, ‘Audit’ focus on a particular group (i.e. “$filter=name eq ‘groupName’”) any caches. will be added to the HTTP request.

response.

Parameters:

  • skiptoken (String) (defaults to: nil)

    Page continuation token is only used if a previous

  • skip (Integer) (defaults to: nil)

    Number of entities to skip over when retrieving

  • top (Integer) (defaults to: nil)

    Number of elements to return when retrieving results.

  • select (String) (defaults to: nil)

    This parameter specifies the fields to include in the

  • search (Enum) (defaults to: nil)

    The $search parameter is used in conjunction with the

  • filter (String) (defaults to: nil)

    The filter parameter allows you to filter on the the

  • view (Enum) (defaults to: nil)

    The view parameter allows clients to filter the type of

  • group_name (String) (defaults to: nil)

    A filter which allows the get entities call to

  • cache_control (String) (defaults to: 'no-cache')

    Indicates that the request shouldn’t utilize

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

    A hash of custom headers that

Returns:

  • (EntityListResult)

    which provide lazy access to pages of the



369
370
371
372
373
374
375
376
377
378
# File 'lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb', line 369

def list_as_lazy(skiptoken:nil, skip:nil, top:nil, select:nil, search:nil, filter:nil, view:nil, group_name:nil, cache_control:'no-cache', custom_headers:nil)
  response = list_async(skiptoken:skiptoken, skip:skip, top:top, select:select, search:search, filter:filter, view:view, group_name:group_name, cache_control:cache_control, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers)
    end
    page
  end
end

#list_async(skiptoken: nil, skip: nil, top: nil, select: nil, search: nil, filter: nil, view: nil, group_name: nil, cache_control: 'no-cache', custom_headers: nil) ⇒ Concurrent::Promise

List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.

operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. results. Passing this in will override $skipToken. Passing this in will override $skipToken. response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. ‘$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain’. When specified the $select parameter can override select in $skipToken. $filter parameter to return three different outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user’s permissions. With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and first level of children that the user has either direct access to or indirect access via one of their descendants. Possible values include: ‘AllowedParents’, ‘AllowedChildren’, ‘ParentAndFirstLevelChildren’, ‘ParentOnly’, ‘ChildrenOnly’ name or display name fields. You can check for equality on the name field (e.g. name eq ‘entityName’) and you can check for substrings on either the name or display name fields(e.g. contains(name, ‘substringToSearch’), contains(displayName, ‘Note that the ‘{entityName’ and ‘substringToSearch’ fields are checked case insensitively. data that is returned by the getEntities call. Possible values include: ‘FullHierarchy’, ‘GroupsOnly’, ‘SubscriptionsOnly’, ‘Audit’ focus on a particular group (i.e. “$filter=name eq ‘groupName’”) any caches. to the HTTP request.

Parameters:

  • skiptoken (String) (defaults to: nil)

    Page continuation token is only used if a previous

  • skip (Integer) (defaults to: nil)

    Number of entities to skip over when retrieving

  • top (Integer) (defaults to: nil)

    Number of elements to return when retrieving results.

  • select (String) (defaults to: nil)

    This parameter specifies the fields to include in the

  • search (Enum) (defaults to: nil)

    The $search parameter is used in conjunction with the

  • filter (String) (defaults to: nil)

    The filter parameter allows you to filter on the the

  • view (Enum) (defaults to: nil)

    The view parameter allows clients to filter the type of

  • group_name (String) (defaults to: nil)

    A filter which allows the get entities call to

  • cache_control (String) (defaults to: 'no-cache')

    Indicates that the request shouldn’t utilize

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb', line 174

def list_async(skiptoken:nil, skip:nil, top:nil, select:nil, search:nil, filter:nil, view:nil, group_name:nil, cache_control:'no-cache', custom_headers: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['Cache-Control'] = cache_control unless cache_control.nil?
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'providers/Microsoft.Management/getEntities'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      query_params: {'api-version' => @client.api_version,'$skiptoken' => skiptoken,'$skip' => skip,'$top' => top,'$select' => select,'$search' => search,'$filter' => filter,'$view' => view,'groupName' => group_name},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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 MsRest::HttpOperationError.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::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::EntityListResult.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_next(next_page_link, cache_control: 'no-cache', custom_headers: nil) ⇒ EntityListResult

List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • cache_control (String) (defaults to: 'no-cache')

    Indicates that the request shouldn’t utilize

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

    A hash of custom headers that

Returns:

  • (EntityListResult)

    operation results.



237
238
239
240
# File 'lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb', line 237

def list_next(next_page_link, cache_control:'no-cache', custom_headers:nil)
  response = list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_next_async(next_page_link, cache_control: 'no-cache', custom_headers: nil) ⇒ Concurrent::Promise

List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.

to List operation. any caches. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • cache_control (String) (defaults to: 'no-cache')

    Indicates that the request shouldn’t utilize

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb', line 272

def list_next_async(next_page_link, cache_control:'no-cache', 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['Cache-Control'] = cache_control unless cache_control.nil?
  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(:post, 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 MsRest::HttpOperationError.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::ResourcesManagement::Mgmt::V2018_03_01_preview::Models::EntityListResult.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_next_with_http_info(next_page_link, cache_control: 'no-cache', custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.

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

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • cache_control (String) (defaults to: 'no-cache')

    Indicates that the request shouldn’t utilize

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



255
256
257
# File 'lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb', line 255

def list_next_with_http_info(next_page_link, cache_control:'no-cache', custom_headers:nil)
  list_next_async(next_page_link, cache_control:cache_control, custom_headers:custom_headers).value!
end

#list_with_http_info(skiptoken: nil, skip: nil, top: nil, select: nil, search: nil, filter: nil, view: nil, group_name: nil, cache_control: 'no-cache', custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

List all entities (Management Groups, Subscriptions, etc.) for the authenticated user.

operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a token parameter that specifies a starting point to use for subsequent calls. results. Passing this in will override $skipToken. Passing this in will override $skipToken. response. Can include any combination of Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. ‘$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain’. When specified the $select parameter can override select in $skipToken. $filter parameter to return three different outputs depending on the parameter passed in. With $search=AllowedParents the API will return the entity info of all groups that the requested entity will be able to reparent to as determined by the user’s permissions. With $search=AllowedChildren the API will return the entity info of all entities that can be added as children of the requested entity. With $search=ParentAndFirstLevelChildren the API will return the parent and first level of children that the user has either direct access to or indirect access via one of their descendants. Possible values include: ‘AllowedParents’, ‘AllowedChildren’, ‘ParentAndFirstLevelChildren’, ‘ParentOnly’, ‘ChildrenOnly’ name or display name fields. You can check for equality on the name field (e.g. name eq ‘entityName’) and you can check for substrings on either the name or display name fields(e.g. contains(name, ‘substringToSearch’), contains(displayName, ‘Note that the ‘{entityName’ and ‘substringToSearch’ fields are checked case insensitively. data that is returned by the getEntities call. Possible values include: ‘FullHierarchy’, ‘GroupsOnly’, ‘SubscriptionsOnly’, ‘Audit’ focus on a particular group (i.e. “$filter=name eq ‘groupName’”) any caches. will be added to the HTTP request.

Parameters:

  • skiptoken (String) (defaults to: nil)

    Page continuation token is only used if a previous

  • skip (Integer) (defaults to: nil)

    Number of entities to skip over when retrieving

  • top (Integer) (defaults to: nil)

    Number of elements to return when retrieving results.

  • select (String) (defaults to: nil)

    This parameter specifies the fields to include in the

  • search (Enum) (defaults to: nil)

    The $search parameter is used in conjunction with the

  • filter (String) (defaults to: nil)

    The filter parameter allows you to filter on the the

  • view (Enum) (defaults to: nil)

    The view parameter allows clients to filter the type of

  • group_name (String) (defaults to: nil)

    A filter which allows the get entities call to

  • cache_control (String) (defaults to: 'no-cache')

    Indicates that the request shouldn’t utilize

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



124
125
126
# File 'lib/2018-03-01-preview/generated/azure_mgmt_resources_management/entities.rb', line 124

def list_with_http_info(skiptoken:nil, skip:nil, top:nil, select:nil, search:nil, filter:nil, view:nil, group_name:nil, cache_control:'no-cache', custom_headers:nil)
  list_async(skiptoken:skiptoken, skip:skip, top:top, select:select, search:search, filter:filter, view:view, group_name:group_name, cache_control:cache_control, custom_headers:custom_headers).value!
end