azure_mgmt_bot_service 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,962 @@
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 EnterpriseChannels
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the EnterpriseChannels 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
+ # Check whether an Enterprise Channel name is available.
26
+ #
27
+ # @param parameters [EnterpriseChannelCheckNameAvailabilityRequest] The
28
+ # parameters to provide for the Enterprise Channel check name availability
29
+ # request.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [EnterpriseChannelCheckNameAvailabilityResponse] operation results.
34
+ #
35
+ def check_name_availability(parameters, custom_headers:nil)
36
+ response = check_name_availability_async(parameters, custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Check whether an Enterprise Channel name is available.
42
+ #
43
+ # @param parameters [EnterpriseChannelCheckNameAvailabilityRequest] The
44
+ # parameters to provide for the Enterprise Channel check name availability
45
+ # request.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def check_name_availability_with_http_info(parameters, custom_headers:nil)
52
+ check_name_availability_async(parameters, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Check whether an Enterprise Channel name is available.
57
+ #
58
+ # @param parameters [EnterpriseChannelCheckNameAvailabilityRequest] The
59
+ # parameters to provide for the Enterprise Channel check name availability
60
+ # request.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def check_name_availability_async(parameters, custom_headers:nil)
67
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
68
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
69
+
70
+
71
+ request_headers = {}
72
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
73
+
74
+ # Set Headers
75
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
76
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
77
+
78
+ # Serialize Request
79
+ request_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannelCheckNameAvailabilityRequest.mapper()
80
+ request_content = @client.serialize(request_mapper, parameters)
81
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
82
+
83
+ path_template = 'providers/Microsoft.BotService/checkEnterpriseChannelNameAvailability'
84
+
85
+ request_url = @base_url || @client.base_url
86
+
87
+ options = {
88
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
89
+ query_params: {'api-version' => @client.api_version},
90
+ body: request_content,
91
+ headers: request_headers.merge(custom_headers || {}),
92
+ base_url: request_url
93
+ }
94
+ promise = @client.make_request_async(:post, path_template, options)
95
+
96
+ promise = promise.then do |result|
97
+ http_response = result.response
98
+ status_code = http_response.status
99
+ response_content = http_response.body
100
+ unless status_code == 200
101
+ error_model = JSON.load(response_content)
102
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
103
+ end
104
+
105
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
106
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
107
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
108
+ # Deserialize Response
109
+ if status_code == 200
110
+ begin
111
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
112
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannelCheckNameAvailabilityResponse.mapper()
113
+ result.body = @client.deserialize(result_mapper, parsed_response)
114
+ rescue Exception => e
115
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
116
+ end
117
+ end
118
+
119
+ result
120
+ end
121
+
122
+ promise.execute
123
+ end
124
+
125
+ #
126
+ # Returns all the resources of a particular type belonging to a resource group.
127
+ #
128
+ # @param resource_group_name [String] The name of the Bot resource group in the
129
+ # user subscription.
130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
131
+ # will be added to the HTTP request.
132
+ #
133
+ # @return [Array<EnterpriseChannel>] operation results.
134
+ #
135
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
136
+ first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
137
+ first_page.get_all_items
138
+ end
139
+
140
+ #
141
+ # Returns all the resources of a particular type belonging to a resource group.
142
+ #
143
+ # @param resource_group_name [String] The name of the Bot resource group in the
144
+ # user subscription.
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
149
+ #
150
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
151
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
152
+ end
153
+
154
+ #
155
+ # Returns all the resources of a particular type belonging to a resource group.
156
+ #
157
+ # @param resource_group_name [String] The name of the Bot resource group in the
158
+ # user subscription.
159
+ # @param [Hash{String => String}] A hash of custom headers that will be added
160
+ # to the HTTP request.
161
+ #
162
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
163
+ #
164
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
165
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
166
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
167
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
168
+ 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?
169
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
170
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
171
+
172
+
173
+ request_headers = {}
174
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
175
+
176
+ # Set Headers
177
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
178
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
179
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/enterpriseChannels'
180
+
181
+ request_url = @base_url || @client.base_url
182
+
183
+ options = {
184
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
185
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
186
+ query_params: {'api-version' => @client.api_version},
187
+ headers: request_headers.merge(custom_headers || {}),
188
+ base_url: request_url
189
+ }
190
+ promise = @client.make_request_async(:get, path_template, options)
191
+
192
+ promise = promise.then do |result|
193
+ http_response = result.response
194
+ status_code = http_response.status
195
+ response_content = http_response.body
196
+ unless status_code == 200
197
+ error_model = JSON.load(response_content)
198
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
199
+ end
200
+
201
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
202
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
203
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
204
+ # Deserialize Response
205
+ if status_code == 200
206
+ begin
207
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
208
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannelResponseList.mapper()
209
+ result.body = @client.deserialize(result_mapper, parsed_response)
210
+ rescue Exception => e
211
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
212
+ end
213
+ end
214
+
215
+ result
216
+ end
217
+
218
+ promise.execute
219
+ end
220
+
221
+ #
222
+ # Creates an Enterprise Channel.
223
+ #
224
+ # @param resource_group_name [String] The name of the Bot resource group in the
225
+ # user subscription.
226
+ # @param resource_name [String] The name of the Bot resource.
227
+ # @param parameters [EnterpriseChannel] The parameters to provide for the new
228
+ # Enterprise Channel.
229
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
230
+ # will be added to the HTTP request.
231
+ #
232
+ # @return [EnterpriseChannel] operation results.
233
+ #
234
+ def create(resource_group_name, resource_name, parameters, custom_headers:nil)
235
+ response = create_async(resource_group_name, resource_name, parameters, custom_headers:custom_headers).value!
236
+ response.body unless response.nil?
237
+ end
238
+
239
+ #
240
+ # @param resource_group_name [String] The name of the Bot resource group in the
241
+ # user subscription.
242
+ # @param resource_name [String] The name of the Bot resource.
243
+ # @param parameters [EnterpriseChannel] The parameters to provide for the new
244
+ # Enterprise Channel.
245
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
246
+ # will be added to the HTTP request.
247
+ #
248
+ # @return [Concurrent::Promise] promise which provides async access to http
249
+ # response.
250
+ #
251
+ def create_async(resource_group_name, resource_name, parameters, custom_headers:nil)
252
+ # Send request
253
+ promise = begin_create_async(resource_group_name, resource_name, parameters, custom_headers:custom_headers)
254
+
255
+ promise = promise.then do |response|
256
+ # Defining deserialization method.
257
+ deserialize_method = lambda do |parsed_response|
258
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannel.mapper()
259
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
260
+ end
261
+
262
+ # Waiting for response.
263
+ @client.get_long_running_operation_result(response, deserialize_method)
264
+ end
265
+
266
+ promise
267
+ end
268
+
269
+ #
270
+ # Updates an Enterprise Channel.
271
+ #
272
+ # @param resource_group_name [String] The name of the Bot resource group in the
273
+ # user subscription.
274
+ # @param resource_name [String] The name of the Bot resource.
275
+ # @param location [String] Specifies the location of the resource.
276
+ # @param tags [Hash{String => String}] Contains resource tags defined as
277
+ # key/value pairs.
278
+ # @param sku [Sku] Gets or sets the SKU of the resource.
279
+ # @param kind [Kind] Required. Gets or sets the Kind of the resource. Possible
280
+ # values include: 'sdk', 'designer', 'bot', 'function'
281
+ # @param etag [String] Entity Tag
282
+ # @param properties [EnterpriseChannelProperties] The set of properties
283
+ # specific to an Enterprise Channel resource.
284
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
285
+ # will be added to the HTTP request.
286
+ #
287
+ # @return [EnterpriseChannel] operation results.
288
+ #
289
+ def update(resource_group_name, resource_name, location:nil, tags:nil, sku:nil, kind:nil, etag:nil, properties:nil, custom_headers:nil)
290
+ response = update_async(resource_group_name, resource_name, location:location, tags:tags, sku:sku, kind:kind, etag:etag, properties:properties, custom_headers:custom_headers).value!
291
+ response.body unless response.nil?
292
+ end
293
+
294
+ #
295
+ # @param resource_group_name [String] The name of the Bot resource group in the
296
+ # user subscription.
297
+ # @param resource_name [String] The name of the Bot resource.
298
+ # @param location [String] Specifies the location of the resource.
299
+ # @param tags [Hash{String => String}] Contains resource tags defined as
300
+ # key/value pairs.
301
+ # @param sku [Sku] Gets or sets the SKU of the resource.
302
+ # @param kind [Kind] Required. Gets or sets the Kind of the resource. Possible
303
+ # values include: 'sdk', 'designer', 'bot', 'function'
304
+ # @param etag [String] Entity Tag
305
+ # @param properties [EnterpriseChannelProperties] The set of properties
306
+ # specific to an Enterprise Channel resource.
307
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
308
+ # will be added to the HTTP request.
309
+ #
310
+ # @return [Concurrent::Promise] promise which provides async access to http
311
+ # response.
312
+ #
313
+ def update_async(resource_group_name, resource_name, location:nil, tags:nil, sku:nil, kind:nil, etag:nil, properties:nil, custom_headers:nil)
314
+ # Send request
315
+ promise = begin_update_async(resource_group_name, resource_name, location:location, tags:tags, sku:sku, kind:kind, etag:etag, properties:properties, custom_headers:custom_headers)
316
+
317
+ promise = promise.then do |response|
318
+ # Defining deserialization method.
319
+ deserialize_method = lambda do |parsed_response|
320
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannel.mapper()
321
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
322
+ end
323
+
324
+ # Waiting for response.
325
+ @client.get_long_running_operation_result(response, deserialize_method)
326
+ end
327
+
328
+ promise
329
+ end
330
+
331
+ #
332
+ # Deletes an Enterprise Channel from the resource group
333
+ #
334
+ # @param resource_group_name [String] The name of the Bot resource group in the
335
+ # user subscription.
336
+ # @param resource_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
+ def delete(resource_group_name, resource_name, custom_headers:nil)
341
+ response = delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
342
+ nil
343
+ end
344
+
345
+ #
346
+ # @param resource_group_name [String] The name of the Bot resource group in the
347
+ # user subscription.
348
+ # @param resource_name [String] The name of the Bot resource.
349
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
350
+ # will be added to the HTTP request.
351
+ #
352
+ # @return [Concurrent::Promise] promise which provides async access to http
353
+ # response.
354
+ #
355
+ def delete_async(resource_group_name, resource_name, custom_headers:nil)
356
+ # Send request
357
+ promise = begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers)
358
+
359
+ promise = promise.then do |response|
360
+ # Defining deserialization method.
361
+ deserialize_method = lambda do |parsed_response|
362
+ end
363
+
364
+ # Waiting for response.
365
+ @client.get_long_running_operation_result(response, deserialize_method)
366
+ end
367
+
368
+ promise
369
+ end
370
+
371
+ #
372
+ # Returns an Enterprise Channel specified by the parameters.
373
+ #
374
+ # @param resource_group_name [String] The name of the Bot resource group in the
375
+ # user subscription.
376
+ # @param resource_name [String] The name of the Bot resource.
377
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
378
+ # will be added to the HTTP request.
379
+ #
380
+ # @return [EnterpriseChannel] operation results.
381
+ #
382
+ def get(resource_group_name, resource_name, custom_headers:nil)
383
+ response = get_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
384
+ response.body unless response.nil?
385
+ end
386
+
387
+ #
388
+ # Returns an Enterprise Channel specified by the parameters.
389
+ #
390
+ # @param resource_group_name [String] The name of the Bot resource group in the
391
+ # user subscription.
392
+ # @param resource_name [String] The name of the Bot resource.
393
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
394
+ # will be added to the HTTP request.
395
+ #
396
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
397
+ #
398
+ def get_with_http_info(resource_group_name, resource_name, custom_headers:nil)
399
+ get_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
400
+ end
401
+
402
+ #
403
+ # Returns an Enterprise Channel specified by the parameters.
404
+ #
405
+ # @param resource_group_name [String] The name of the Bot resource group in the
406
+ # user subscription.
407
+ # @param resource_name [String] The name of the Bot resource.
408
+ # @param [Hash{String => String}] A hash of custom headers that will be added
409
+ # to the HTTP request.
410
+ #
411
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
412
+ #
413
+ def get_async(resource_group_name, resource_name, custom_headers:nil)
414
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
415
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
416
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
417
+ 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?
418
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
419
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_name.nil? && resource_name.length > 64
420
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MinLength': '2'" if !resource_name.nil? && resource_name.length < 2
421
+ 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?
422
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
423
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
424
+
425
+
426
+ request_headers = {}
427
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
428
+
429
+ # Set Headers
430
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
431
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
432
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/enterpriseChannels/{resourceName}'
433
+
434
+ request_url = @base_url || @client.base_url
435
+
436
+ options = {
437
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
438
+ path_params: {'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
439
+ query_params: {'api-version' => @client.api_version},
440
+ headers: request_headers.merge(custom_headers || {}),
441
+ base_url: request_url
442
+ }
443
+ promise = @client.make_request_async(:get, path_template, options)
444
+
445
+ promise = promise.then do |result|
446
+ http_response = result.response
447
+ status_code = http_response.status
448
+ response_content = http_response.body
449
+ unless status_code == 200
450
+ error_model = JSON.load(response_content)
451
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
452
+ end
453
+
454
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
455
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
456
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
457
+ # Deserialize Response
458
+ if status_code == 200
459
+ begin
460
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
461
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannel.mapper()
462
+ result.body = @client.deserialize(result_mapper, parsed_response)
463
+ rescue Exception => e
464
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
465
+ end
466
+ end
467
+
468
+ result
469
+ end
470
+
471
+ promise.execute
472
+ end
473
+
474
+ #
475
+ # Creates an Enterprise Channel.
476
+ #
477
+ # @param resource_group_name [String] The name of the Bot resource group in the
478
+ # user subscription.
479
+ # @param resource_name [String] The name of the Bot resource.
480
+ # @param parameters [EnterpriseChannel] The parameters to provide for the new
481
+ # Enterprise Channel.
482
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
483
+ # will be added to the HTTP request.
484
+ #
485
+ # @return [EnterpriseChannel] operation results.
486
+ #
487
+ def begin_create(resource_group_name, resource_name, parameters, custom_headers:nil)
488
+ response = begin_create_async(resource_group_name, resource_name, parameters, custom_headers:custom_headers).value!
489
+ response.body unless response.nil?
490
+ end
491
+
492
+ #
493
+ # Creates an Enterprise Channel.
494
+ #
495
+ # @param resource_group_name [String] The name of the Bot resource group in the
496
+ # user subscription.
497
+ # @param resource_name [String] The name of the Bot resource.
498
+ # @param parameters [EnterpriseChannel] The parameters to provide for the new
499
+ # Enterprise Channel.
500
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
501
+ # will be added to the HTTP request.
502
+ #
503
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
504
+ #
505
+ def begin_create_with_http_info(resource_group_name, resource_name, parameters, custom_headers:nil)
506
+ begin_create_async(resource_group_name, resource_name, parameters, custom_headers:custom_headers).value!
507
+ end
508
+
509
+ #
510
+ # Creates an Enterprise Channel.
511
+ #
512
+ # @param resource_group_name [String] The name of the Bot resource group in the
513
+ # user subscription.
514
+ # @param resource_name [String] The name of the Bot resource.
515
+ # @param parameters [EnterpriseChannel] The parameters to provide for the new
516
+ # Enterprise Channel.
517
+ # @param [Hash{String => String}] A hash of custom headers that will be added
518
+ # to the HTTP request.
519
+ #
520
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
521
+ #
522
+ def begin_create_async(resource_group_name, resource_name, parameters, custom_headers:nil)
523
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
524
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
525
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
526
+ 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?
527
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
528
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_name.nil? && resource_name.length > 64
529
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MinLength': '2'" if !resource_name.nil? && resource_name.length < 2
530
+ 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?
531
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
532
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
533
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
534
+
535
+
536
+ request_headers = {}
537
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
538
+
539
+ # Set Headers
540
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
541
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
542
+
543
+ # Serialize Request
544
+ request_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannel.mapper()
545
+ request_content = @client.serialize(request_mapper, parameters)
546
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
547
+
548
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/enterpriseChannels/{resourceName}'
549
+
550
+ request_url = @base_url || @client.base_url
551
+
552
+ options = {
553
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
554
+ path_params: {'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
555
+ query_params: {'api-version' => @client.api_version},
556
+ body: request_content,
557
+ headers: request_headers.merge(custom_headers || {}),
558
+ base_url: request_url
559
+ }
560
+ promise = @client.make_request_async(:put, path_template, options)
561
+
562
+ promise = promise.then do |result|
563
+ http_response = result.response
564
+ status_code = http_response.status
565
+ response_content = http_response.body
566
+ unless status_code == 200 || status_code == 201
567
+ error_model = JSON.load(response_content)
568
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
569
+ end
570
+
571
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
572
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
573
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
574
+ # Deserialize Response
575
+ if status_code == 200
576
+ begin
577
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
578
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannel.mapper()
579
+ result.body = @client.deserialize(result_mapper, parsed_response)
580
+ rescue Exception => e
581
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
582
+ end
583
+ end
584
+ # Deserialize Response
585
+ if status_code == 201
586
+ begin
587
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
588
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannel.mapper()
589
+ result.body = @client.deserialize(result_mapper, parsed_response)
590
+ rescue Exception => e
591
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
592
+ end
593
+ end
594
+
595
+ result
596
+ end
597
+
598
+ promise.execute
599
+ end
600
+
601
+ #
602
+ # Updates an Enterprise Channel.
603
+ #
604
+ # @param resource_group_name [String] The name of the Bot resource group in the
605
+ # user subscription.
606
+ # @param resource_name [String] The name of the Bot resource.
607
+ # @param location [String] Specifies the location of the resource.
608
+ # @param tags [Hash{String => String}] Contains resource tags defined as
609
+ # key/value pairs.
610
+ # @param sku [Sku] Gets or sets the SKU of the resource.
611
+ # @param kind [Kind] Required. Gets or sets the Kind of the resource. Possible
612
+ # values include: 'sdk', 'designer', 'bot', 'function'
613
+ # @param etag [String] Entity Tag
614
+ # @param properties [EnterpriseChannelProperties] The set of properties
615
+ # specific to an Enterprise Channel resource.
616
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
617
+ # will be added to the HTTP request.
618
+ #
619
+ # @return [EnterpriseChannel] operation results.
620
+ #
621
+ def begin_update(resource_group_name, resource_name, location:nil, tags:nil, sku:nil, kind:nil, etag:nil, properties:nil, custom_headers:nil)
622
+ response = begin_update_async(resource_group_name, resource_name, location:location, tags:tags, sku:sku, kind:kind, etag:etag, properties:properties, custom_headers:custom_headers).value!
623
+ response.body unless response.nil?
624
+ end
625
+
626
+ #
627
+ # Updates an Enterprise Channel.
628
+ #
629
+ # @param resource_group_name [String] The name of the Bot resource group in the
630
+ # user subscription.
631
+ # @param resource_name [String] The name of the Bot resource.
632
+ # @param location [String] Specifies the location of the resource.
633
+ # @param tags [Hash{String => String}] Contains resource tags defined as
634
+ # key/value pairs.
635
+ # @param sku [Sku] Gets or sets the SKU of the resource.
636
+ # @param kind [Kind] Required. Gets or sets the Kind of the resource. Possible
637
+ # values include: 'sdk', 'designer', 'bot', 'function'
638
+ # @param etag [String] Entity Tag
639
+ # @param properties [EnterpriseChannelProperties] The set of properties
640
+ # specific to an Enterprise Channel resource.
641
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
642
+ # will be added to the HTTP request.
643
+ #
644
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
645
+ #
646
+ def begin_update_with_http_info(resource_group_name, resource_name, location:nil, tags:nil, sku:nil, kind:nil, etag:nil, properties:nil, custom_headers:nil)
647
+ begin_update_async(resource_group_name, resource_name, location:location, tags:tags, sku:sku, kind:kind, etag:etag, properties:properties, custom_headers:custom_headers).value!
648
+ end
649
+
650
+ #
651
+ # Updates an Enterprise Channel.
652
+ #
653
+ # @param resource_group_name [String] The name of the Bot resource group in the
654
+ # user subscription.
655
+ # @param resource_name [String] The name of the Bot resource.
656
+ # @param location [String] Specifies the location of the resource.
657
+ # @param tags [Hash{String => String}] Contains resource tags defined as
658
+ # key/value pairs.
659
+ # @param sku [Sku] Gets or sets the SKU of the resource.
660
+ # @param kind [Kind] Required. Gets or sets the Kind of the resource. Possible
661
+ # values include: 'sdk', 'designer', 'bot', 'function'
662
+ # @param etag [String] Entity Tag
663
+ # @param properties [EnterpriseChannelProperties] The set of properties
664
+ # specific to an Enterprise Channel resource.
665
+ # @param [Hash{String => String}] A hash of custom headers that will be added
666
+ # to the HTTP request.
667
+ #
668
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
669
+ #
670
+ def begin_update_async(resource_group_name, resource_name, location:nil, tags:nil, sku:nil, kind:nil, etag:nil, properties:nil, custom_headers:nil)
671
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
672
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
673
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
674
+ 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?
675
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
676
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_name.nil? && resource_name.length > 64
677
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MinLength': '2'" if !resource_name.nil? && resource_name.length < 2
678
+ 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?
679
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
680
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
681
+
682
+ parameters = EnterpriseChannel.new
683
+ unless location.nil? && tags.nil? && sku.nil? && kind.nil? && etag.nil? && properties.nil?
684
+ parameters.location = location
685
+ parameters.tags = tags
686
+ parameters.sku = sku
687
+ parameters.kind = kind
688
+ parameters.etag = etag
689
+ parameters.properties = properties
690
+ end
691
+
692
+ request_headers = {}
693
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
694
+
695
+ # Set Headers
696
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
697
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
698
+
699
+ # Serialize Request
700
+ request_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannel.mapper()
701
+ request_content = @client.serialize(request_mapper, parameters)
702
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
703
+
704
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/enterpriseChannels/{resourceName}'
705
+
706
+ request_url = @base_url || @client.base_url
707
+
708
+ options = {
709
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
710
+ path_params: {'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
711
+ query_params: {'api-version' => @client.api_version},
712
+ body: request_content,
713
+ headers: request_headers.merge(custom_headers || {}),
714
+ base_url: request_url
715
+ }
716
+ promise = @client.make_request_async(:patch, path_template, options)
717
+
718
+ promise = promise.then do |result|
719
+ http_response = result.response
720
+ status_code = http_response.status
721
+ response_content = http_response.body
722
+ unless status_code == 200 || status_code == 201
723
+ error_model = JSON.load(response_content)
724
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
725
+ end
726
+
727
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
728
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
729
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
730
+ # Deserialize Response
731
+ if status_code == 200
732
+ begin
733
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
734
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannel.mapper()
735
+ result.body = @client.deserialize(result_mapper, parsed_response)
736
+ rescue Exception => e
737
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
738
+ end
739
+ end
740
+ # Deserialize Response
741
+ if status_code == 201
742
+ begin
743
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
744
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannel.mapper()
745
+ result.body = @client.deserialize(result_mapper, parsed_response)
746
+ rescue Exception => e
747
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
748
+ end
749
+ end
750
+
751
+ result
752
+ end
753
+
754
+ promise.execute
755
+ end
756
+
757
+ #
758
+ # Deletes an Enterprise Channel from the resource group
759
+ #
760
+ # @param resource_group_name [String] The name of the Bot resource group in the
761
+ # user subscription.
762
+ # @param resource_name [String] The name of the Bot resource.
763
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
764
+ # will be added to the HTTP request.
765
+ #
766
+ #
767
+ def begin_delete(resource_group_name, resource_name, custom_headers:nil)
768
+ response = begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
769
+ nil
770
+ end
771
+
772
+ #
773
+ # Deletes an Enterprise Channel from the resource group
774
+ #
775
+ # @param resource_group_name [String] The name of the Bot resource group in the
776
+ # user subscription.
777
+ # @param resource_name [String] The name of the Bot resource.
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 begin_delete_with_http_info(resource_group_name, resource_name, custom_headers:nil)
784
+ begin_delete_async(resource_group_name, resource_name, custom_headers:custom_headers).value!
785
+ end
786
+
787
+ #
788
+ # Deletes an Enterprise Channel from the resource group
789
+ #
790
+ # @param resource_group_name [String] The name of the Bot resource group in the
791
+ # user subscription.
792
+ # @param resource_name [String] The name of the Bot resource.
793
+ # @param [Hash{String => String}] A hash of custom headers that will be added
794
+ # to the HTTP request.
795
+ #
796
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
797
+ #
798
+ def begin_delete_async(resource_group_name, resource_name, custom_headers:nil)
799
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
800
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_group_name.nil? && resource_group_name.length > 64
801
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '2'" if !resource_group_name.nil? && resource_group_name.length < 2
802
+ 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?
803
+ fail ArgumentError, 'resource_name is nil' if resource_name.nil?
804
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MaxLength': '64'" if !resource_name.nil? && resource_name.length > 64
805
+ fail ArgumentError, "'resource_name' should satisfy the constraint - 'MinLength': '2'" if !resource_name.nil? && resource_name.length < 2
806
+ 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?
807
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
808
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
809
+
810
+
811
+ request_headers = {}
812
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
813
+
814
+ # Set Headers
815
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
816
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
817
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/enterpriseChannels/{resourceName}'
818
+
819
+ request_url = @base_url || @client.base_url
820
+
821
+ options = {
822
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
823
+ path_params: {'resourceGroupName' => resource_group_name,'resourceName' => resource_name,'subscriptionId' => @client.subscription_id},
824
+ query_params: {'api-version' => @client.api_version},
825
+ headers: request_headers.merge(custom_headers || {}),
826
+ base_url: request_url
827
+ }
828
+ promise = @client.make_request_async(:delete, path_template, options)
829
+
830
+ promise = promise.then do |result|
831
+ http_response = result.response
832
+ status_code = http_response.status
833
+ response_content = http_response.body
834
+ unless status_code == 200 || status_code == 204
835
+ error_model = JSON.load(response_content)
836
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
837
+ end
838
+
839
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
840
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
841
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
842
+
843
+ result
844
+ end
845
+
846
+ promise.execute
847
+ end
848
+
849
+ #
850
+ # Returns all the resources of a particular type belonging to a resource group.
851
+ #
852
+ # @param next_page_link [String] The NextLink from the previous successful call
853
+ # to List operation.
854
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
855
+ # will be added to the HTTP request.
856
+ #
857
+ # @return [EnterpriseChannelResponseList] operation results.
858
+ #
859
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
860
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
861
+ response.body unless response.nil?
862
+ end
863
+
864
+ #
865
+ # Returns all the resources of a particular type belonging to a resource group.
866
+ #
867
+ # @param next_page_link [String] The NextLink from the previous successful call
868
+ # to List operation.
869
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
870
+ # will be added to the HTTP request.
871
+ #
872
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
873
+ #
874
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
875
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
876
+ end
877
+
878
+ #
879
+ # Returns all the resources of a particular type belonging to a resource group.
880
+ #
881
+ # @param next_page_link [String] The NextLink from the previous successful call
882
+ # to List operation.
883
+ # @param [Hash{String => String}] A hash of custom headers that will be added
884
+ # to the HTTP request.
885
+ #
886
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
887
+ #
888
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
889
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
890
+
891
+
892
+ request_headers = {}
893
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
894
+
895
+ # Set Headers
896
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
897
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
898
+ path_template = '{nextLink}'
899
+
900
+ request_url = @base_url || @client.base_url
901
+
902
+ options = {
903
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
904
+ skip_encoding_path_params: {'nextLink' => next_page_link},
905
+ headers: request_headers.merge(custom_headers || {}),
906
+ base_url: request_url
907
+ }
908
+ promise = @client.make_request_async(:get, path_template, options)
909
+
910
+ promise = promise.then do |result|
911
+ http_response = result.response
912
+ status_code = http_response.status
913
+ response_content = http_response.body
914
+ unless status_code == 200
915
+ error_model = JSON.load(response_content)
916
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
917
+ end
918
+
919
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
920
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
921
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
922
+ # Deserialize Response
923
+ if status_code == 200
924
+ begin
925
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
926
+ result_mapper = Azure::BotService::Mgmt::V2018_07_12_preview::Models::EnterpriseChannelResponseList.mapper()
927
+ result.body = @client.deserialize(result_mapper, parsed_response)
928
+ rescue Exception => e
929
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
930
+ end
931
+ end
932
+
933
+ result
934
+ end
935
+
936
+ promise.execute
937
+ end
938
+
939
+ #
940
+ # Returns all the resources of a particular type belonging to a resource group.
941
+ #
942
+ # @param resource_group_name [String] The name of the Bot resource group in the
943
+ # user subscription.
944
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
945
+ # will be added to the HTTP request.
946
+ #
947
+ # @return [EnterpriseChannelResponseList] which provide lazy access to pages of
948
+ # the response.
949
+ #
950
+ def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
951
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
952
+ unless response.nil?
953
+ page = response.body
954
+ page.next_method = Proc.new do |next_page_link|
955
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
956
+ end
957
+ page
958
+ end
959
+ end
960
+
961
+ end
962
+ end