Class: Azure::StreamAnalytics::Mgmt::V2016_03_01::Transformations

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb

Overview

Stream Analytics Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Transformations

Creates and initializes a new instance of the Transformations class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientStreamAnalyticsManagementClient (readonly)

Returns reference to the StreamAnalyticsManagementClient.

Returns:



22
23
24
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 22

def client
  @client
end

Instance Method Details

#create_or_replace(transformation, resource_group_name, job_name, transformation_name, if_match: nil, if_none_match: nil, custom_headers: nil) ⇒ Transformation

Creates a transformation or replaces an already existing transformation under an existing streaming job.

that will be used to create a new transformation or replace the existing one under the streaming job. contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes. created, but to prevent updating an existing transformation. Other values will result in a 412 Pre-condition Failed response. will be added to the HTTP request.

Parameters:

  • transformation (Transformation)

    The definition of the transformation

  • resource_group_name (String)

    The name of the resource group that

  • job_name (String)

    The name of the streaming job.

  • transformation_name (String)

    The name of the transformation.

  • if_match (String) (defaults to: nil)

    The ETag of the transformation. Omit this value to

  • if_none_match (String) (defaults to: nil)

    Set to ‘*’ to allow a new transformation to be

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

    A hash of custom headers that

Returns:

  • (Transformation)

    operation results.



47
48
49
50
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 47

def create_or_replace(transformation, resource_group_name, job_name, transformation_name, if_match:nil, if_none_match:nil, custom_headers:nil)
  response = create_or_replace_async(transformation, resource_group_name, job_name, transformation_name, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_replace_async(transformation, resource_group_name, job_name, transformation_name, if_match: nil, if_none_match: nil, custom_headers: nil) ⇒ Concurrent::Promise

Creates a transformation or replaces an already existing transformation under an existing streaming job.

that will be used to create a new transformation or replace the existing one under the streaming job. contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes. created, but to prevent updating an existing transformation. Other values will result in a 412 Pre-condition Failed response. to the HTTP request.

Parameters:

  • transformation (Transformation)

    The definition of the transformation

  • resource_group_name (String)

    The name of the resource group that

  • job_name (String)

    The name of the streaming job.

  • transformation_name (String)

    The name of the transformation.

  • if_match (String) (defaults to: nil)

    The ETag of the transformation. Omit this value to

  • if_none_match (String) (defaults to: nil)

    Set to ‘*’ to allow a new transformation to be

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 102

def create_or_replace_async(transformation, resource_group_name, job_name, transformation_name, if_match:nil, if_none_match:nil, custom_headers:nil)
  fail ArgumentError, 'transformation is nil' if transformation.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, 'transformation_name is nil' if transformation_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['If-Match'] = if_match unless if_match.nil?
  request_headers['If-None-Match'] = if_none_match unless if_none_match.nil?
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::StreamAnalytics::Mgmt::V2016_03_01::Models::Transformation.mapper()
  request_content = @client.serialize(request_mapper,  transformation)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name,'transformationName' => transformation_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 MsRestAzure::AzureOperationError.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::StreamAnalytics::Mgmt::V2016_03_01::Models::Transformation.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::StreamAnalytics::Mgmt::V2016_03_01::Models::Transformation.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_replace_with_http_info(transformation, resource_group_name, job_name, transformation_name, if_match: nil, if_none_match: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a transformation or replaces an already existing transformation under an existing streaming job.

that will be used to create a new transformation or replace the existing one under the streaming job. contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes. created, but to prevent updating an existing transformation. Other values will result in a 412 Pre-condition Failed response. will be added to the HTTP request.

Parameters:

  • transformation (Transformation)

    The definition of the transformation

  • resource_group_name (String)

    The name of the resource group that

  • job_name (String)

    The name of the streaming job.

  • transformation_name (String)

    The name of the transformation.

  • if_match (String) (defaults to: nil)

    The ETag of the transformation. Omit this value to

  • if_none_match (String) (defaults to: nil)

    Set to ‘*’ to allow a new transformation to be

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



75
76
77
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 75

def create_or_replace_with_http_info(transformation, resource_group_name, job_name, transformation_name, if_match:nil, if_none_match:nil, custom_headers:nil)
  create_or_replace_async(transformation, resource_group_name, job_name, transformation_name, if_match:if_match, if_none_match:if_none_match, custom_headers:custom_headers).value!
end

#get(resource_group_name, job_name, transformation_name, custom_headers: nil) ⇒ Transformation

Gets details about the specified transformation.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • job_name (String)

    The name of the streaming job.

  • transformation_name (String)

    The name of the transformation.

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

    A hash of custom headers that

Returns:

  • (Transformation)

    operation results.



336
337
338
339
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 336

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

#get_async(resource_group_name, job_name, transformation_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets details about the specified transformation.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • job_name (String)

    The name of the streaming job.

  • transformation_name (String)

    The name of the transformation.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
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
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 371

def get_async(resource_group_name, job_name, transformation_name, custom_headers:nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, 'transformation_name is nil' if transformation_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 = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name,'transformationName' => transformation_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 MsRestAzure::AzureOperationError.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::StreamAnalytics::Mgmt::V2016_03_01::Models::Transformation.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_with_http_info(resource_group_name, job_name, transformation_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets details about the specified transformation.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • job_name (String)

    The name of the streaming job.

  • transformation_name (String)

    The name of the transformation.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



354
355
356
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 354

def get_with_http_info(resource_group_name, job_name, transformation_name, custom_headers:nil)
  get_async(resource_group_name, job_name, transformation_name, custom_headers:custom_headers).value!
end

#update(transformation, resource_group_name, job_name, transformation_name, if_match: nil, custom_headers: nil) ⇒ Transformation

Updates an existing transformation under an existing streaming job. This can be used to partially update (ie. update one or two properties) a transformation without affecting the rest the job or transformation definition.

properties specified here will overwrite the corresponding properties in the existing transformation (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing transformation will remain the same and not change as a result of this PATCH operation. contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes. will be added to the HTTP request.

Parameters:

  • transformation (Transformation)

    A Transformation object. The

  • resource_group_name (String)

    The name of the resource group that

  • job_name (String)

    The name of the streaming job.

  • transformation_name (String)

    The name of the transformation.

  • if_match (String) (defaults to: nil)

    The ETag of the transformation. Omit this value to

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

    A hash of custom headers that

Returns:

  • (Transformation)

    operation results.



201
202
203
204
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 201

def update(transformation, resource_group_name, job_name, transformation_name, if_match:nil, custom_headers:nil)
  response = update_async(transformation, resource_group_name, job_name, transformation_name, if_match:if_match, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_async(transformation, resource_group_name, job_name, transformation_name, if_match: nil, custom_headers: nil) ⇒ Concurrent::Promise

Updates an existing transformation under an existing streaming job. This can be used to partially update (ie. update one or two properties) a transformation without affecting the rest the job or transformation definition.

properties specified here will overwrite the corresponding properties in the existing transformation (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing transformation will remain the same and not change as a result of this PATCH operation. contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes. to the HTTP request.

Parameters:

  • transformation (Transformation)

    A Transformation object. The

  • resource_group_name (String)

    The name of the resource group that

  • job_name (String)

    The name of the streaming job.

  • transformation_name (String)

    The name of the transformation.

  • if_match (String) (defaults to: nil)

    The ETag of the transformation. Omit this value to

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
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
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 260

def update_async(transformation, resource_group_name, job_name, transformation_name, if_match:nil, custom_headers:nil)
  fail ArgumentError, 'transformation is nil' if transformation.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'job_name is nil' if job_name.nil?
  fail ArgumentError, 'transformation_name is nil' if transformation_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['If-Match'] = if_match unless if_match.nil?
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::StreamAnalytics::Mgmt::V2016_03_01::Models::Transformation.mapper()
  request_content = @client.serialize(request_mapper,  transformation)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StreamAnalytics/streamingjobs/{jobName}/transformations/{transformationName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'jobName' => job_name,'transformationName' => transformation_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(:patch, 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 MsRestAzure::AzureOperationError.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::StreamAnalytics::Mgmt::V2016_03_01::Models::Transformation.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

#update_with_http_info(transformation, resource_group_name, job_name, transformation_name, if_match: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates an existing transformation under an existing streaming job. This can be used to partially update (ie. update one or two properties) a transformation without affecting the rest the job or transformation definition.

properties specified here will overwrite the corresponding properties in the existing transformation (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing transformation will remain the same and not change as a result of this PATCH operation. contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. always overwrite the current transformation. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes. will be added to the HTTP request.

Parameters:

  • transformation (Transformation)

    A Transformation object. The

  • resource_group_name (String)

    The name of the resource group that

  • job_name (String)

    The name of the streaming job.

  • transformation_name (String)

    The name of the transformation.

  • if_match (String) (defaults to: nil)

    The ETag of the transformation. Omit this value to

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



231
232
233
# File 'lib/2016-03-01/generated/azure_mgmt_stream_analytics/transformations.rb', line 231

def update_with_http_info(transformation, resource_group_name, job_name, transformation_name, if_match:nil, custom_headers:nil)
  update_async(transformation, resource_group_name, job_name, transformation_name, if_match:if_match, custom_headers:custom_headers).value!
end