azure_mgmt_bot_service 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service.rb +82 -0
  4. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/azure_bot_service.rb +144 -0
  5. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/bot_connection.rb +936 -0
  6. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/bots.rb +1000 -0
  7. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/channels.rb +872 -0
  8. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/bot.rb +123 -0
  9. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/bot_channel.rb +126 -0
  10. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/bot_properties.rb +207 -0
  11. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/bot_response_list.rb +101 -0
  12. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/channel.rb +55 -0
  13. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/channel_name.rb +24 -0
  14. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/channel_response_list.rb +101 -0
  15. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/check_name_availability_request_body.rb +60 -0
  16. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/check_name_availability_response_body.rb +59 -0
  17. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/connection_item_name.rb +47 -0
  18. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/connection_setting.rb +124 -0
  19. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/connection_setting_parameter.rb +59 -0
  20. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/connection_setting_properties.rb +126 -0
  21. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/connection_setting_response_list.rb +101 -0
  22. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/direct_line_channel.rb +63 -0
  23. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/direct_line_channel_properties.rb +55 -0
  24. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/direct_line_site.rb +119 -0
  25. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/email_channel.rb +63 -0
  26. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/email_channel_properties.rb +69 -0
  27. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/error.rb +47 -0
  28. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/error_body.rb +57 -0
  29. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/facebook_channel.rb +63 -0
  30. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/facebook_channel_properties.rb +114 -0
  31. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/facebook_page.rb +58 -0
  32. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/kik_channel.rb +63 -0
  33. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/kik_channel_properties.rb +80 -0
  34. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/kind.rb +18 -0
  35. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/ms_teams_channel.rb +63 -0
  36. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/ms_teams_channel_properties.rb +101 -0
  37. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/operation_display_info.rb +80 -0
  38. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/operation_entity.rb +81 -0
  39. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/operation_entity_list_result.rb +98 -0
  40. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/resource.rb +146 -0
  41. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/service_provider.rb +48 -0
  42. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/service_provider_parameter.rb +107 -0
  43. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/service_provider_properties.rb +116 -0
  44. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/service_provider_response_list.rb +69 -0
  45. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/sku.rb +59 -0
  46. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/sku_name.rb +16 -0
  47. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/sku_tier.rb +16 -0
  48. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/skype_channel.rb +63 -0
  49. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/skype_channel_properties.rb +134 -0
  50. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/slack_channel.rb +63 -0
  51. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/slack_channel_properties.rb +141 -0
  52. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/sms_channel.rb +63 -0
  53. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/sms_channel_properties.rb +92 -0
  54. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/telegram_channel.rb +63 -0
  55. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/telegram_channel_properties.rb +69 -0
  56. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/web_chat_channel.rb +63 -0
  57. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/web_chat_channel_properties.rb +67 -0
  58. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/models/web_chat_site.rb +107 -0
  59. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/module_definition.rb +9 -0
  60. data/lib/2017-12-01-preview/generated/azure_mgmt_bot_service/operations.rb +219 -0
  61. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service.rb +91 -0
  62. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/azure_bot_service.rb +147 -0
  63. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/bot_connection.rb +936 -0
  64. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/bots.rb +1000 -0
  65. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/channels.rb +872 -0
  66. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/enterprise_channels.rb +962 -0
  67. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/bot.rb +123 -0
  68. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/bot_channel.rb +126 -0
  69. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/bot_properties.rb +207 -0
  70. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/bot_response_list.rb +101 -0
  71. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/channel.rb +55 -0
  72. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/channel_name.rb +24 -0
  73. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/channel_response_list.rb +101 -0
  74. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/check_name_availability_request_body.rb +60 -0
  75. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/check_name_availability_response_body.rb +59 -0
  76. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/connection_item_name.rb +47 -0
  77. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/connection_setting.rb +124 -0
  78. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/connection_setting_parameter.rb +59 -0
  79. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/connection_setting_properties.rb +126 -0
  80. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/connection_setting_response_list.rb +101 -0
  81. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/direct_line_channel.rb +63 -0
  82. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/direct_line_channel_properties.rb +55 -0
  83. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/direct_line_site.rb +151 -0
  84. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/email_channel.rb +63 -0
  85. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/email_channel_properties.rb +69 -0
  86. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/enterprise_channel.rb +124 -0
  87. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/enterprise_channel_check_name_availability_request.rb +49 -0
  88. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/enterprise_channel_check_name_availability_response.rb +60 -0
  89. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/enterprise_channel_node.rb +95 -0
  90. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/enterprise_channel_node_state.rb +24 -0
  91. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/enterprise_channel_properties.rb +70 -0
  92. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/enterprise_channel_response_list.rb +101 -0
  93. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/enterprise_channel_state.rb +24 -0
  94. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/error.rb +47 -0
  95. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/error_body.rb +57 -0
  96. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/facebook_channel.rb +63 -0
  97. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/facebook_channel_properties.rb +114 -0
  98. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/facebook_page.rb +58 -0
  99. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/kik_channel.rb +63 -0
  100. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/kik_channel_properties.rb +80 -0
  101. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/kind.rb +18 -0
  102. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/ms_teams_channel.rb +63 -0
  103. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/ms_teams_channel_properties.rb +68 -0
  104. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/operation_display_info.rb +80 -0
  105. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/operation_entity.rb +81 -0
  106. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/operation_entity_list_result.rb +98 -0
  107. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/resource.rb +146 -0
  108. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/service_provider.rb +48 -0
  109. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/service_provider_parameter.rb +107 -0
  110. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/service_provider_properties.rb +116 -0
  111. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/service_provider_response_list.rb +69 -0
  112. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/sku.rb +59 -0
  113. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/sku_name.rb +16 -0
  114. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/sku_tier.rb +16 -0
  115. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/skype_channel.rb +63 -0
  116. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/skype_channel_properties.rb +134 -0
  117. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/slack_channel.rb +63 -0
  118. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/slack_channel_properties.rb +141 -0
  119. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/sms_channel.rb +63 -0
  120. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/sms_channel_properties.rb +92 -0
  121. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/telegram_channel.rb +63 -0
  122. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/telegram_channel_properties.rb +69 -0
  123. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/web_chat_channel.rb +63 -0
  124. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/web_chat_channel_properties.rb +67 -0
  125. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/models/web_chat_site.rb +107 -0
  126. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/module_definition.rb +9 -0
  127. data/lib/2018-07-12-preview/generated/azure_mgmt_bot_service/operations.rb +219 -0
  128. data/lib/azure_mgmt_bot_service.rb +7 -0
  129. data/lib/module_definition.rb +7 -0
  130. data/lib/profiles/latest/botservice_latest_profile_client.rb +40 -0
  131. data/lib/profiles/latest/botservice_module_definition.rb +8 -0
  132. data/lib/profiles/latest/modules/botservice_profile_module.rb +305 -0
  133. data/lib/version.rb +7 -0
  134. metadata +249 -0
@@ -0,0 +1,872 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::BotService::Mgmt::V2018_07_12_preview
7
+ #
8
+ # Azure Bot Service is a platform for creating smart conversational agents.
9
+ #
10
+ class Channels
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Channels class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [AzureBotService] reference to the AzureBotService
22
+ attr_reader :client
23
+
24
+ #
25
+ # Creates a Channel registration for a Bot Service
26
+ #
27
+ # @param resource_group_name [String] The name of the Bot resource group in the
28
+ # user subscription.
29
+ # @param resource_name [String] The name of the Bot resource.
30
+ # @param channel_name [ChannelName] The name of the Channel resource. Possible
31
+ # values include: 'FacebookChannel', 'EmailChannel', 'KikChannel',
32
+ # 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel',
33
+ # 'WebChatChannel', 'DirectLineChannel', 'SmsChannel'
34
+ # @param parameters [BotChannel] The parameters to provide for the created bot.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [BotChannel] operation results.
39
+ #
40
+ def create(resource_group_name, resource_name, channel_name, parameters, custom_headers:nil)
41
+ response = create_async(resource_group_name, resource_name, channel_name, parameters, custom_headers:custom_headers).value!
42
+ response.body unless response.nil?
43
+ end
44
+
45
+ #
46
+ # Creates a Channel registration for a Bot Service
47
+ #
48
+ # @param resource_group_name [String] The name of the Bot resource group in the
49
+ # user subscription.
50
+ # @param resource_name [String] The name of the Bot resource.
51
+ # @param channel_name [ChannelName] The name of the Channel resource. Possible
52
+ # values include: 'FacebookChannel', 'EmailChannel', 'KikChannel',
53
+ # 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel',
54
+ # 'WebChatChannel', 'DirectLineChannel', 'SmsChannel'
55
+ # @param parameters [BotChannel] The parameters to provide for the created bot.
56
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
57
+ # will be added to the HTTP request.
58
+ #
59
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
60
+ #
61
+ def create_with_http_info(resource_group_name, resource_name, channel_name, parameters, custom_headers:nil)
62
+ create_async(resource_group_name, resource_name, channel_name, parameters, custom_headers:custom_headers).value!
63
+ end
64
+
65
+ #
66
+ # Creates a Channel registration for a Bot Service
67
+ #
68
+ # @param resource_group_name [String] The name of the Bot resource group in the
69
+ # user subscription.
70
+ # @param resource_name [String] The name of the Bot resource.
71
+ # @param channel_name [ChannelName] The name of the Channel resource. Possible
72
+ # values include: 'FacebookChannel', 'EmailChannel', 'KikChannel',
73
+ # 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel',
74
+ # 'WebChatChannel', 'DirectLineChannel', 'SmsChannel'
75
+ # @param parameters [BotChannel] The parameters to provide for the created bot.
76
+ # @param [Hash{String => String}] A hash of custom headers that will be added
77
+ # to the HTTP request.
78
+ #
79
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
80
+ #
81
+ def create_async(resource_group_name, resource_name, channel_name, parameters, custom_headers:nil)
82
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
83
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
84
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
85
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
86
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
87
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_name.nil? && resource_name.length > 64
88
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MinLength': '2'" if !resource_name.nil? && resource_name.length < 2
89
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_name.nil? && resource_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
90
+ fail ArgumentError, 'channel_name is nil' if channel_name.nil?
91
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
92
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
93
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
94
+
95
+
96
+ request_headers = {}
97
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
98
+
99
+ # Set Headers
100
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
101
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
102
+
103
+ # Serialize Request
104
+ request_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::BotChannel.mapper()
105
+ request_content = @client.serialize(request_mapper, parameters)
106
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
107
+
108
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'
109
+
110
+ request_url = @base_url || @client.base_url
111
+
112
+ options = {
113
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
114
+ path_params: {'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'channelName' => channel_name,'subscriptionId' => @client.subscription_id},
115
+ query_params: {'api-version' => @client.api_version},
116
+ body: request_content,
117
+ headers: request_headers.merge(custom_headers || {}),
118
+ base_url: request_url
119
+ }
120
+ promise = @client.make_request_async(:put, path_template, options)
121
+
122
+ promise = promise.then do |result|
123
+ http_response = result.response
124
+ status_code = http_response.status
125
+ response_content = http_response.body
126
+ unless status_code == 200 || status_code == 201
127
+ error_model = JSON.load(response_content)
128
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
129
+ end
130
+
131
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
132
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
133
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
134
+ # Deserialize Response
135
+ if status_code == 200
136
+ begin
137
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
138
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::BotChannel.mapper()
139
+ result.body = @client.deserialize(result_mapper, parsed_response)
140
+ rescue Exception => e
141
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
142
+ end
143
+ end
144
+ # Deserialize Response
145
+ if status_code == 201
146
+ begin
147
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
148
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::BotChannel.mapper()
149
+ result.body = @client.deserialize(result_mapper, parsed_response)
150
+ rescue Exception => e
151
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
152
+ end
153
+ end
154
+
155
+ result
156
+ end
157
+
158
+ promise.execute
159
+ end
160
+
161
+ #
162
+ # Updates a Channel registration for a Bot Service
163
+ #
164
+ # @param resource_group_name [String] The name of the Bot resource group in the
165
+ # user subscription.
166
+ # @param resource_name [String] The name of the Bot resource.
167
+ # @param channel_name [ChannelName] The name of the Channel resource. Possible
168
+ # values include: 'FacebookChannel', 'EmailChannel', 'KikChannel',
169
+ # 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel',
170
+ # 'WebChatChannel', 'DirectLineChannel', 'SmsChannel'
171
+ # @param location [String] Specifies the location of the resource.
172
+ # @param tags [Hash{String => String}] Contains resource tags defined as
173
+ # key/value pairs.
174
+ # @param sku [Sku] Gets or sets the SKU of the resource.
175
+ # @param kind [Kind] Required. Gets or sets the Kind of the resource. Possible
176
+ # values include: 'sdk', 'designer', 'bot', 'function'
177
+ # @param etag [String] Entity Tag
178
+ # @param properties [Channel] The set of properties specific to bot channel
179
+ # resource
180
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
181
+ # will be added to the HTTP request.
182
+ #
183
+ # @return [BotChannel] operation results.
184
+ #
185
+ def update(resource_group_name, resource_name, channel_name, location:nil, tags:nil, sku:nil, kind:nil, etag:nil, properties:nil, custom_headers:nil)
186
+ response = update_async(resource_group_name, resource_name, channel_name, location:location, tags:tags, sku:sku, kind:kind, etag:etag, properties:properties, custom_headers:custom_headers).value!
187
+ response.body unless response.nil?
188
+ end
189
+
190
+ #
191
+ # Updates a Channel registration for a Bot Service
192
+ #
193
+ # @param resource_group_name [String] The name of the Bot resource group in the
194
+ # user subscription.
195
+ # @param resource_name [String] The name of the Bot resource.
196
+ # @param channel_name [ChannelName] The name of the Channel resource. Possible
197
+ # values include: 'FacebookChannel', 'EmailChannel', 'KikChannel',
198
+ # 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel',
199
+ # 'WebChatChannel', 'DirectLineChannel', 'SmsChannel'
200
+ # @param location [String] Specifies the location of the resource.
201
+ # @param tags [Hash{String => String}] Contains resource tags defined as
202
+ # key/value pairs.
203
+ # @param sku [Sku] Gets or sets the SKU of the resource.
204
+ # @param kind [Kind] Required. Gets or sets the Kind of the resource. Possible
205
+ # values include: 'sdk', 'designer', 'bot', 'function'
206
+ # @param etag [String] Entity Tag
207
+ # @param properties [Channel] The set of properties specific to bot channel
208
+ # resource
209
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
210
+ # will be added to the HTTP request.
211
+ #
212
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
213
+ #
214
+ def update_with_http_info(resource_group_name, resource_name, channel_name, location:nil, tags:nil, sku:nil, kind:nil, etag:nil, properties:nil, custom_headers:nil)
215
+ update_async(resource_group_name, resource_name, channel_name, location:location, tags:tags, sku:sku, kind:kind, etag:etag, properties:properties, custom_headers:custom_headers).value!
216
+ end
217
+
218
+ #
219
+ # Updates a Channel registration for a Bot Service
220
+ #
221
+ # @param resource_group_name [String] The name of the Bot resource group in the
222
+ # user subscription.
223
+ # @param resource_name [String] The name of the Bot resource.
224
+ # @param channel_name [ChannelName] The name of the Channel resource. Possible
225
+ # values include: 'FacebookChannel', 'EmailChannel', 'KikChannel',
226
+ # 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel',
227
+ # 'WebChatChannel', 'DirectLineChannel', 'SmsChannel'
228
+ # @param location [String] Specifies the location of the resource.
229
+ # @param tags [Hash{String => String}] Contains resource tags defined as
230
+ # key/value pairs.
231
+ # @param sku [Sku] Gets or sets the SKU of the resource.
232
+ # @param kind [Kind] Required. Gets or sets the Kind of the resource. Possible
233
+ # values include: 'sdk', 'designer', 'bot', 'function'
234
+ # @param etag [String] Entity Tag
235
+ # @param properties [Channel] The set of properties specific to bot channel
236
+ # resource
237
+ # @param [Hash{String => String}] A hash of custom headers that will be added
238
+ # to the HTTP request.
239
+ #
240
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
241
+ #
242
+ def update_async(resource_group_name, resource_name, channel_name, location:nil, tags:nil, sku:nil, kind:nil, etag:nil, properties:nil, custom_headers:nil)
243
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
244
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
245
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
246
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
247
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
248
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_name.nil? && resource_name.length > 64
249
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MinLength': '2'" if !resource_name.nil? && resource_name.length < 2
250
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_name.nil? && resource_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
251
+ fail ArgumentError, 'channel_name is nil' if channel_name.nil?
252
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
253
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
254
+
255
+ parameters = BotChannel.new
256
+ unless location.nil? && tags.nil? && sku.nil? && kind.nil? && etag.nil? && properties.nil?
257
+ parameters.location = location
258
+ parameters.tags = tags
259
+ parameters.sku = sku
260
+ parameters.kind = kind
261
+ parameters.etag = etag
262
+ parameters.properties = properties
263
+ end
264
+
265
+ request_headers = {}
266
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
267
+
268
+ # Set Headers
269
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
270
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
271
+
272
+ # Serialize Request
273
+ request_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::BotChannel.mapper()
274
+ request_content = @client.serialize(request_mapper, parameters)
275
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
276
+
277
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'
278
+
279
+ request_url = @base_url || @client.base_url
280
+
281
+ options = {
282
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
283
+ path_params: {'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'channelName' => channel_name,'subscriptionId' => @client.subscription_id},
284
+ query_params: {'api-version' => @client.api_version},
285
+ body: request_content,
286
+ headers: request_headers.merge(custom_headers || {}),
287
+ base_url: request_url
288
+ }
289
+ promise = @client.make_request_async(:patch, path_template, options)
290
+
291
+ promise = promise.then do |result|
292
+ http_response = result.response
293
+ status_code = http_response.status
294
+ response_content = http_response.body
295
+ unless status_code == 200 || status_code == 201
296
+ error_model = JSON.load(response_content)
297
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
298
+ end
299
+
300
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
301
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
302
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
303
+ # Deserialize Response
304
+ if status_code == 200
305
+ begin
306
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
307
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::BotChannel.mapper()
308
+ result.body = @client.deserialize(result_mapper, parsed_response)
309
+ rescue Exception => e
310
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
311
+ end
312
+ end
313
+ # Deserialize Response
314
+ if status_code == 201
315
+ begin
316
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
317
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::BotChannel.mapper()
318
+ result.body = @client.deserialize(result_mapper, parsed_response)
319
+ rescue Exception => e
320
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
321
+ end
322
+ end
323
+
324
+ result
325
+ end
326
+
327
+ promise.execute
328
+ end
329
+
330
+ #
331
+ # Deletes a Channel registration from a Bot Service
332
+ #
333
+ # @param resource_group_name [String] The name of the Bot resource group in the
334
+ # user subscription.
335
+ # @param resource_name [String] The name of the Bot resource.
336
+ # @param channel_name [String] The name of the Bot resource.
337
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
338
+ # will be added to the HTTP request.
339
+ #
340
+ #
341
+ def delete(resource_group_name, resource_name, channel_name, custom_headers:nil)
342
+ response = delete_async(resource_group_name, resource_name, channel_name, custom_headers:custom_headers).value!
343
+ nil
344
+ end
345
+
346
+ #
347
+ # Deletes a Channel registration from a Bot Service
348
+ #
349
+ # @param resource_group_name [String] The name of the Bot resource group in the
350
+ # user subscription.
351
+ # @param resource_name [String] The name of the Bot resource.
352
+ # @param channel_name [String] The name of the Bot resource.
353
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
354
+ # will be added to the HTTP request.
355
+ #
356
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
357
+ #
358
+ def delete_with_http_info(resource_group_name, resource_name, channel_name, custom_headers:nil)
359
+ delete_async(resource_group_name, resource_name, channel_name, custom_headers:custom_headers).value!
360
+ end
361
+
362
+ #
363
+ # Deletes a Channel registration from a Bot Service
364
+ #
365
+ # @param resource_group_name [String] The name of the Bot resource group in the
366
+ # user subscription.
367
+ # @param resource_name [String] The name of the Bot resource.
368
+ # @param channel_name [String] The name of the Bot resource.
369
+ # @param [Hash{String => String}] A hash of custom headers that will be added
370
+ # to the HTTP request.
371
+ #
372
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
373
+ #
374
+ def delete_async(resource_group_name, resource_name, channel_name, custom_headers:nil)
375
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
376
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
377
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
378
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
379
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
380
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_name.nil? && resource_name.length > 64
381
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MinLength': '2'" if !resource_name.nil? && resource_name.length < 2
382
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_name.nil? && resource_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
383
+ fail ArgumentError, 'channel_name is nil' if channel_name.nil?
384
+ fail ArgumentError, "'channel_name' should satisfy the constraint - 'MaxLength': '64'" if !channel_name.nil? && channel_name.length > 64
385
+ fail ArgumentError, "'channel_name' should satisfy the constraint - 'MinLength': '2'" if !channel_name.nil? && channel_name.length < 2
386
+ fail ArgumentError, "'channel_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !channel_name.nil? && channel_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
387
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
388
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
389
+
390
+
391
+ request_headers = {}
392
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
393
+
394
+ # Set Headers
395
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
396
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
397
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'
398
+
399
+ request_url = @base_url || @client.base_url
400
+
401
+ options = {
402
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
403
+ path_params: {'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'channelName' => channel_name,'subscriptionId' => @client.subscription_id},
404
+ query_params: {'api-version' => @client.api_version},
405
+ headers: request_headers.merge(custom_headers || {}),
406
+ base_url: request_url
407
+ }
408
+ promise = @client.make_request_async(:delete, path_template, options)
409
+
410
+ promise = promise.then do |result|
411
+ http_response = result.response
412
+ status_code = http_response.status
413
+ response_content = http_response.body
414
+ unless status_code == 200 || status_code == 204
415
+ error_model = JSON.load(response_content)
416
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
417
+ end
418
+
419
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
420
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
421
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
422
+
423
+ result
424
+ end
425
+
426
+ promise.execute
427
+ end
428
+
429
+ #
430
+ # Returns a BotService Channel registration specified by the parameters.
431
+ #
432
+ # @param resource_group_name [String] The name of the Bot resource group in the
433
+ # user subscription.
434
+ # @param resource_name [String] The name of the Bot resource.
435
+ # @param channel_name [String] The name of the Bot resource.
436
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
437
+ # will be added to the HTTP request.
438
+ #
439
+ # @return [BotChannel] operation results.
440
+ #
441
+ def get(resource_group_name, resource_name, channel_name, custom_headers:nil)
442
+ response = get_async(resource_group_name, resource_name, channel_name, custom_headers:custom_headers).value!
443
+ response.body unless response.nil?
444
+ end
445
+
446
+ #
447
+ # Returns a BotService Channel registration specified by the parameters.
448
+ #
449
+ # @param resource_group_name [String] The name of the Bot resource group in the
450
+ # user subscription.
451
+ # @param resource_name [String] The name of the Bot resource.
452
+ # @param channel_name [String] The name of the Bot resource.
453
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
454
+ # will be added to the HTTP request.
455
+ #
456
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
457
+ #
458
+ def get_with_http_info(resource_group_name, resource_name, channel_name, custom_headers:nil)
459
+ get_async(resource_group_name, resource_name, channel_name, custom_headers:custom_headers).value!
460
+ end
461
+
462
+ #
463
+ # Returns a BotService Channel registration specified by the parameters.
464
+ #
465
+ # @param resource_group_name [String] The name of the Bot resource group in the
466
+ # user subscription.
467
+ # @param resource_name [String] The name of the Bot resource.
468
+ # @param channel_name [String] The name of the Bot resource.
469
+ # @param [Hash{String => String}] A hash of custom headers that will be added
470
+ # to the HTTP request.
471
+ #
472
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
473
+ #
474
+ def get_async(resource_group_name, resource_name, channel_name, custom_headers:nil)
475
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
476
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
477
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
478
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
479
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
480
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_name.nil? && resource_name.length > 64
481
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MinLength': '2'" if !resource_name.nil? && resource_name.length < 2
482
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_name.nil? && resource_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
483
+ fail ArgumentError, 'channel_name is nil' if channel_name.nil?
484
+ fail ArgumentError, "'channel_name' should satisfy the constraint - 'MaxLength': '64'" if !channel_name.nil? && channel_name.length > 64
485
+ fail ArgumentError, "'channel_name' should satisfy the constraint - 'MinLength': '2'" if !channel_name.nil? && channel_name.length < 2
486
+ fail ArgumentError, "'channel_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !channel_name.nil? && channel_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
487
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
488
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
489
+
490
+
491
+ request_headers = {}
492
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
493
+
494
+ # Set Headers
495
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
496
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
497
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}'
498
+
499
+ request_url = @base_url || @client.base_url
500
+
501
+ options = {
502
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
503
+ path_params: {'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'channelName' => channel_name,'subscriptionId' => @client.subscription_id},
504
+ query_params: {'api-version' => @client.api_version},
505
+ headers: request_headers.merge(custom_headers || {}),
506
+ base_url: request_url
507
+ }
508
+ promise = @client.make_request_async(:get, path_template, options)
509
+
510
+ promise = promise.then do |result|
511
+ http_response = result.response
512
+ status_code = http_response.status
513
+ response_content = http_response.body
514
+ unless status_code == 200
515
+ error_model = JSON.load(response_content)
516
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
517
+ end
518
+
519
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
520
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
521
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
522
+ # Deserialize Response
523
+ if status_code == 200
524
+ begin
525
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
526
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::BotChannel.mapper()
527
+ result.body = @client.deserialize(result_mapper, parsed_response)
528
+ rescue Exception => e
529
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
530
+ end
531
+ end
532
+
533
+ result
534
+ end
535
+
536
+ promise.execute
537
+ end
538
+
539
+ #
540
+ # Lists a Channel registration for a Bot Service including secrets
541
+ #
542
+ # @param resource_group_name [String] The name of the Bot resource group in the
543
+ # user subscription.
544
+ # @param resource_name [String] The name of the Bot resource.
545
+ # @param channel_name [ChannelName] The name of the Channel resource. Possible
546
+ # values include: 'FacebookChannel', 'EmailChannel', 'KikChannel',
547
+ # 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel',
548
+ # 'WebChatChannel', 'DirectLineChannel', 'SmsChannel'
549
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
550
+ # will be added to the HTTP request.
551
+ #
552
+ # @return [BotChannel] operation results.
553
+ #
554
+ def list_with_keys(resource_group_name, resource_name, channel_name, custom_headers:nil)
555
+ response = list_with_keys_async(resource_group_name, resource_name, channel_name, custom_headers:custom_headers).value!
556
+ response.body unless response.nil?
557
+ end
558
+
559
+ #
560
+ # Lists a Channel registration for a Bot Service including secrets
561
+ #
562
+ # @param resource_group_name [String] The name of the Bot resource group in the
563
+ # user subscription.
564
+ # @param resource_name [String] The name of the Bot resource.
565
+ # @param channel_name [ChannelName] The name of the Channel resource. Possible
566
+ # values include: 'FacebookChannel', 'EmailChannel', 'KikChannel',
567
+ # 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel',
568
+ # 'WebChatChannel', 'DirectLineChannel', 'SmsChannel'
569
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
570
+ # will be added to the HTTP request.
571
+ #
572
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
573
+ #
574
+ def list_with_keys_with_http_info(resource_group_name, resource_name, channel_name, custom_headers:nil)
575
+ list_with_keys_async(resource_group_name, resource_name, channel_name, custom_headers:custom_headers).value!
576
+ end
577
+
578
+ #
579
+ # Lists a Channel registration for a Bot Service including secrets
580
+ #
581
+ # @param resource_group_name [String] The name of the Bot resource group in the
582
+ # user subscription.
583
+ # @param resource_name [String] The name of the Bot resource.
584
+ # @param channel_name [ChannelName] The name of the Channel resource. Possible
585
+ # values include: 'FacebookChannel', 'EmailChannel', 'KikChannel',
586
+ # 'TelegramChannel', 'SlackChannel', 'MsTeamsChannel', 'SkypeChannel',
587
+ # 'WebChatChannel', 'DirectLineChannel', 'SmsChannel'
588
+ # @param [Hash{String => String}] A hash of custom headers that will be added
589
+ # to the HTTP request.
590
+ #
591
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
592
+ #
593
+ def list_with_keys_async(resource_group_name, resource_name, channel_name, custom_headers:nil)
594
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
595
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
596
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
597
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
598
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
599
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_name.nil? && resource_name.length > 64
600
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MinLength': '2'" if !resource_name.nil? && resource_name.length < 2
601
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_name.nil? && resource_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
602
+ fail ArgumentError, 'channel_name is nil' if channel_name.nil?
603
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
604
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
605
+
606
+
607
+ request_headers = {}
608
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
609
+
610
+ # Set Headers
611
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
612
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
613
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys'
614
+
615
+ request_url = @base_url || @client.base_url
616
+
617
+ options = {
618
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
619
+ path_params: {'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'channelName' => channel_name,'subscriptionId' => @client.subscription_id},
620
+ query_params: {'api-version' => @client.api_version},
621
+ headers: request_headers.merge(custom_headers || {}),
622
+ base_url: request_url
623
+ }
624
+ promise = @client.make_request_async(:post, path_template, options)
625
+
626
+ promise = promise.then do |result|
627
+ http_response = result.response
628
+ status_code = http_response.status
629
+ response_content = http_response.body
630
+ unless status_code == 200
631
+ error_model = JSON.load(response_content)
632
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
633
+ end
634
+
635
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
636
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
637
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
638
+ # Deserialize Response
639
+ if status_code == 200
640
+ begin
641
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
642
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::BotChannel.mapper()
643
+ result.body = @client.deserialize(result_mapper, parsed_response)
644
+ rescue Exception => e
645
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
646
+ end
647
+ end
648
+
649
+ result
650
+ end
651
+
652
+ promise.execute
653
+ end
654
+
655
+ #
656
+ # Returns all the Channel registrations of a particular BotService resource
657
+ #
658
+ # @param resource_group_name [String] The name of the Bot resource group in the
659
+ # user subscription.
660
+ # @param resource_name [String] The name of the Bot resource.
661
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
662
+ # will be added to the HTTP request.
663
+ #
664
+ # @return [Array<BotChannel>] operation results.
665
+ #
666
+ def list_by_resource_group(resource_group_name, resource_name, custom_headers:nil)
667
+ first_page = list_by_resource_group_as_lazy(resource_group_name, resource_name, custom_headers:custom_headers)
668
+ first_page.get_all_items
669
+ end
670
+
671
+ #
672
+ # Returns all the Channel registrations of a particular BotService resource
673
+ #
674
+ # @param resource_group_name [String] The name of the Bot resource group in the
675
+ # user subscription.
676
+ # @param resource_name [String] The name of the Bot resource.
677
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
678
+ # will be added to the HTTP request.
679
+ #
680
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
681
+ #
682
+ def list_by_resource_group_with_http_info(resource_group_name, resource_name, custom_headers:nil)
683
+ list_by_resource_group_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
684
+ end
685
+
686
+ #
687
+ # Returns all the Channel registrations of a particular BotService resource
688
+ #
689
+ # @param resource_group_name [String] The name of the Bot resource group in the
690
+ # user subscription.
691
+ # @param resource_name [String] The name of the Bot resource.
692
+ # @param [Hash{String => String}] A hash of custom headers that will be added
693
+ # to the HTTP request.
694
+ #
695
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
696
+ #
697
+ def list_by_resource_group_async(resource_group_name, resource_name, custom_headers:nil)
698
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
699
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
700
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
701
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
702
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
703
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_name.nil? && resource_name.length > 64
704
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MinLength': '2'" if !resource_name.nil? && resource_name.length < 2
705
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !resource_name.nil? && resource_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
706
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
707
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
708
+
709
+
710
+ request_headers = {}
711
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
712
+
713
+ # Set Headers
714
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
715
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
716
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels'
717
+
718
+ request_url = @base_url || @client.base_url
719
+
720
+ options = {
721
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
722
+ path_params: {'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
723
+ query_params: {'api-version' => @client.api_version},
724
+ headers: request_headers.merge(custom_headers || {}),
725
+ base_url: request_url
726
+ }
727
+ promise = @client.make_request_async(:get, path_template, options)
728
+
729
+ promise = promise.then do |result|
730
+ http_response = result.response
731
+ status_code = http_response.status
732
+ response_content = http_response.body
733
+ unless status_code == 200
734
+ error_model = JSON.load(response_content)
735
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
736
+ end
737
+
738
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
739
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
740
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
741
+ # Deserialize Response
742
+ if status_code == 200
743
+ begin
744
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
745
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::ChannelResponseList.mapper()
746
+ result.body = @client.deserialize(result_mapper, parsed_response)
747
+ rescue Exception => e
748
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
749
+ end
750
+ end
751
+
752
+ result
753
+ end
754
+
755
+ promise.execute
756
+ end
757
+
758
+ #
759
+ # Returns all the Channel registrations of a particular BotService resource
760
+ #
761
+ # @param next_page_link [String] The NextLink from the previous successful call
762
+ # to List operation.
763
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
764
+ # will be added to the HTTP request.
765
+ #
766
+ # @return [ChannelResponseList] operation results.
767
+ #
768
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
769
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
770
+ response.body unless response.nil?
771
+ end
772
+
773
+ #
774
+ # Returns all the Channel registrations of a particular BotService resource
775
+ #
776
+ # @param next_page_link [String] The NextLink from the previous successful call
777
+ # to List operation.
778
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
779
+ # will be added to the HTTP request.
780
+ #
781
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
782
+ #
783
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
784
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
785
+ end
786
+
787
+ #
788
+ # Returns all the Channel registrations of a particular BotService resource
789
+ #
790
+ # @param next_page_link [String] The NextLink from the previous successful call
791
+ # to List operation.
792
+ # @param [Hash{String => String}] A hash of custom headers that will be added
793
+ # to the HTTP request.
794
+ #
795
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
796
+ #
797
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
798
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
799
+
800
+
801
+ request_headers = {}
802
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
803
+
804
+ # Set Headers
805
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
806
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
807
+ path_template = '{nextLink}'
808
+
809
+ request_url = @base_url || @client.base_url
810
+
811
+ options = {
812
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
813
+ skip_encoding_path_params: {'nextLink' => next_page_link},
814
+ headers: request_headers.merge(custom_headers || {}),
815
+ base_url: request_url
816
+ }
817
+ promise = @client.make_request_async(:get, path_template, options)
818
+
819
+ promise = promise.then do |result|
820
+ http_response = result.response
821
+ status_code = http_response.status
822
+ response_content = http_response.body
823
+ unless status_code == 200
824
+ error_model = JSON.load(response_content)
825
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
826
+ end
827
+
828
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
829
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
830
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
831
+ # Deserialize Response
832
+ if status_code == 200
833
+ begin
834
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
835
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::ChannelResponseList.mapper()
836
+ result.body = @client.deserialize(result_mapper, parsed_response)
837
+ rescue Exception => e
838
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
839
+ end
840
+ end
841
+
842
+ result
843
+ end
844
+
845
+ promise.execute
846
+ end
847
+
848
+ #
849
+ # Returns all the Channel registrations of a particular BotService resource
850
+ #
851
+ # @param resource_group_name [String] The name of the Bot resource group in the
852
+ # user subscription.
853
+ # @param resource_name [String] The name of the Bot resource.
854
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
855
+ # will be added to the HTTP request.
856
+ #
857
+ # @return [ChannelResponseList] which provide lazy access to pages of the
858
+ # response.
859
+ #
860
+ def list_by_resource_group_as_lazy(resource_group_name, resource_name, custom_headers:nil)
861
+ response = list_by_resource_group_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
862
+ unless response.nil?
863
+ page = response.body
864
+ page.next_method = Proc.new do |next_page_link|
865
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
866
+ end
867
+ page
868
+ end
869
+ end
870
+
871
+ end
872
+ end