azure_mgmt_policy_insights 0.17.4 → 0.17.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +20 -20
  3. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights.rb +0 -0
  4. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/column.rb +0 -0
  5. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operation.rb +0 -0
  6. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +0 -0
  7. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +0 -0
  8. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +0 -0
  9. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table.rb +0 -0
  10. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_columns.rb +0 -0
  11. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results_table_metadata.rb +0 -0
  12. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +0 -0
  13. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table.rb +0 -0
  14. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_columns.rb +0 -0
  15. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results_table_metadata.rb +0 -0
  16. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +0 -0
  17. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +0 -0
  18. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +0 -0
  19. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +0 -0
  20. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/module_definition.rb +0 -0
  21. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/operations.rb +2 -0
  22. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_events.rb +8 -0
  23. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  24. data/lib/2017-08-09-preview/generated/azure_mgmt_policy_insights/policy_states.rb +8 -0
  25. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights.rb +0 -0
  26. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operation.rb +0 -0
  27. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +0 -0
  28. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +0 -0
  29. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +0 -0
  30. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +0 -0
  31. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +0 -0
  32. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +0 -0
  33. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +0 -0
  34. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +0 -0
  35. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +0 -0
  36. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +0 -0
  37. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/module_definition.rb +0 -0
  38. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/operations.rb +2 -0
  39. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_events.rb +10 -0
  40. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  41. data/lib/2017-10-17-preview/generated/azure_mgmt_policy_insights/policy_states.rb +10 -0
  42. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights.rb +0 -0
  43. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operation.rb +0 -0
  44. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +0 -0
  45. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +0 -0
  46. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +0 -0
  47. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +0 -0
  48. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_event.rb +0 -0
  49. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +0 -0
  50. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +0 -0
  51. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +0 -0
  52. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +0 -0
  53. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +0 -0
  54. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +0 -0
  55. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +0 -0
  56. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summarize_results.rb +0 -0
  57. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summary.rb +0 -0
  58. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/models/summary_results.rb +0 -0
  59. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/module_definition.rb +0 -0
  60. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/operations.rb +2 -0
  61. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_events.rb +18 -0
  62. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  63. data/lib/2017-12-12-preview/generated/azure_mgmt_policy_insights/policy_states.rb +34 -0
  64. data/lib/2018-04-04/generated/azure_mgmt_policy_insights.rb +0 -0
  65. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operation.rb +0 -0
  66. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operation_display.rb +0 -0
  67. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +0 -0
  68. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +0 -0
  69. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +0 -0
  70. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_event.rb +0 -0
  71. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_events_query_results.rb +0 -0
  72. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_state.rb +0 -0
  73. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +0 -0
  74. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +0 -0
  75. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure.rb +0 -0
  76. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +0 -0
  77. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/query_options.rb +0 -0
  78. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summarize_results.rb +0 -0
  79. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summary.rb +0 -0
  80. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/models/summary_results.rb +0 -0
  81. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/module_definition.rb +0 -0
  82. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/operations.rb +2 -0
  83. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_events.rb +18 -0
  84. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  85. data/lib/2018-04-04/generated/azure_mgmt_policy_insights/policy_states.rb +34 -0
  86. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights.rb +0 -0
  87. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/error_definition.rb +0 -0
  88. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/error_response.rb +0 -0
  89. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/expression_evaluation_details.rb +0 -0
  90. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/if_not_exists_evaluation_details.rb +0 -0
  91. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/operation.rb +0 -0
  92. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/operation_display.rb +0 -0
  93. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +0 -0
  94. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +0 -0
  95. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +0 -0
  96. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_details.rb +0 -0
  97. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_evaluation_details.rb +0 -0
  98. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_state.rb +0 -0
  99. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +0 -0
  100. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +0 -0
  101. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_tracked_resource.rb +0 -0
  102. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/policy_tracked_resources_query_results.rb +0 -0
  103. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_failure.rb +0 -0
  104. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +0 -0
  105. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/query_options.rb +0 -0
  106. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation.rb +0 -0
  107. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployment.rb +0 -0
  108. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployment_summary.rb +0 -0
  109. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_deployments_list_result.rb +0 -0
  110. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_filters.rb +0 -0
  111. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/remediation_list_result.rb +0 -0
  112. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/summarize_results.rb +0 -0
  113. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/summary.rb +0 -0
  114. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/summary_results.rb +0 -0
  115. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/tracked_resource_modification_details.rb +0 -0
  116. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/models/typed_error_info.rb +0 -0
  117. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/module_definition.rb +0 -0
  118. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/operations.rb +2 -0
  119. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_insights_client.rb +1 -1
  120. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_states.rb +34 -0
  121. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/policy_tracked_resources.rb +16 -0
  122. data/lib/2018-07-01-preview/generated/azure_mgmt_policy_insights/remediations.rb +64 -0
  123. data/lib/2019-10-01/generated/azure_mgmt_policy_insights.rb +55 -0
  124. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/compliance_detail.rb +57 -0
  125. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/error_definition.rb +115 -0
  126. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/error_response.rb +47 -0
  127. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/expression_evaluation_details.rb +103 -0
  128. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/if_not_exists_evaluation_details.rb +59 -0
  129. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/operation.rb +59 -0
  130. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/operation_display.rb +79 -0
  131. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/operations_list_results.rb +70 -0
  132. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_assignment_summary.rb +110 -0
  133. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_definition_summary.rb +99 -0
  134. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_evaluation_details.rb +69 -0
  135. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_group_summary.rb +59 -0
  136. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_metadata.rb +168 -0
  137. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_metadata_collection.rb +101 -0
  138. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_state.rb +404 -0
  139. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_states_query_results.rb +82 -0
  140. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/policy_states_resource.rb +16 -0
  141. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/query_failure.rb +47 -0
  142. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/query_failure_error.rb +60 -0
  143. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/query_options.rb +123 -0
  144. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/slim_policy_metadata.rb +145 -0
  145. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/summarize_results.rb +83 -0
  146. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/summary.rb +91 -0
  147. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/summary_results.rb +140 -0
  148. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/models/typed_error_info.rb +59 -0
  149. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/module_definition.rb +9 -0
  150. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/operations.rb +109 -0
  151. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_insights_client.rb +136 -0
  152. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_metadata_operations.rb +316 -0
  153. data/lib/2019-10-01/generated/azure_mgmt_policy_insights/policy_states.rb +2025 -0
  154. data/lib/azure_mgmt_policy_insights.rb +3 -2
  155. data/lib/module_definition.rb +7 -7
  156. data/lib/profiles/latest/modules/policyinsights_profile_module.rb +39 -9
  157. data/lib/profiles/latest/policyinsights_latest_profile_client.rb +40 -40
  158. data/lib/profiles/latest/policyinsights_module_definition.rb +8 -8
  159. data/lib/version.rb +1 -1
  160. metadata +36 -5
@@ -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::PolicyInsights::Mgmt::V2019_10_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class PolicyInsightsClient < 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] Client Api Version.
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 [PolicyStates] policy_states
36
+ attr_reader :policy_states
37
+
38
+ # @return [Operations] operations
39
+ attr_reader :operations
40
+
41
+ # @return [PolicyMetadataOperations] policy_metadata_operations
42
+ attr_reader :policy_metadata_operations
43
+
44
+ #
45
+ # Creates initializes a new instance of the PolicyInsightsClient 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
+ @policy_states = PolicyStates.new(self)
58
+ @operations = Operations.new(self)
59
+ @policy_metadata_operations = PolicyMetadataOperations.new(self)
60
+ @api_version = '2019-10-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_policy_insights'
132
+ sdk_information = "#{sdk_information}/0.17.5"
133
+ add_user_agent_information(sdk_information)
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,316 @@
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::PolicyInsights::Mgmt::V2019_10_01
7
+ #
8
+ # PolicyMetadataOperations
9
+ #
10
+ class PolicyMetadataOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PolicyMetadataOperations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [PolicyInsightsClient] reference to the PolicyInsightsClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Get policy metadata resource.
26
+ #
27
+ # @param resource_name [String] The name of the policy metadata resource.
28
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
29
+ # will be added to the HTTP request.
30
+ #
31
+ # @return [PolicyMetadata] operation results.
32
+ #
33
+ def get_resource(resource_name, custom_headers:nil)
34
+ response = get_resource_async(resource_name, custom_headers:custom_headers).value!
35
+ response.body unless response.nil?
36
+ end
37
+
38
+ #
39
+ # Get policy metadata resource.
40
+ #
41
+ # @param resource_name [String] The name of the policy metadata resource.
42
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
43
+ # will be added to the HTTP request.
44
+ #
45
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
46
+ #
47
+ def get_resource_with_http_info(resource_name, custom_headers:nil)
48
+ get_resource_async(resource_name, custom_headers:custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Get policy metadata resource.
53
+ #
54
+ # @param resource_name [String] The name of the policy metadata resource.
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 get_resource_async(resource_name, custom_headers:nil)
61
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
62
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
63
+
64
+
65
+ request_headers = {}
66
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
67
+
68
+ # Set Headers
69
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
70
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
71
+ path_template = 'providers/Microsoft.PolicyInsights/policyMetadata/{resourceName}'
72
+
73
+ request_url = @base_url || @client.base_url
74
+
75
+ options = {
76
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
77
+ skip_encoding_path_params: {'resourceName' => resource_name},
78
+ query_params: {'api-version' => @client.api_version},
79
+ headers: request_headers.merge(custom_headers || {}),
80
+ base_url: request_url
81
+ }
82
+ promise = @client.make_request_async(:get, path_template, options)
83
+
84
+ promise = promise.then do |result|
85
+ http_response = result.response
86
+ status_code = http_response.status
87
+ response_content = http_response.body
88
+ unless status_code == 200
89
+ error_model = JSON.load(response_content)
90
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
91
+ end
92
+
93
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
94
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
95
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
96
+ # Deserialize Response
97
+ if status_code == 200
98
+ begin
99
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
100
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyMetadata.mapper()
101
+ result.body = @client.deserialize(result_mapper, parsed_response)
102
+ rescue Exception => e
103
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
104
+ end
105
+ end
106
+
107
+ result
108
+ end
109
+
110
+ promise.execute
111
+ end
112
+
113
+ #
114
+ # Get a list of the policy metadata resources.
115
+ #
116
+ # @param query_options [QueryOptions] Additional parameters for the operation
117
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
118
+ # will be added to the HTTP request.
119
+ #
120
+ # @return [Array<SlimPolicyMetadata>] operation results.
121
+ #
122
+ def list(query_options:nil, custom_headers:nil)
123
+ first_page = list_as_lazy(query_options:query_options, custom_headers:custom_headers)
124
+ first_page.get_all_items
125
+ end
126
+
127
+ #
128
+ # Get a list of the policy metadata resources.
129
+ #
130
+ # @param query_options [QueryOptions] Additional parameters for the 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_with_http_info(query_options:nil, custom_headers:nil)
137
+ list_async(query_options:query_options, custom_headers:custom_headers).value!
138
+ end
139
+
140
+ #
141
+ # Get a list of the policy metadata resources.
142
+ #
143
+ # @param query_options [QueryOptions] Additional parameters for the operation
144
+ # @param [Hash{String => String}] A hash of custom headers that will be added
145
+ # to the HTTP request.
146
+ #
147
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
148
+ #
149
+ def list_async(query_options:nil, custom_headers:nil)
150
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
151
+
152
+ top = nil
153
+ unless query_options.nil?
154
+ top = query_options.Top
155
+ end
156
+
157
+ request_headers = {}
158
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
159
+
160
+ # Set Headers
161
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
162
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
163
+ path_template = 'providers/Microsoft.PolicyInsights/policyMetadata'
164
+
165
+ request_url = @base_url || @client.base_url
166
+
167
+ options = {
168
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
169
+ query_params: {'api-version' => @client.api_version,'$top' => top},
170
+ headers: request_headers.merge(custom_headers || {}),
171
+ base_url: request_url
172
+ }
173
+ promise = @client.make_request_async(:get, path_template, options)
174
+
175
+ promise = promise.then do |result|
176
+ http_response = result.response
177
+ status_code = http_response.status
178
+ response_content = http_response.body
179
+ unless status_code == 200
180
+ error_model = JSON.load(response_content)
181
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
182
+ end
183
+
184
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
185
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
186
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
187
+ # Deserialize Response
188
+ if status_code == 200
189
+ begin
190
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
191
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyMetadataCollection.mapper()
192
+ result.body = @client.deserialize(result_mapper, parsed_response)
193
+ rescue Exception => e
194
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
195
+ end
196
+ end
197
+
198
+ result
199
+ end
200
+
201
+ promise.execute
202
+ end
203
+
204
+ #
205
+ # Get a list of the policy metadata resources.
206
+ #
207
+ # @param next_page_link [String] The NextLink from the previous successful call
208
+ # to List operation.
209
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
210
+ # will be added to the HTTP request.
211
+ #
212
+ # @return [PolicyMetadataCollection] operation results.
213
+ #
214
+ def list_next(next_page_link, custom_headers:nil)
215
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
216
+ response.body unless response.nil?
217
+ end
218
+
219
+ #
220
+ # Get a list of the policy metadata resources.
221
+ #
222
+ # @param next_page_link [String] The NextLink from the previous successful call
223
+ # to List operation.
224
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
225
+ # will be added to the HTTP request.
226
+ #
227
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
228
+ #
229
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
230
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
231
+ end
232
+
233
+ #
234
+ # Get a list of the policy metadata resources.
235
+ #
236
+ # @param next_page_link [String] The NextLink from the previous successful call
237
+ # to List operation.
238
+ # @param [Hash{String => String}] A hash of custom headers that will be added
239
+ # to the HTTP request.
240
+ #
241
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
242
+ #
243
+ def list_next_async(next_page_link, custom_headers:nil)
244
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
245
+
246
+
247
+ request_headers = {}
248
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
249
+
250
+ # Set Headers
251
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
252
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
253
+ path_template = '{nextLink}'
254
+
255
+ request_url = @base_url || @client.base_url
256
+
257
+ options = {
258
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
259
+ skip_encoding_path_params: {'nextLink' => next_page_link},
260
+ headers: request_headers.merge(custom_headers || {}),
261
+ base_url: request_url
262
+ }
263
+ promise = @client.make_request_async(:get, path_template, options)
264
+
265
+ promise = promise.then do |result|
266
+ http_response = result.response
267
+ status_code = http_response.status
268
+ response_content = http_response.body
269
+ unless status_code == 200
270
+ error_model = JSON.load(response_content)
271
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
272
+ end
273
+
274
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
275
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
276
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
277
+ # Deserialize Response
278
+ if status_code == 200
279
+ begin
280
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
281
+ result_mapper = Azure::PolicyInsights::Mgmt::V2019_10_01::Models::PolicyMetadataCollection.mapper()
282
+ result.body = @client.deserialize(result_mapper, parsed_response)
283
+ rescue Exception => e
284
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
285
+ end
286
+ end
287
+
288
+ result
289
+ end
290
+
291
+ promise.execute
292
+ end
293
+
294
+ #
295
+ # Get a list of the policy metadata resources.
296
+ #
297
+ # @param query_options [QueryOptions] Additional parameters for the operation
298
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
299
+ # will be added to the HTTP request.
300
+ #
301
+ # @return [PolicyMetadataCollection] which provide lazy access to pages of the
302
+ # response.
303
+ #
304
+ def list_as_lazy(query_options:nil, custom_headers:nil)
305
+ response = list_async(query_options:query_options, custom_headers:custom_headers).value!
306
+ unless response.nil?
307
+ page = response.body
308
+ page.next_method = Proc.new do |next_page_link|
309
+ list_next_async(next_page_link, custom_headers:custom_headers)
310
+ end
311
+ page
312
+ end
313
+ end
314
+
315
+ end
316
+ end