This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated from bc5e15fa294467d7fe5106a0930cd8b7b7cc7a56 (#979)
- Loading branch information
1 parent
0f96959
commit 0af791b
Showing
16 changed files
with
968 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
201 changes: 201 additions & 0 deletions
201
..._mgmt_monitor/lib/generated/azure_mgmt_monitor/diagnostic_settings_category_operations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
# encoding: utf-8 | ||
# Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0 | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
|
||
module Azure::ARM::Monitor | ||
# | ||
# Monitor Management Client | ||
# | ||
class DiagnosticSettingsCategoryOperations | ||
include MsRestAzure | ||
|
||
# | ||
# Creates and initializes a new instance of the DiagnosticSettingsCategoryOperations class. | ||
# @param client service class for accessing basic functionality. | ||
# | ||
def initialize(client) | ||
@client = client | ||
end | ||
|
||
# @return [MonitorManagementClient] reference to the MonitorManagementClient | ||
attr_reader :client | ||
|
||
# | ||
# Gets the diagnostic settings category for the specified resource. | ||
# | ||
# @param resource_uri [String] The identifier of the resource. | ||
# @param name [String] The name of the diagnostic setting. | ||
# @param custom_headers [Hash{String => String}] A hash of custom headers that | ||
# will be added to the HTTP request. | ||
# | ||
# @return [DiagnosticSettingsCategoryResource] operation results. | ||
# | ||
def get(resource_uri, name, custom_headers = nil) | ||
response = get_async(resource_uri, name, custom_headers).value! | ||
response.body unless response.nil? | ||
end | ||
|
||
# | ||
# Gets the diagnostic settings category for the specified resource. | ||
# | ||
# @param resource_uri [String] The identifier of the resource. | ||
# @param name [String] The name of the diagnostic setting. | ||
# @param custom_headers [Hash{String => String}] A hash of custom headers that | ||
# will be added to the HTTP request. | ||
# | ||
# @return [MsRestAzure::AzureOperationResponse] HTTP response information. | ||
# | ||
def get_with_http_info(resource_uri, name, custom_headers = nil) | ||
get_async(resource_uri, name, custom_headers).value! | ||
end | ||
|
||
# | ||
# Gets the diagnostic settings category for the specified resource. | ||
# | ||
# @param resource_uri [String] The identifier of the resource. | ||
# @param name [String] The name of the diagnostic setting. | ||
# @param [Hash{String => String}] A hash of custom headers that will be added | ||
# to the HTTP request. | ||
# | ||
# @return [Concurrent::Promise] Promise object which holds the HTTP response. | ||
# | ||
def get_async(resource_uri, name, custom_headers = nil) | ||
fail ArgumentError, 'resource_uri is nil' if resource_uri.nil? | ||
api_version = '2017-05-01-preview' | ||
fail ArgumentError, 'name is nil' if name.nil? | ||
|
||
|
||
request_headers = {} | ||
|
||
# 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 = '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}' | ||
|
||
request_url = @base_url || @client.base_url | ||
|
||
options = { | ||
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], | ||
path_params: {'resourceUri' => resource_uri,'name' => name}, | ||
query_params: {'api-version' => 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? | ||
# Deserialize Response | ||
if status_code == 200 | ||
begin | ||
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) | ||
result_mapper = Azure::ARM::Monitor::Models::DiagnosticSettingsCategoryResource.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 | ||
|
||
# | ||
# Lists the diagnostic settings categories for the specified resource. | ||
# | ||
# @param resource_uri [String] The identifier of the resource. | ||
# @param custom_headers [Hash{String => String}] A hash of custom headers that | ||
# will be added to the HTTP request. | ||
# | ||
# @return [DiagnosticSettingsCategoryResourceCollection] operation results. | ||
# | ||
def list(resource_uri, custom_headers = nil) | ||
response = list_async(resource_uri, custom_headers).value! | ||
response.body unless response.nil? | ||
end | ||
|
||
# | ||
# Lists the diagnostic settings categories for the specified resource. | ||
# | ||
# @param resource_uri [String] The identifier of the resource. | ||
# @param custom_headers [Hash{String => String}] A hash of custom headers that | ||
# will be added to the HTTP request. | ||
# | ||
# @return [MsRestAzure::AzureOperationResponse] HTTP response information. | ||
# | ||
def list_with_http_info(resource_uri, custom_headers = nil) | ||
list_async(resource_uri, custom_headers).value! | ||
end | ||
|
||
# | ||
# Lists the diagnostic settings categories for the specified resource. | ||
# | ||
# @param resource_uri [String] The identifier of the resource. | ||
# @param [Hash{String => String}] A hash of custom headers that will be added | ||
# to the HTTP request. | ||
# | ||
# @return [Concurrent::Promise] Promise object which holds the HTTP response. | ||
# | ||
def list_async(resource_uri, custom_headers = nil) | ||
fail ArgumentError, 'resource_uri is nil' if resource_uri.nil? | ||
api_version = '2017-05-01-preview' | ||
|
||
|
||
request_headers = {} | ||
|
||
# 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 = '{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories' | ||
|
||
request_url = @base_url || @client.base_url | ||
|
||
options = { | ||
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]], | ||
path_params: {'resourceUri' => resource_uri}, | ||
query_params: {'api-version' => 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? | ||
# Deserialize Response | ||
if status_code == 200 | ||
begin | ||
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content) | ||
result_mapper = Azure::ARM::Monitor::Models::DiagnosticSettingsCategoryResourceCollection.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 | ||
|
||
end | ||
end |
Oops, something went wrong.