Class: Azure::MobileEngagement::Mgmt::V2014_12_01::Campaigns

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb

Overview

Microsoft Azure Mobile Engagement REST APIs.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Campaigns

Creates and initializes a new instance of the Campaigns class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientEngagementManagementClient (readonly)

Returns reference to the EngagementManagementClient.

Returns:



22
23
24
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 22

def client
  @client
end

Instance Method Details

#activate(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil) ⇒ CampaignStateResult

Activate a campaign previously created by a call to Create campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

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

    A hash of custom headers that

Returns:

  • (CampaignStateResult)

    operation results.



999
1000
1001
1002
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 999

def activate(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil)
  response = activate_async(resource_group_name, app_collection, app_name, kind, id, custom_headers).value!
  response.body unless response.nil?
end

#activate_async(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil) ⇒ Concurrent::Promise

Activate a campaign previously created by a call to Create campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1036

def activate_async(resource_group_name, app_collection, app_name, kind, id, custom_headers = 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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'id is nil' if id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/activate'

  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,'appCollection' => app_collection,'appName' => app_name,'kind' => kind,'id' => id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignStateResult.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

#activate_with_http_info(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Activate a campaign previously created by a call to Create campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1018
1019
1020
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1018

def activate_with_http_info(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil)
  activate_async(resource_group_name, app_collection, app_name, kind, id, custom_headers).value!
end

#create(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = nil) ⇒ CampaignStateResult

Create a push campaign (announcement, poll, data push or native push).

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • parameters (Campaign)

    Parameters supplied to the Update Campaign

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

    A hash of custom headers that

Returns:

  • (CampaignStateResult)

    operation results.



204
205
206
207
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 204

def create(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = nil)
  response = create_async(resource_group_name, app_collection, app_name, kind, parameters, custom_headers).value!
  response.body unless response.nil?
end

#create_async(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Create a push campaign (announcement, poll, data push or native push).

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • parameters (Campaign)

    Parameters supplied to the Update Campaign

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
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
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 243

def create_async(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = 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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::MobileEngagement::Mgmt::V2014_12_01::Models::Campaign.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}'

  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,'appCollection' => app_collection,'appName' => app_name,'kind' => kind},
      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(:post, 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 == 201
      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 == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignStateResult.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_with_http_info(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Create a push campaign (announcement, poll, data push or native push).

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • parameters (Campaign)

    Parameters supplied to the Update Campaign

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



224
225
226
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 224

def create_with_http_info(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = nil)
  create_async(resource_group_name, app_collection, app_name, kind, parameters, custom_headers).value!
end

#delete(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ Object

Delete a campaign previously created by a call to Create campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

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

    A hash of custom headers that



554
555
556
557
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 554

def delete(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil)
  response = delete_async(kind, id, resource_group_name, app_collection, app_name, custom_headers).value!
  nil
end

#delete_async(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ Concurrent::Promise

Delete a campaign previously created by a call to Create campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 591

def delete_async(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil)
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'id is nil' if id.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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'kind' => kind,'id' => id,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'appCollection' => app_collection,'appName' => app_name},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, 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
  end

  promise.execute
end

#delete_with_http_info(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Delete a campaign previously created by a call to Create campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



573
574
575
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 573

def delete_with_http_info(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil)
  delete_async(kind, id, resource_group_name, app_collection, app_name, custom_headers).value!
end

#finish(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil) ⇒ CampaignStateResult

Finish a push campaign previously activated by a call to Activate campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

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

    A hash of custom headers that

Returns:

  • (CampaignStateResult)

    operation results.



1442
1443
1444
1445
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1442

def finish(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil)
  response = finish_async(resource_group_name, app_collection, app_name, kind, id, custom_headers).value!
  response.body unless response.nil?
end

#finish_async(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil) ⇒ Concurrent::Promise

Finish a push campaign previously activated by a call to Activate campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1479

def finish_async(resource_group_name, app_collection, app_name, kind, id, custom_headers = 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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'id is nil' if id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/finish'

  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,'appCollection' => app_collection,'appName' => app_name,'kind' => kind,'id' => id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignStateResult.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

#finish_with_http_info(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Finish a push campaign previously activated by a call to Activate campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1461
1462
1463
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1461

def finish_with_http_info(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil)
  finish_async(resource_group_name, app_collection, app_name, kind, id, custom_headers).value!
end

#get(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ CampaignResult

The Get campaign operation retrieves information about a previously created campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

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

    A hash of custom headers that

Returns:

  • (CampaignResult)

    operation results.



322
323
324
325
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 322

def get(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil)
  response = get_async(kind, id, resource_group_name, app_collection, app_name, custom_headers).value!
  response.body unless response.nil?
end

#get_async(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ Concurrent::Promise

The Get campaign operation retrieves information about a previously created campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



361
362
363
364
365
366
367
368
369
370
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
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 361

def get_async(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil)
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'id is nil' if id.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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'kind' => kind,'id' => id,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'appCollection' => app_collection,'appName' => app_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 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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignResult.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_by_name(resource_group_name, app_collection, app_name, kind, name, custom_headers = nil) ⇒ CampaignResult

The Get campaign operation retrieves information about a previously created campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • name (String)

    Campaign name.

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

    A hash of custom headers that

Returns:

  • (CampaignResult)

    operation results.



651
652
653
654
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 651

def get_by_name(resource_group_name, app_collection, app_name, kind, name, custom_headers = nil)
  response = get_by_name_async(resource_group_name, app_collection, app_name, kind, name, custom_headers).value!
  response.body unless response.nil?
end

#get_by_name_async(resource_group_name, app_collection, app_name, kind, name, custom_headers = nil) ⇒ Concurrent::Promise

The Get campaign operation retrieves information about a previously created campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • name (String)

    Campaign name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 690

def get_by_name_async(resource_group_name, app_collection, app_name, kind, name, custom_headers = 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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaignsByName/{kind}/{name}'

  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,'appCollection' => app_collection,'appName' => app_name,'kind' => kind,'name' => 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 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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignResult.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_by_name_with_http_info(resource_group_name, app_collection, app_name, kind, name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

The Get campaign operation retrieves information about a previously created campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • name (String)

    Campaign name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



671
672
673
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 671

def get_by_name_with_http_info(resource_group_name, app_collection, app_name, kind, name, custom_headers = nil)
  get_by_name_async(resource_group_name, app_collection, app_name, kind, name, custom_headers).value!
end

#get_statistics(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ CampaignStatisticsResult

Get all the campaign statistics.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

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

    A hash of custom headers that

Returns:

  • (CampaignStatisticsResult)

    operation results.



1336
1337
1338
1339
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1336

def get_statistics(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil)
  response = get_statistics_async(kind, id, resource_group_name, app_collection, app_name, custom_headers).value!
  response.body unless response.nil?
end

#get_statistics_async(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ Concurrent::Promise

Get all the campaign statistics.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1373

def get_statistics_async(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil)
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'id is nil' if id.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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/statistics'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'kind' => kind,'id' => id,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'appCollection' => app_collection,'appName' => app_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 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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignStatisticsResult.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_statistics_with_http_info(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get all the campaign statistics.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1355
1356
1357
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1355

def get_statistics_with_http_info(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil)
  get_statistics_async(kind, id, resource_group_name, app_collection, app_name, custom_headers).value!
end

#get_with_http_info(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

The Get campaign operation retrieves information about a previously created campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



342
343
344
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 342

def get_with_http_info(kind, id, resource_group_name, app_collection, app_name, custom_headers = nil)
  get_async(kind, id, resource_group_name, app_collection, app_name, custom_headers).value!
end

#list(resource_group_name, app_collection, app_name, kind, skip = nil, top = nil, filter = nil, orderby = nil, search = nil, custom_headers = nil) ⇒ Array<CampaignListResult>

Get the list of campaigns.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ offset, defaults to 0 (1st page of data). return with each call. It returns all campaigns by default. When specifying $top parameter, the response contains a ‘nextLink` property describing the path to get the next page if there are more results. campaigns matching a specific state. The syntax is `$filter=state eq ’draft’‘. Valid state values are: draft, scheduled, in-progress, and finished. Only the eq operator and the state property are supported. `$orderby=id asc` (this example is actually the default behavior). The syntax is orderby=property direction or just orderby=property. The available sorting properties are id, name, state, activatedDate, and finishedDate. The available directions are asc (for ascending order) and desc (for descending order). When not specified the asc direction is used. Only one property at a time can be used for sorting. `search` expression. This currently performs the search based on the name on the campaign only, case insensitive. If the campaign contains the value of the `search` parameter anywhere in the name, it matches. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • skip (Integer) (defaults to: nil)

    Control paging of campaigns, start results at the given

  • top (Integer) (defaults to: nil)

    Control paging of campaigns, number of campaigns to

  • filter (String) (defaults to: nil)

    Filter can be used to restrict the results to

  • orderby (String) (defaults to: nil)

    Sort results by an expression which looks like

  • search (String) (defaults to: nil)

    Restrict results to campaigns matching the optional

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

    A hash of custom headers that

Returns:

  • (Array<CampaignListResult>)

    operation results.



58
59
60
61
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 58

def list(resource_group_name, app_collection, app_name, kind, skip = nil, top = nil, filter = nil, orderby = nil, search = nil, custom_headers = nil)
  first_page = list_as_lazy(resource_group_name, app_collection, app_name, kind, skip, top, filter, orderby, search, custom_headers)
  first_page.get_all_items
end

#list_as_lazy(resource_group_name, app_collection, app_name, kind, skip = nil, top = nil, filter = nil, orderby = nil, search = nil, custom_headers = nil) ⇒ CampaignsListResult

Get the list of campaigns.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ offset, defaults to 0 (1st page of data). return with each call. It returns all campaigns by default. When specifying $top parameter, the response contains a ‘nextLink` property describing the path to get the next page if there are more results. campaigns matching a specific state. The syntax is `$filter=state eq ’draft’‘. Valid state values are: draft, scheduled, in-progress, and finished. Only the eq operator and the state property are supported. `$orderby=id asc` (this example is actually the default behavior). The syntax is orderby=property direction or just orderby=property. The available sorting properties are id, name, state, activatedDate, and finishedDate. The available directions are asc (for ascending order) and desc (for descending order). When not specified the asc direction is used. Only one property at a time can be used for sorting. `search` expression. This currently performs the search based on the name on the campaign only, case insensitive. If the campaign contains the value of the `search` parameter anywhere in the name, it matches. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • skip (Integer) (defaults to: nil)

    Control paging of campaigns, start results at the given

  • top (Integer) (defaults to: nil)

    Control paging of campaigns, number of campaigns to

  • filter (String) (defaults to: nil)

    Filter can be used to restrict the results to

  • orderby (String) (defaults to: nil)

    Sort results by an expression which looks like

  • search (String) (defaults to: nil)

    Restrict results to campaigns matching the optional

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

    A hash of custom headers that

Returns:

  • (CampaignsListResult)

    which provide lazy access to pages of the



1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1656

def list_as_lazy(resource_group_name, app_collection, app_name, kind, skip = nil, top = nil, filter = nil, orderby = nil, search = nil, custom_headers = nil)
  response = list_async(resource_group_name, app_collection, app_name, kind, skip, top, filter, orderby, search, custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_next_async(next_page_link, custom_headers)
    end
    page
  end
end

#list_async(resource_group_name, app_collection, app_name, kind, skip = nil, top = nil, filter = nil, orderby = nil, search = nil, custom_headers = nil) ⇒ Concurrent::Promise

Get the list of campaigns.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ offset, defaults to 0 (1st page of data). return with each call. It returns all campaigns by default. When specifying $top parameter, the response contains a ‘nextLink` property describing the path to get the next page if there are more results. campaigns matching a specific state. The syntax is `$filter=state eq ’draft’‘. Valid state values are: draft, scheduled, in-progress, and finished. Only the eq operator and the state property are supported. `$orderby=id asc` (this example is actually the default behavior). The syntax is orderby=property direction or just orderby=property. The available sorting properties are id, name, state, activatedDate, and finishedDate. The available directions are asc (for ascending order) and desc (for descending order). When not specified the asc direction is used. Only one property at a time can be used for sorting. `search` expression. This currently performs the search based on the name on the campaign only, case insensitive. If the campaign contains the value of the `search` parameter anywhere in the name, it matches. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • skip (Integer) (defaults to: nil)

    Control paging of campaigns, start results at the given

  • top (Integer) (defaults to: nil)

    Control paging of campaigns, number of campaigns to

  • filter (String) (defaults to: nil)

    Filter can be used to restrict the results to

  • orderby (String) (defaults to: nil)

    Sort results by an expression which looks like

  • search (String) (defaults to: nil)

    Restrict results to campaigns matching the optional

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
184
185
186
187
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 135

def list_async(resource_group_name, app_collection, app_name, kind, skip = nil, top = nil, filter = nil, orderby = nil, search = nil, custom_headers = 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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'kind is nil' if kind.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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}'

  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,'appCollection' => app_collection,'appName' => app_name,'kind' => kind},
      query_params: {'api-version' => @client.api_version,'$skip' => skip,'$top' => top,'$filter' => filter,'$orderby' => orderby,'$search' => search},
      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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignsListResult.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_next(next_page_link, custom_headers = nil) ⇒ CampaignsListResult

Get the list of campaigns.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (CampaignsListResult)

    operation results.



1544
1545
1546
1547
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1544

def list_next(next_page_link, custom_headers = nil)
  response = list_next_async(next_page_link, custom_headers).value!
  response.body unless response.nil?
end

#list_next_async(next_page_link, custom_headers = nil) ⇒ Concurrent::Promise

Get the list of campaigns.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1573

def list_next_async(next_page_link, custom_headers = nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignsListResult.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_next_with_http_info(next_page_link, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get the list of campaigns.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1559
1560
1561
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1559

def list_next_with_http_info(next_page_link, custom_headers = nil)
  list_next_async(next_page_link, custom_headers).value!
end

#list_with_http_info(resource_group_name, app_collection, app_name, kind, skip = nil, top = nil, filter = nil, orderby = nil, search = nil, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Get the list of campaigns.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ offset, defaults to 0 (1st page of data). return with each call. It returns all campaigns by default. When specifying $top parameter, the response contains a ‘nextLink` property describing the path to get the next page if there are more results. campaigns matching a specific state. The syntax is `$filter=state eq ’draft’‘. Valid state values are: draft, scheduled, in-progress, and finished. Only the eq operator and the state property are supported. `$orderby=id asc` (this example is actually the default behavior). The syntax is orderby=property direction or just orderby=property. The available sorting properties are id, name, state, activatedDate, and finishedDate. The available directions are asc (for ascending order) and desc (for descending order). When not specified the asc direction is used. Only one property at a time can be used for sorting. `search` expression. This currently performs the search based on the name on the campaign only, case insensitive. If the campaign contains the value of the `search` parameter anywhere in the name, it matches. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • skip (Integer) (defaults to: nil)

    Control paging of campaigns, start results at the given

  • top (Integer) (defaults to: nil)

    Control paging of campaigns, number of campaigns to

  • filter (String) (defaults to: nil)

    Filter can be used to restrict the results to

  • orderby (String) (defaults to: nil)

    Sort results by an expression which looks like

  • search (String) (defaults to: nil)

    Restrict results to campaigns matching the optional

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



97
98
99
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 97

def list_with_http_info(resource_group_name, app_collection, app_name, kind, skip = nil, top = nil, filter = nil, orderby = nil, search = nil, custom_headers = nil)
  list_async(resource_group_name, app_collection, app_name, kind, skip, top, filter, orderby, search, custom_headers).value!
end

#push(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = nil) ⇒ CampaignPushResult

Push a previously saved campaign (created with Create campaign) to a set of devices.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ Campaign operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • parameters (CampaignPushParameters)

    Parameters supplied to the Push

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

    A hash of custom headers that

Returns:

  • (CampaignPushResult)

    operation results.



1214
1215
1216
1217
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1214

def push(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = nil)
  response = push_async(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers).value!
  response.body unless response.nil?
end

#push_async(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Push a previously saved campaign (created with Create campaign) to a set of devices.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ Campaign operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • parameters (CampaignPushParameters)

    Parameters supplied to the Push

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1257

def push_async(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = 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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'id is nil' if id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignPushParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/push'

  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,'appCollection' => app_collection,'appName' => app_name,'kind' => kind,'id' => id},
      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(:post, 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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignPushResult.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

#push_with_http_info(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Push a previously saved campaign (created with Create campaign) to a set of devices.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ Campaign operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • parameters (CampaignPushParameters)

    Parameters supplied to the Push

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1236
1237
1238
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1236

def push_with_http_info(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = nil)
  push_async(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers).value!
end

#suspend(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil) ⇒ CampaignStateResult

Suspend a push campaign previously activated by a call to Activate campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

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

    A hash of custom headers that

Returns:

  • (CampaignStateResult)

    operation results.



1105
1106
1107
1108
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1105

def suspend(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil)
  response = suspend_async(resource_group_name, app_collection, app_name, kind, id, custom_headers).value!
  response.body unless response.nil?
end

#suspend_async(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil) ⇒ Concurrent::Promise

Suspend a push campaign previously activated by a call to Activate campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1142

def suspend_async(resource_group_name, app_collection, app_name, kind, id, custom_headers = 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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'id is nil' if id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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 = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/suspend'

  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,'appCollection' => app_collection,'appName' => app_name,'kind' => kind,'id' => id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, 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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignStateResult.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

#suspend_with_http_info(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Suspend a push campaign previously activated by a call to Activate campaign.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1124
1125
1126
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 1124

def suspend_with_http_info(resource_group_name, app_collection, app_name, kind, id, custom_headers = nil)
  suspend_async(resource_group_name, app_collection, app_name, kind, id, custom_headers).value!
end

#test_new(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = nil) ⇒ CampaignState

Test a new campaign on a set of devices.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ Campaign operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • parameters (CampaignTestNewParameters)

    Parameters supplied to the Test

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

    A hash of custom headers that

Returns:

  • (CampaignState)

    operation results.



882
883
884
885
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 882

def test_new(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = nil)
  response = test_new_async(resource_group_name, app_collection, app_name, kind, parameters, custom_headers).value!
  response.body unless response.nil?
end

#test_new_async(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Test a new campaign on a set of devices.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ Campaign operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • parameters (CampaignTestNewParameters)

    Parameters supplied to the Test

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 921

def test_new_async(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = 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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignTestNewParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/test'

  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,'appCollection' => app_collection,'appName' => app_name,'kind' => kind},
      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(:post, 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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignState.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

#test_new_with_http_info(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Test a new campaign on a set of devices.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ Campaign operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • parameters (CampaignTestNewParameters)

    Parameters supplied to the Test

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



902
903
904
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 902

def test_new_with_http_info(resource_group_name, app_collection, app_name, kind, parameters, custom_headers = nil)
  test_new_async(resource_group_name, app_collection, app_name, kind, parameters, custom_headers).value!
end

#test_saved(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = nil) ⇒ CampaignStateResult

Test an existing campaign (created with Create campaign) on a set of devices.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ Test Campaign operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • parameters (CampaignTestSavedParameters)

    Parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (CampaignStateResult)

    operation results.



761
762
763
764
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 761

def test_saved(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = nil)
  response = test_saved_async(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers).value!
  response.body unless response.nil?
end

#test_saved_async(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Test an existing campaign (created with Create campaign) on a set of devices.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ Test Campaign operation. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • parameters (CampaignTestSavedParameters)

    Parameters supplied to the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 802

def test_saved_async(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = 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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'id is nil' if id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignTestSavedParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}/test'

  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,'appCollection' => app_collection,'appName' => app_name,'kind' => kind,'id' => id},
      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(:post, 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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignStateResult.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

#test_saved_with_http_info(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Test an existing campaign (created with Create campaign) on a set of devices.

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ Test Campaign operation. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • parameters (CampaignTestSavedParameters)

    Parameters supplied to the

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



782
783
784
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 782

def test_saved_with_http_info(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers = nil)
  test_saved_async(resource_group_name, app_collection, app_name, kind, id, parameters, custom_headers).value!
end

#update(kind, id, parameters, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ CampaignStateResult

Update an existing push campaign (announcement, poll, data push or native push).

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ operation. will be added to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • parameters (Campaign)

    Parameters supplied to the Update Campaign

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

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

    A hash of custom headers that

Returns:

  • (CampaignStateResult)

    operation results.



433
434
435
436
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 433

def update(kind, id, parameters, resource_group_name, app_collection, app_name, custom_headers = nil)
  response = update_async(kind, id, parameters, resource_group_name, app_collection, app_name, custom_headers).value!
  response.body unless response.nil?
end

#update_async(kind, id, parameters, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ Concurrent::Promise

Update an existing push campaign (announcement, poll, data push or native push).

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ operation. to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • parameters (Campaign)

    Parameters supplied to the Update Campaign

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 476

def update_async(kind, id, parameters, resource_group_name, app_collection, app_name, custom_headers = nil)
  fail ArgumentError, 'kind is nil' if kind.nil?
  fail ArgumentError, 'id is nil' if id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.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, 'app_collection is nil' if app_collection.nil?
  fail ArgumentError, 'app_name is nil' if app_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = Azure::MobileEngagement::Mgmt::V2014_12_01::Models::Campaign.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MobileEngagement/appcollections/{appCollection}/apps/{appName}/campaigns/{kind}/{id}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'kind' => kind,'id' => id,'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'appCollection' => app_collection,'appName' => app_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
      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::MobileEngagement::Mgmt::V2014_12_01::Models::CampaignStateResult.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(kind, id, parameters, resource_group_name, app_collection, app_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Update an existing push campaign (announcement, poll, data push or native push).

‘announcements’, ‘polls’, ‘dataPushes’, ‘nativePushes’ operation. will be added to the HTTP request.

Parameters:

  • kind (CampaignKinds)

    Campaign kind. Possible values include:

  • id (Integer)

    Campaign identifier.

  • parameters (Campaign)

    Parameters supplied to the Update Campaign

  • resource_group_name (String)

    The name of the resource group.

  • app_collection (String)

    Application collection.

  • app_name (String)

    Application resource name.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



455
456
457
# File 'lib/2014-12-01/generated/azure_mgmt_mobile_engagement/campaigns.rb', line 455

def update_with_http_info(kind, id, parameters, resource_group_name, app_collection, app_name, custom_headers = nil)
  update_async(kind, id, parameters, resource_group_name, app_collection, app_name, custom_headers).value!
end