Class: Azure::CostManagement::Mgmt::V2019_04_01_preview::Views

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb

Overview

Views

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Views

Creates and initializes a new instance of the Views class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientCostManagementClient (readonly)

Returns reference to the CostManagementClient.

Returns:



22
23
24
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 22

def client
  @client
end

Instance Method Details

#create_or_update(view_name, parameters, custom_headers: nil) ⇒ View

The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.

operation. will be added to the HTTP request.

Parameters:

  • view_name (String)

    View name

  • parameters (View)

    Parameters supplied to the CreateOrUpdate View

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

    A hash of custom headers that

Returns:

  • (View)

    operation results.



356
357
358
359
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 356

def create_or_update(view_name, parameters, custom_headers:nil)
  response = create_or_update_async(view_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(view_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.

operation. to the HTTP request.

Parameters:

  • view_name (String)

    View name

  • parameters (View)

    Parameters supplied to the CreateOrUpdate View

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
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
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 391

def create_or_update_async(view_name, parameters, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'view_name is nil' if view_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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::CostManagement::Mgmt::V2019_04_01_preview::Models::View.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'providers/Microsoft.CostManagement/views/{viewName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'viewName' => view_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 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.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::CostManagement::Mgmt::V2019_04_01_preview::Models::View.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(scope, view_name, parameters, custom_headers: nil) ⇒ View

The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. operation. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

  • view_name (String)

    View name

  • parameters (View)

    Parameters supplied to the CreateOrUpdate View

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

    A hash of custom headers that

Returns:

  • (View)

    operation results.



723
724
725
726
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 723

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

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

The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. operation. to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

  • view_name (String)

    View name

  • parameters (View)

    Parameters supplied to the CreateOrUpdate View

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 798

def create_or_update_by_scope_async(scope, view_name, parameters, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'view_name is nil' if view_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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::CostManagement::Mgmt::V2019_04_01_preview::Models::View.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.CostManagement/views/{viewName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'scope' => scope,'viewName' => view_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 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.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::CostManagement::Mgmt::V2019_04_01_preview::Models::View.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, view_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. operation. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

  • view_name (String)

    View name

  • parameters (View)

    Parameters supplied to the CreateOrUpdate View

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



761
762
763
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 761

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

#create_or_update_with_http_info(view_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.

operation. will be added to the HTTP request.

Parameters:

  • view_name (String)

    View name

  • parameters (View)

    Parameters supplied to the CreateOrUpdate View

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



374
375
376
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 374

def create_or_update_with_http_info(view_name, parameters, custom_headers:nil)
  create_or_update_async(view_name, parameters, custom_headers:custom_headers).value!
end

#delete(view_name, custom_headers: nil) ⇒ Object

The operation to delete a view.

will be added to the HTTP request.

Parameters:

  • view_name (String)

    View name

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

    A hash of custom headers that



470
471
472
473
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 470

def delete(view_name, custom_headers:nil)
  response = delete_async(view_name, custom_headers:custom_headers).value!
  nil
end

#delete_async(view_name, custom_headers: nil) ⇒ Concurrent::Promise

The operation to delete a view.

to the HTTP request.

Parameters:

  • view_name (String)

    View name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 497

def delete_async(view_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'view_name is nil' if view_name.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 = 'providers/Microsoft.CostManagement/views/{viewName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'viewName' => view_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 == 200 || status_code == 204
      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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

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

The operation to delete a view.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

  • view_name (String)

    View name

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

    A hash of custom headers that



898
899
900
901
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 898

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

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

The operation to delete a view.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

  • view_name (String)

    View name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 965

def delete_by_scope_async(scope, view_name, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'view_name is nil' if view_name.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.CostManagement/views/{viewName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'scope' => scope,'viewName' => view_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 == 200 || status_code == 204
      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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

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

The operation to delete a view.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

  • view_name (String)

    View name

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



932
933
934
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 932

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

#delete_with_http_info(view_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

The operation to delete a view.

will be added to the HTTP request.

Parameters:

  • view_name (String)

    View name

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



484
485
486
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 484

def delete_with_http_info(view_name, custom_headers:nil)
  delete_async(view_name, custom_headers:custom_headers).value!
end

#get(view_name, custom_headers: nil) ⇒ View

Gets the view by view name.

will be added to the HTTP request.

Parameters:

  • view_name (String)

    View name

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

    A hash of custom headers that

Returns:

  • (View)

    operation results.



263
264
265
266
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 263

def get(view_name, custom_headers:nil)
  response = get_async(view_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(view_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the view by view name.

to the HTTP request.

Parameters:

  • view_name (String)

    View name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 290

def get_async(view_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'view_name is nil' if view_name.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 = 'providers/Microsoft.CostManagement/views/{viewName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'viewName' => view_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 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.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(scope, view_name, custom_headers: nil) ⇒ View

Gets the view for the defined scope by view name.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

  • view_name (String)

    View name

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

    A hash of custom headers that

Returns:

  • (View)

    operation results.



569
570
571
572
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 569

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

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

Gets the view for the defined scope by view name.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

  • view_name (String)

    View name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 636

def get_by_scope_async(scope, view_name, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'view_name is nil' if view_name.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.CostManagement/views/{viewName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'scope' => scope,'viewName' => view_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 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::View.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, view_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the view for the defined scope by view name.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

  • view_name (String)

    View name

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



603
604
605
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 603

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

#get_with_http_info(view_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the view by view name.

will be added to the HTTP request.

Parameters:

  • view_name (String)

    View name

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



277
278
279
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 277

def get_with_http_info(view_name, custom_headers:nil)
  get_async(view_name, custom_headers:custom_headers).value!
end

#list(custom_headers: nil) ⇒ Array<View>

Lists all views by tenant and object.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (Array<View>)

    operation results.



32
33
34
35
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 32

def list(custom_headers:nil)
  first_page = list_as_lazy(custom_headers:custom_headers)
  first_page.get_all_items
end

#list_as_lazy(custom_headers: nil) ⇒ ViewListResult

Lists all views by tenant and object.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (ViewListResult)

    which provide lazy access to pages of the response.



1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 1197

def list_as_lazy(custom_headers:nil)
  response = list_async(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, custom_headers:custom_headers)
    end
    page
  end
end

#list_async(custom_headers: nil) ⇒ Concurrent::Promise

Lists all views by tenant and object.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 57

def list_async(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['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'providers/Microsoft.CostManagement/views'

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

    result
  end

  promise.execute
end

#list_by_scope(scope, custom_headers: nil) ⇒ Array<View>

Lists all views at the given scope.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

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

    A hash of custom headers that

Returns:

  • (Array<View>)

    operation results.



136
137
138
139
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 136

def list_by_scope(scope, custom_headers:nil)
  first_page = list_by_scope_as_lazy(scope, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_scope_as_lazy(scope, custom_headers: nil) ⇒ ViewListResult

Lists all views at the given scope.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

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

    A hash of custom headers that

Returns:

  • (ViewListResult)

    which provide lazy access to pages of the response.



1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 1236

def list_by_scope_as_lazy(scope, custom_headers:nil)
  response = list_by_scope_async(scope, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_scope_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_scope_async(scope, custom_headers: nil) ⇒ Concurrent::Promise

Lists all views at the given scope.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 201

def list_by_scope_async(scope, custom_headers:nil)
  fail ArgumentError, 'scope is nil' if scope.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.CostManagement/views'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'scope' => scope},
      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 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::ViewListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_scope_next(next_page_link, custom_headers: nil) ⇒ ViewListResult

Lists all views at the given scope.

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:

  • (ViewListResult)

    operation results.



1109
1110
1111
1112
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 1109

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

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

Lists all views at the given scope.

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.



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
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 1138

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

    result
  end

  promise.execute
end

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

Lists all views at the given scope.

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.



1124
1125
1126
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 1124

def list_by_scope_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_scope_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_scope_with_http_info(scope, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all views at the given scope.

includes 'subscriptions/subscriptionId' for subscription scope, 'subscriptions/subscriptionId/resourceGroups/resourceGroupName' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/departments/departmentId' for Department scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/enrollmentAccounts/enrollmentAccountId' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/billingProfiles/billingProfileId' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/billingAccountId/invoiceSections/invoiceSectionId' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/managementGroupId' for Management Group scope, 'providers/Microsoft.CostManagement/externalBillingAccounts/externalBillingAccountName' for External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/externalSubscriptionName' for External Subscription scope. will be added to the HTTP request.

Parameters:

  • scope (String)

    The scope associated with view operations. This

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



169
170
171
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 169

def list_by_scope_with_http_info(scope, custom_headers:nil)
  list_by_scope_async(scope, custom_headers:custom_headers).value!
end

#list_next(next_page_link, custom_headers: nil) ⇒ ViewListResult

Lists all views by tenant and object.

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:

  • (ViewListResult)

    operation results.



1019
1020
1021
1022
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 1019

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

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

Lists all views by tenant and object.

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.



1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 1048

def list_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 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?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CostManagement::Mgmt::V2019_04_01_preview::Models::ViewListResult.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, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all views by tenant and object.

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.



1034
1035
1036
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 1034

def list_next_with_http_info(next_page_link, custom_headers:nil)
  list_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all views by tenant and object.

will be added to the HTTP request.

Parameters:

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



45
46
47
# File 'lib/2019-04-01-preview/generated/azure_mgmt_cost_management/views.rb', line 45

def list_with_http_info(custom_headers:nil)
  list_async(custom_headers:custom_headers).value!
end