Class: Azure::Monitor::Mgmt::V2019_03_01::Baselines

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2019-03-01/generated/azure_mgmt_monitor/baselines.rb

Overview

Monitor Management Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Baselines

Creates and initializes a new instance of the Baselines class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2019-03-01/generated/azure_mgmt_monitor/baselines.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientMonitorManagementClient (readonly)

Returns reference to the MonitorManagementClient.

Returns:



22
23
24
# File 'lib/2019-03-01/generated/azure_mgmt_monitor/baselines.rb', line 22

def client
  @client
end

Instance Method Details

#list(resource_uri, metricnames: nil, metricnamespace: nil, timespan: nil, interval: nil, aggregation: nil, sensitivities: nil, filter: nil, result_type: nil, custom_headers: nil) ⇒ MetricBaselinesResponse

**Lists the metric baseline values for a resource**.

retrieve. for. following format 'startDateTime_ISO/endDateTime_ISO'. to retrieve. retrieve. data returned.
Example:
Metric contains metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' will be added to the HTTP request.

Parameters:

  • resource_uri (String)

    The identifier of the resource.

  • metricnames (String) (defaults to: nil)

    The names of the metrics (comma separated) to

  • metricnamespace (String) (defaults to: nil)

    Metric namespace to query metric definitions

  • timespan (String) (defaults to: nil)

    The timespan of the query. It is a string with the

  • interval (Duration) (defaults to: nil)

    The interval (i.e. timegrain) of the query.

  • aggregation (String) (defaults to: nil)

    The list of aggregation types (comma separated)

  • sensitivities (String) (defaults to: nil)

    The list of sensitivities (comma separated) to

  • filter (String) (defaults to: nil)

    The **$filter** is used to reduce the set of metric

  • result_type (ResultType) (defaults to: nil)

    Allows retrieving only metadata of the

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

    A hash of custom headers that

Returns:

  • (MetricBaselinesResponse)

    operation results.



57
58
59
60
# File 'lib/2019-03-01/generated/azure_mgmt_monitor/baselines.rb', line 57

def list(resource_uri, metricnames:nil, metricnamespace:nil, timespan:nil, interval:nil, aggregation:nil, sensitivities:nil, filter:nil, result_type:nil, custom_headers:nil)
  response = list_async(resource_uri, metricnames:metricnames, metricnamespace:metricnamespace, timespan:timespan, interval:interval, aggregation:aggregation, sensitivities:sensitivities, filter:filter, result_type:result_type, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_async(resource_uri, metricnames: nil, metricnamespace: nil, timespan: nil, interval: nil, aggregation: nil, sensitivities: nil, filter: nil, result_type: nil, custom_headers: nil) ⇒ Concurrent::Promise

**Lists the metric baseline values for a resource**.

retrieve. for. following format 'startDateTime_ISO/endDateTime_ISO'. to retrieve. retrieve. data returned.
Example:
Metric contains metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' to the HTTP request.

Parameters:

  • resource_uri (String)

    The identifier of the resource.

  • metricnames (String) (defaults to: nil)

    The names of the metrics (comma separated) to

  • metricnamespace (String) (defaults to: nil)

    Metric namespace to query metric definitions

  • timespan (String) (defaults to: nil)

    The timespan of the query. It is a string with the

  • interval (Duration) (defaults to: nil)

    The interval (i.e. timegrain) of the query.

  • aggregation (String) (defaults to: nil)

    The list of aggregation types (comma separated)

  • sensitivities (String) (defaults to: nil)

    The list of sensitivities (comma separated) to

  • filter (String) (defaults to: nil)

    The **$filter** is used to reduce the set of metric

  • result_type (ResultType) (defaults to: nil)

    Allows retrieving only metadata of the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/2019-03-01/generated/azure_mgmt_monitor/baselines.rb', line 132

def list_async(resource_uri, metricnames:nil, metricnamespace:nil, timespan:nil, interval:nil, aggregation:nil, sensitivities:nil, filter:nil, result_type:nil, custom_headers:nil)
  fail ArgumentError, 'resource_uri is nil' if resource_uri.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 = '{resourceUri}/providers/microsoft.insights/metricBaselines'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'resourceUri' => resource_uri},
      query_params: {'metricnames' => metricnames,'metricnamespace' => metricnamespace,'timespan' => timespan,'interval' => interval,'aggregation' => aggregation,'sensitivities' => sensitivities,'$filter' => filter,'resultType' => result_type,'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::Monitor::Mgmt::V2019_03_01::Models::MetricBaselinesResponse.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_with_http_info(resource_uri, metricnames: nil, metricnamespace: nil, timespan: nil, interval: nil, aggregation: nil, sensitivities: nil, filter: nil, result_type: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

**Lists the metric baseline values for a resource**.

retrieve. for. following format 'startDateTime_ISO/endDateTime_ISO'. to retrieve. retrieve. data returned.
Example:
Metric contains metadata A, B and C.
- Return all time series of C where A = a1 and B = b1 or b2
**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**
- Invalid variant:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**
This is invalid because the logical or operator cannot separate two different metadata names.
- Return all time series where A = a1, B = b1 and C = c1:
**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**
- Return all time series where A = a1
**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' will be added to the HTTP request.

Parameters:

  • resource_uri (String)

    The identifier of the resource.

  • metricnames (String) (defaults to: nil)

    The names of the metrics (comma separated) to

  • metricnamespace (String) (defaults to: nil)

    Metric namespace to query metric definitions

  • timespan (String) (defaults to: nil)

    The timespan of the query. It is a string with the

  • interval (Duration) (defaults to: nil)

    The interval (i.e. timegrain) of the query.

  • aggregation (String) (defaults to: nil)

    The list of aggregation types (comma separated)

  • sensitivities (String) (defaults to: nil)

    The list of sensitivities (comma separated) to

  • filter (String) (defaults to: nil)

    The **$filter** is used to reduce the set of metric

  • result_type (ResultType) (defaults to: nil)

    Allows retrieving only metadata of the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



95
96
97
# File 'lib/2019-03-01/generated/azure_mgmt_monitor/baselines.rb', line 95

def list_with_http_info(resource_uri, metricnames:nil, metricnamespace:nil, timespan:nil, interval:nil, aggregation:nil, sensitivities:nil, filter:nil, result_type:nil, custom_headers:nil)
  list_async(resource_uri, metricnames:metricnames, metricnamespace:metricnamespace, timespan:timespan, interval:interval, aggregation:aggregation, sensitivities:sensitivities, filter:filter, result_type:result_type, custom_headers:custom_headers).value!
end