azure_mgmt_subscriptions 0.17.3 → 0.18.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-06-01/generated/azure_mgmt_subscriptions/operations.rb +4 -0
  3. data/lib/2016-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  4. data/lib/2016-06-01/generated/azure_mgmt_subscriptions/subscriptions.rb +8 -0
  5. data/lib/2016-06-01/generated/azure_mgmt_subscriptions/tenants.rb +4 -0
  6. data/lib/2017-11-01-preview/generated/azure_mgmt_subscriptions/subscription_definitions.rb +10 -0
  7. data/lib/2017-11-01-preview/generated/azure_mgmt_subscriptions/subscription_definitions_client.rb +1 -1
  8. data/lib/2017-11-01-preview/generated/azure_mgmt_subscriptions/subscription_definitions_operation_metadata.rb +4 -0
  9. data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions.rb +3 -7
  10. data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/models/ad_principal.rb +2 -1
  11. data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/models/subscription_creation_result.rb +2 -1
  12. data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -5
  13. data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/subscription_factory.rb +2 -0
  14. data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/subscription_operations.rb +2 -0
  15. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions.rb +38 -0
  16. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/ad_principal.rb +47 -0
  17. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/error_response.rb +57 -0
  18. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/modern_subscription_creation_parameters.rb +129 -0
  19. data/lib/{2018-03-01-preview → 2018-11-01-preview}/generated/azure_mgmt_subscriptions/models/operation.rb +1 -1
  20. data/lib/{2018-03-01-preview → 2018-11-01-preview}/generated/azure_mgmt_subscriptions/models/operation_display.rb +1 -1
  21. data/lib/{2018-03-01-preview → 2018-11-01-preview}/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +1 -1
  22. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/subscription_creation_result.rb +47 -0
  23. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/subscription_operation.rb +69 -0
  24. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/models/subscription_operation_list_result.rb +56 -0
  25. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
  26. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +134 -0
  27. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/subscription_factory.rb +189 -0
  28. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/subscription_operation_operations.rb +118 -0
  29. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions.rb +35 -0
  30. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/canceled_subscription_id.rb +47 -0
  31. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/error_response.rb +57 -0
  32. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
  33. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/operation_display.rb +69 -0
  34. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +68 -0
  35. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/renamed_subscription_id.rb +47 -0
  36. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/models/subscription_name.rb +46 -0
  37. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
  38. data/lib/{2015-11-01 → 2019-03-01-preview}/generated/azure_mgmt_subscriptions/subscription_client.rb +5 -8
  39. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/subscriptions.rb +215 -0
  40. data/lib/2019-06-01/generated/azure_mgmt_subscriptions.rb +43 -0
  41. data/lib/{2015-11-01 → 2019-06-01}/generated/azure_mgmt_subscriptions/models/location.rb +14 -8
  42. data/lib/{2015-11-01 → 2019-06-01}/generated/azure_mgmt_subscriptions/models/location_list_result.rb +2 -2
  43. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/managed_by_tenant.rb +47 -0
  44. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
  45. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation_display.rb +80 -0
  46. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +100 -0
  47. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/spending_limit.rb +17 -0
  48. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription.rb +145 -0
  49. data/lib/{2015-11-01 → 2019-06-01}/generated/azure_mgmt_subscriptions/models/subscription_list_result.rb +3 -3
  50. data/lib/{2015-11-01 → 2019-06-01}/generated/azure_mgmt_subscriptions/models/subscription_policies.rb +22 -3
  51. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/models/subscription_state.rb +19 -0
  52. data/lib/{2015-11-01 → 2019-06-01}/generated/azure_mgmt_subscriptions/models/tenant_id_description.rb +8 -4
  53. data/lib/{2015-11-01 → 2019-06-01}/generated/azure_mgmt_subscriptions/models/tenant_list_result.rb +3 -3
  54. data/lib/{2015-11-01 → 2019-06-01}/generated/azure_mgmt_subscriptions/module_definition.rb +1 -1
  55. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/operations.rb +222 -0
  56. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +136 -0
  57. data/lib/{2015-11-01 → 2019-06-01}/generated/azure_mgmt_subscriptions/subscriptions.rb +45 -25
  58. data/lib/{2015-11-01 → 2019-06-01}/generated/azure_mgmt_subscriptions/tenants.rb +18 -11
  59. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions.rb +44 -0
  60. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/ad_principal.rb +47 -0
  61. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/canceled_subscription_id.rb +47 -0
  62. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/enabled_subscription_id.rb +47 -0
  63. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/error_response.rb +57 -0
  64. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/modern_csp_subscription_creation_parameters.rb +70 -0
  65. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/modern_subscription_creation_parameters.rb +117 -0
  66. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/offer_type.rb +16 -0
  67. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
  68. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/operation_display.rb +69 -0
  69. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +68 -0
  70. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/renamed_subscription_id.rb +47 -0
  71. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/subscription_creation_parameters.rb +115 -0
  72. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/subscription_creation_result.rb +47 -0
  73. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/models/subscription_name.rb +46 -0
  74. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
  75. data/lib/{2018-03-01-preview → 2019-10-01-preview}/generated/azure_mgmt_subscriptions/operations.rb +4 -2
  76. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/subscription.rb +788 -0
  77. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +137 -0
  78. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/subscription_operation.rb +118 -0
  79. data/lib/2019-11-01/generated/azure_mgmt_subscriptions.rb +48 -0
  80. data/lib/{2015-11-01/generated/azure_mgmt_subscriptions/models/subscription.rb → 2019-11-01/generated/azure_mgmt_subscriptions/models/location.rb} +36 -19
  81. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/location_list_result.rb +55 -0
  82. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/location_metadata.rb +129 -0
  83. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/managed_by_tenant.rb +47 -0
  84. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
  85. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/operation_display.rb +80 -0
  86. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +100 -0
  87. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/paired_region.rb +72 -0
  88. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/region_category.rb +16 -0
  89. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/region_type.rb +16 -0
  90. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/spending_limit.rb +17 -0
  91. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/subscription.rb +164 -0
  92. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/subscription_list_result.rb +98 -0
  93. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/subscription_policies.rb +76 -0
  94. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/subscription_state.rb +19 -0
  95. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/tenant_category.rb +17 -0
  96. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/tenant_id_description.rb +131 -0
  97. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/models/tenant_list_result.rb +98 -0
  98. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
  99. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/operations.rb +222 -0
  100. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/subscription_client.rb +136 -0
  101. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/subscriptions.rb +409 -0
  102. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/tenants.rb +222 -0
  103. data/lib/azure_mgmt_subscriptions.rb +7 -3
  104. data/lib/profiles/latest/modules/subscriptions_profile_module.rb +171 -37
  105. data/lib/version.rb +1 -1
  106. metadata +93 -21
  107. data/lib/2015-11-01/generated/azure_mgmt_subscriptions.rb +0 -36
@@ -3,7 +3,7 @@
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
- module Azure::Subscriptions::Mgmt::V2015_11_01
6
+ module Azure::Subscriptions::Mgmt::V2019_06_01
7
7
  module Models
8
8
  #
9
9
  # Subscription list operation response.
@@ -13,10 +13,10 @@ module Azure::Subscriptions::Mgmt::V2015_11_01
13
13
  include MsRestAzure
14
14
 
15
15
  include MsRest::JSONable
16
- # @return [Array<Subscription>] Gets or sets subscriptions.
16
+ # @return [Array<Subscription>] An array of subscriptions.
17
17
  attr_accessor :value
18
18
 
19
- # @return [String] Gets or sets the URL to get the next set of results.
19
+ # @return [String] The URL to get the next set of results.
20
20
  attr_accessor :next_link
21
21
 
22
22
  # return [Proc] with next page method call.
@@ -3,7 +3,7 @@
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
- module Azure::Subscriptions::Mgmt::V2015_11_01
6
+ module Azure::Subscriptions::Mgmt::V2019_06_01
7
7
  module Models
8
8
  #
9
9
  # Subscription policies.
@@ -12,12 +12,19 @@ module Azure::Subscriptions::Mgmt::V2015_11_01
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [String] Gets or sets the subscription location placement Id.
15
+ # @return [String] The subscription location placement ID. The ID
16
+ # indicates which regions are visible for a subscription. For example, a
17
+ # subscription with a location placement Id of Public_2014-09-01 has
18
+ # access to Azure public regions.
16
19
  attr_accessor :location_placement_id
17
20
 
18
- # @return [String] Gets or sets the subscription quota Id.
21
+ # @return [String] The subscription quota ID.
19
22
  attr_accessor :quota_id
20
23
 
24
+ # @return [SpendingLimit] The subscription spending limit. Possible
25
+ # values include: 'On', 'Off', 'CurrentPeriodOff'
26
+ attr_accessor :spending_limit
27
+
21
28
 
22
29
  #
23
30
  # Mapper for SubscriptionPolicies class as Ruby Hash.
@@ -35,6 +42,7 @@ module Azure::Subscriptions::Mgmt::V2015_11_01
35
42
  location_placement_id: {
36
43
  client_side_validation: true,
37
44
  required: false,
45
+ read_only: true,
38
46
  serialized_name: 'locationPlacementId',
39
47
  type: {
40
48
  name: 'String'
@@ -43,10 +51,21 @@ module Azure::Subscriptions::Mgmt::V2015_11_01
43
51
  quota_id: {
44
52
  client_side_validation: true,
45
53
  required: false,
54
+ read_only: true,
46
55
  serialized_name: 'quotaId',
47
56
  type: {
48
57
  name: 'String'
49
58
  }
59
+ },
60
+ spending_limit: {
61
+ client_side_validation: true,
62
+ required: false,
63
+ read_only: true,
64
+ serialized_name: 'spendingLimit',
65
+ type: {
66
+ name: 'Enum',
67
+ module: 'SpendingLimit'
68
+ }
50
69
  }
51
70
  }
52
71
  }
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Subscriptions::Mgmt::V2019_06_01
7
+ module Models
8
+ #
9
+ # Defines values for SubscriptionState
10
+ #
11
+ module SubscriptionState
12
+ Enabled = "Enabled"
13
+ Warned = "Warned"
14
+ PastDue = "PastDue"
15
+ Disabled = "Disabled"
16
+ Deleted = "Deleted"
17
+ end
18
+ end
19
+ end
@@ -3,19 +3,21 @@
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
- module Azure::Subscriptions::Mgmt::V2015_11_01
6
+ module Azure::Subscriptions::Mgmt::V2019_06_01
7
7
  module Models
8
8
  #
9
- # Tenant Id information
9
+ # Tenant Id information.
10
10
  #
11
11
  class TenantIdDescription
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [String] Gets or sets Id
15
+ # @return [String] The fully qualified ID of the tenant. For example,
16
+ # /tenants/00000000-0000-0000-0000-000000000000.
16
17
  attr_accessor :id
17
18
 
18
- # @return [String] Gets or sets tenantId
19
+ # @return [String] The tenant ID. For example,
20
+ # 00000000-0000-0000-0000-000000000000.
19
21
  attr_accessor :tenant_id
20
22
 
21
23
 
@@ -35,6 +37,7 @@ module Azure::Subscriptions::Mgmt::V2015_11_01
35
37
  id: {
36
38
  client_side_validation: true,
37
39
  required: false,
40
+ read_only: true,
38
41
  serialized_name: 'id',
39
42
  type: {
40
43
  name: 'String'
@@ -43,6 +46,7 @@ module Azure::Subscriptions::Mgmt::V2015_11_01
43
46
  tenant_id: {
44
47
  client_side_validation: true,
45
48
  required: false,
49
+ read_only: true,
46
50
  serialized_name: 'tenantId',
47
51
  type: {
48
52
  name: 'String'
@@ -3,7 +3,7 @@
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
- module Azure::Subscriptions::Mgmt::V2015_11_01
6
+ module Azure::Subscriptions::Mgmt::V2019_06_01
7
7
  module Models
8
8
  #
9
9
  # Tenant Ids information.
@@ -13,10 +13,10 @@ module Azure::Subscriptions::Mgmt::V2015_11_01
13
13
  include MsRestAzure
14
14
 
15
15
  include MsRest::JSONable
16
- # @return [Array<TenantIdDescription>] Gets or sets tenant Ids.
16
+ # @return [Array<TenantIdDescription>] An array of tenants.
17
17
  attr_accessor :value
18
18
 
19
- # @return [String] Gets or sets the URL to get the next set of results.
19
+ # @return [String] The URL to use for getting the next set of results.
20
20
  attr_accessor :next_link
21
21
 
22
22
  # return [Proc] with next page method call.
@@ -6,4 +6,4 @@
6
6
  module Azure end
7
7
  module Azure::Subscriptions end
8
8
  module Azure::Subscriptions::Mgmt end
9
- module Azure::Subscriptions::Mgmt::V2015_11_01 end
9
+ module Azure::Subscriptions::Mgmt::V2019_06_01 end
@@ -0,0 +1,222 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Subscriptions::Mgmt::V2019_06_01
7
+ #
8
+ # All resource groups and resources exist within subscriptions. These
9
+ # operation enable you get information about your subscriptions and tenants.
10
+ # A tenant is a dedicated instance of Azure Active Directory (Azure AD) for
11
+ # your organization.
12
+ #
13
+ class Operations
14
+ include MsRestAzure
15
+
16
+ #
17
+ # Creates and initializes a new instance of the Operations class.
18
+ # @param client service class for accessing basic functionality.
19
+ #
20
+ def initialize(client)
21
+ @client = client
22
+ end
23
+
24
+ # @return [SubscriptionClient] reference to the SubscriptionClient
25
+ attr_reader :client
26
+
27
+ #
28
+ # Lists all of the available Microsoft.Resources REST API operations.
29
+ #
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [Array<Operation>] operation results.
34
+ #
35
+ def list(custom_headers:nil)
36
+ first_page = list_as_lazy(custom_headers:custom_headers)
37
+ first_page.get_all_items
38
+ end
39
+
40
+ #
41
+ # Lists all of the available Microsoft.Resources REST API operations.
42
+ #
43
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
44
+ # will be added to the HTTP request.
45
+ #
46
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
47
+ #
48
+ def list_with_http_info(custom_headers:nil)
49
+ list_async(custom_headers:custom_headers).value!
50
+ end
51
+
52
+ #
53
+ # Lists all of the available Microsoft.Resources REST API operations.
54
+ #
55
+ # @param [Hash{String => String}] A hash of custom headers that will be added
56
+ # to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
+ #
60
+ def list_async(custom_headers:nil)
61
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
62
+
63
+
64
+ request_headers = {}
65
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
66
+
67
+ # Set Headers
68
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
69
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
70
+ path_template = 'providers/Microsoft.Resources/operations'
71
+
72
+ request_url = @base_url || @client.base_url
73
+
74
+ options = {
75
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
76
+ query_params: {'api-version' => @client.api_version},
77
+ headers: request_headers.merge(custom_headers || {}),
78
+ base_url: request_url
79
+ }
80
+ promise = @client.make_request_async(:get, path_template, options)
81
+
82
+ promise = promise.then do |result|
83
+ http_response = result.response
84
+ status_code = http_response.status
85
+ response_content = http_response.body
86
+ unless status_code == 200
87
+ error_model = JSON.load(response_content)
88
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
89
+ end
90
+
91
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
92
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
93
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
94
+ # Deserialize Response
95
+ if status_code == 200
96
+ begin
97
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
98
+ result_mapper = Azure::Subscriptions::Mgmt::V2019_06_01::Models::OperationListResult.mapper()
99
+ result.body = @client.deserialize(result_mapper, parsed_response)
100
+ rescue Exception => e
101
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
102
+ end
103
+ end
104
+
105
+ result
106
+ end
107
+
108
+ promise.execute
109
+ end
110
+
111
+ #
112
+ # Lists all of the available Microsoft.Resources REST API operations.
113
+ #
114
+ # @param next_page_link [String] The NextLink from the previous successful call
115
+ # to List operation.
116
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
117
+ # will be added to the HTTP request.
118
+ #
119
+ # @return [OperationListResult] operation results.
120
+ #
121
+ def list_next(next_page_link, custom_headers:nil)
122
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
123
+ response.body unless response.nil?
124
+ end
125
+
126
+ #
127
+ # Lists all of the available Microsoft.Resources REST API operations.
128
+ #
129
+ # @param next_page_link [String] The NextLink from the previous successful call
130
+ # to List operation.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
135
+ #
136
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
137
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
138
+ end
139
+
140
+ #
141
+ # Lists all of the available Microsoft.Resources REST API operations.
142
+ #
143
+ # @param next_page_link [String] The NextLink from the previous successful call
144
+ # to List operation.
145
+ # @param [Hash{String => String}] A hash of custom headers that will be added
146
+ # to the HTTP request.
147
+ #
148
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
149
+ #
150
+ def list_next_async(next_page_link, custom_headers:nil)
151
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
152
+
153
+
154
+ request_headers = {}
155
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
156
+
157
+ # Set Headers
158
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
159
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
160
+ path_template = '{nextLink}'
161
+
162
+ request_url = @base_url || @client.base_url
163
+
164
+ options = {
165
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
166
+ skip_encoding_path_params: {'nextLink' => next_page_link},
167
+ headers: request_headers.merge(custom_headers || {}),
168
+ base_url: request_url
169
+ }
170
+ promise = @client.make_request_async(:get, path_template, options)
171
+
172
+ promise = promise.then do |result|
173
+ http_response = result.response
174
+ status_code = http_response.status
175
+ response_content = http_response.body
176
+ unless status_code == 200
177
+ error_model = JSON.load(response_content)
178
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
179
+ end
180
+
181
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
182
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
183
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
184
+ # Deserialize Response
185
+ if status_code == 200
186
+ begin
187
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
188
+ result_mapper = Azure::Subscriptions::Mgmt::V2019_06_01::Models::OperationListResult.mapper()
189
+ result.body = @client.deserialize(result_mapper, parsed_response)
190
+ rescue Exception => e
191
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
192
+ end
193
+ end
194
+
195
+ result
196
+ end
197
+
198
+ promise.execute
199
+ end
200
+
201
+ #
202
+ # Lists all of the available Microsoft.Resources REST API operations.
203
+ #
204
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
205
+ # will be added to the HTTP request.
206
+ #
207
+ # @return [OperationListResult] which provide lazy access to pages of the
208
+ # response.
209
+ #
210
+ def list_as_lazy(custom_headers:nil)
211
+ response = list_async(custom_headers:custom_headers).value!
212
+ unless response.nil?
213
+ page = response.body
214
+ page.next_method = Proc.new do |next_page_link|
215
+ list_next_async(next_page_link, custom_headers:custom_headers)
216
+ end
217
+ page
218
+ end
219
+ end
220
+
221
+ end
222
+ end
@@ -0,0 +1,136 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Subscriptions::Mgmt::V2019_06_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class SubscriptionClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The API version to use for the operation.
21
+ attr_reader :api_version
22
+
23
+ # @return [String] The preferred language for the response.
24
+ attr_accessor :accept_language
25
+
26
+ # @return [Integer] The retry timeout in seconds for Long Running
27
+ # Operations. Default value is 30.
28
+ attr_accessor :long_running_operation_retry_timeout
29
+
30
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
31
+ # generated. When set to true a unique x-ms-client-request-id value is
32
+ # generated and included in each request. Default is true.
33
+ attr_accessor :generate_client_request_id
34
+
35
+ # @return [Operations] operations
36
+ attr_reader :operations
37
+
38
+ # @return [Subscriptions] subscriptions
39
+ attr_reader :subscriptions
40
+
41
+ # @return [Tenants] tenants
42
+ attr_reader :tenants
43
+
44
+ #
45
+ # Creates initializes a new instance of the SubscriptionClient class.
46
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
47
+ # @param base_url [String] the base URI of the service.
48
+ # @param options [Array] filters to be applied to the HTTP requests.
49
+ #
50
+ def initialize(credentials = nil, base_url = nil, options = nil)
51
+ super(credentials, options)
52
+ @base_url = base_url || 'https://management.azure.com'
53
+
54
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
55
+ @credentials = credentials
56
+
57
+ @operations = Operations.new(self)
58
+ @subscriptions = Subscriptions.new(self)
59
+ @tenants = Tenants.new(self)
60
+ @api_version = '2019-06-01'
61
+ @accept_language = 'en-US'
62
+ @long_running_operation_retry_timeout = 30
63
+ @generate_client_request_id = true
64
+ add_telemetry
65
+ end
66
+
67
+ #
68
+ # Makes a request and returns the body of the response.
69
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
70
+ # @param path [String] the path, relative to {base_url}.
71
+ # @param options [Hash{String=>String}] specifying any request options like :body.
72
+ # @return [Hash{String=>String}] containing the body of the response.
73
+ # Example:
74
+ #
75
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
76
+ # path = "/path"
77
+ # options = {
78
+ # body: request_content,
79
+ # query_params: {'api-version' => '2016-02-01'}
80
+ # }
81
+ # result = @client.make_request(:put, path, options)
82
+ #
83
+ def make_request(method, path, options = {})
84
+ result = make_request_with_http_info(method, path, options)
85
+ result.body unless result.nil?
86
+ end
87
+
88
+ #
89
+ # Makes a request and returns the operation response.
90
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
91
+ # @param path [String] the path, relative to {base_url}.
92
+ # @param options [Hash{String=>String}] specifying any request options like :body.
93
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
94
+ #
95
+ def make_request_with_http_info(method, path, options = {})
96
+ result = make_request_async(method, path, options).value!
97
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
98
+ result
99
+ end
100
+
101
+ #
102
+ # Makes a request asynchronously.
103
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
104
+ # @param path [String] the path, relative to {base_url}.
105
+ # @param options [Hash{String=>String}] specifying any request options like :body.
106
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
107
+ #
108
+ def make_request_async(method, path, options = {})
109
+ fail ArgumentError, 'method is nil' if method.nil?
110
+ fail ArgumentError, 'path is nil' if path.nil?
111
+
112
+ request_url = options[:base_url] || @base_url
113
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
114
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
115
+ end
116
+
117
+ request_headers = @request_headers
118
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
119
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
120
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
121
+
122
+ super(request_url, method, path, options)
123
+ end
124
+
125
+
126
+ private
127
+ #
128
+ # Adds telemetry information.
129
+ #
130
+ def add_telemetry
131
+ sdk_information = 'azure_mgmt_subscriptions'
132
+ sdk_information = "#{sdk_information}/0.18.4"
133
+ add_user_agent_information(sdk_information)
134
+ end
135
+ end
136
+ end