azure_mgmt_cognitive_services 0.18.1 → 0.19.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb +18 -0
  3. data/lib/2016-02-01-preview/generated/azure_mgmt_cognitive_services/cognitive_services_management_client.rb +1 -1
  4. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services.rb +40 -12
  5. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/accounts.rb +178 -103
  6. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/cognitive_services_management_client.rb +235 -7
  7. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/azure_entity_resource.rb +75 -0
  8. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/check_domain_availability_parameter.rb +57 -0
  9. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/check_domain_availability_result.rb +79 -0
  10. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account.rb +21 -31
  11. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_api_properties.rb +90 -0
  12. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_properties.rb +201 -0
  13. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/encryption.rb +61 -0
  14. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/identity.rb +95 -0
  15. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/identity_type.rb +17 -0
  16. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/ip_rule.rb +49 -0
  17. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/key_source.rb +16 -0
  18. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/key_vault_properties.rb +68 -0
  19. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/network_rule_action.rb +16 -0
  20. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/network_rule_set.rb +89 -0
  21. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/private_endpoint.rb +47 -0
  22. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/private_endpoint_connection.rb +74 -0
  23. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/private_endpoint_connection_properties.rb +80 -0
  24. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/private_endpoint_service_connection_status.rb +18 -0
  25. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/private_link_resource.rb +74 -0
  26. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/private_link_resource_list_result.rb +55 -0
  27. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/private_link_resource_properties.rb +100 -0
  28. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/private_link_service_connection_state.rb +73 -0
  29. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/proxy_resource.rb +63 -0
  30. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/public_network_access.rb +16 -0
  31. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/resource.rb +83 -0
  32. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/sku_capability.rb +57 -0
  33. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/tracked_resource.rb +92 -0
  34. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/user_assigned_identity.rb +58 -0
  35. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/user_owned_storage.rb +46 -0
  36. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/virtual_network_rule.rb +69 -0
  37. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/operations.rb +5 -0
  38. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/private_endpoint_connections.rb +373 -0
  39. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/private_link_resources.rb +133 -0
  40. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/resource_skus.rb +6 -0
  41. data/lib/azure_mgmt_cognitive_services.rb +1 -1
  42. data/lib/profiles/latest/modules/cognitiveservices_profile_module.rb +146 -36
  43. data/lib/version.rb +1 -1
  44. metadata +36 -8
  45. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/check_sku_availability.rb +0 -138
  46. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_create_parameters.rb +0 -108
  47. data/lib/2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_update_parameters.rb +0 -70
@@ -0,0 +1,57 @@
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::CognitiveServices::Mgmt::V2017_04_18
7
+ module Models
8
+ #
9
+ # SkuCapability indicates the capability of a certain feature.
10
+ #
11
+ class SkuCapability
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] The name of the SkuCapability.
16
+ attr_accessor :name
17
+
18
+ # @return [String] The value of the SkuCapability.
19
+ attr_accessor :value
20
+
21
+
22
+ #
23
+ # Mapper for SkuCapability class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ client_side_validation: true,
29
+ required: false,
30
+ serialized_name: 'SkuCapability',
31
+ type: {
32
+ name: 'Composite',
33
+ class_name: 'SkuCapability',
34
+ model_properties: {
35
+ name: {
36
+ client_side_validation: true,
37
+ required: false,
38
+ serialized_name: 'name',
39
+ type: {
40
+ name: 'String'
41
+ }
42
+ },
43
+ value: {
44
+ client_side_validation: true,
45
+ required: false,
46
+ serialized_name: 'value',
47
+ type: {
48
+ name: 'String'
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,92 @@
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::CognitiveServices::Mgmt::V2017_04_18
7
+ module Models
8
+ #
9
+ # The resource model definition for a ARM tracked top level resource
10
+ #
11
+ class TrackedResource < Resource
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Hash{String => String}] Resource tags.
16
+ attr_accessor :tags
17
+
18
+ # @return [String] The geo-location where the resource lives
19
+ attr_accessor :location
20
+
21
+
22
+ #
23
+ # Mapper for TrackedResource class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ client_side_validation: true,
29
+ required: false,
30
+ serialized_name: 'TrackedResource',
31
+ type: {
32
+ name: 'Composite',
33
+ class_name: 'TrackedResource',
34
+ model_properties: {
35
+ id: {
36
+ client_side_validation: true,
37
+ required: false,
38
+ read_only: true,
39
+ serialized_name: 'id',
40
+ type: {
41
+ name: 'String'
42
+ }
43
+ },
44
+ name: {
45
+ client_side_validation: true,
46
+ required: false,
47
+ read_only: true,
48
+ serialized_name: 'name',
49
+ type: {
50
+ name: 'String'
51
+ }
52
+ },
53
+ type: {
54
+ client_side_validation: true,
55
+ required: false,
56
+ read_only: true,
57
+ serialized_name: 'type',
58
+ type: {
59
+ name: 'String'
60
+ }
61
+ },
62
+ tags: {
63
+ client_side_validation: true,
64
+ required: false,
65
+ serialized_name: 'tags',
66
+ type: {
67
+ name: 'Dictionary',
68
+ value: {
69
+ client_side_validation: true,
70
+ required: false,
71
+ serialized_name: 'StringElementType',
72
+ type: {
73
+ name: 'String'
74
+ }
75
+ }
76
+ }
77
+ },
78
+ location: {
79
+ client_side_validation: true,
80
+ required: true,
81
+ serialized_name: 'location',
82
+ type: {
83
+ name: 'String'
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,58 @@
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::CognitiveServices::Mgmt::V2017_04_18
7
+ module Models
8
+ #
9
+ # User-assigned managed identity.
10
+ #
11
+ class UserAssignedIdentity
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Azure Active Directory principal ID associated with
16
+ # this Identity.
17
+ attr_accessor :principal_id
18
+
19
+ # @return [String] Client App Id associated with this identity.
20
+ attr_accessor :client_id
21
+
22
+
23
+ #
24
+ # Mapper for UserAssignedIdentity class as Ruby Hash.
25
+ # This will be used for serialization/deserialization.
26
+ #
27
+ def self.mapper()
28
+ {
29
+ client_side_validation: true,
30
+ required: false,
31
+ serialized_name: 'UserAssignedIdentity',
32
+ type: {
33
+ name: 'Composite',
34
+ class_name: 'UserAssignedIdentity',
35
+ model_properties: {
36
+ principal_id: {
37
+ client_side_validation: true,
38
+ required: false,
39
+ serialized_name: 'principalId',
40
+ type: {
41
+ name: 'String'
42
+ }
43
+ },
44
+ client_id: {
45
+ client_side_validation: true,
46
+ required: false,
47
+ serialized_name: 'clientId',
48
+ type: {
49
+ name: 'String'
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,46 @@
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::CognitiveServices::Mgmt::V2017_04_18
7
+ module Models
8
+ #
9
+ # The user owned storage for Cognitive Services account.
10
+ #
11
+ class UserOwnedStorage
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Full resource id of a Microsoft.Storage resource.
16
+ attr_accessor :resource_id
17
+
18
+
19
+ #
20
+ # Mapper for UserOwnedStorage class as Ruby Hash.
21
+ # This will be used for serialization/deserialization.
22
+ #
23
+ def self.mapper()
24
+ {
25
+ client_side_validation: true,
26
+ required: false,
27
+ serialized_name: 'UserOwnedStorage',
28
+ type: {
29
+ name: 'Composite',
30
+ class_name: 'UserOwnedStorage',
31
+ model_properties: {
32
+ resource_id: {
33
+ client_side_validation: true,
34
+ required: false,
35
+ serialized_name: 'resourceId',
36
+ type: {
37
+ name: 'String'
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,69 @@
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::CognitiveServices::Mgmt::V2017_04_18
7
+ module Models
8
+ #
9
+ # A rule governing the accessibility from a specific virtual network.
10
+ #
11
+ class VirtualNetworkRule
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Full resource id of a vnet subnet, such as
16
+ # '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'.
17
+ attr_accessor :id
18
+
19
+ # @return [String] Gets the state of virtual network rule.
20
+ attr_accessor :state
21
+
22
+ # @return [Boolean] Ignore missing vnet service endpoint or not.
23
+ attr_accessor :ignore_missing_vnet_service_endpoint
24
+
25
+
26
+ #
27
+ # Mapper for VirtualNetworkRule class as Ruby Hash.
28
+ # This will be used for serialization/deserialization.
29
+ #
30
+ def self.mapper()
31
+ {
32
+ client_side_validation: true,
33
+ required: false,
34
+ serialized_name: 'VirtualNetworkRule',
35
+ type: {
36
+ name: 'Composite',
37
+ class_name: 'VirtualNetworkRule',
38
+ model_properties: {
39
+ id: {
40
+ client_side_validation: true,
41
+ required: true,
42
+ serialized_name: 'id',
43
+ type: {
44
+ name: 'String'
45
+ }
46
+ },
47
+ state: {
48
+ client_side_validation: true,
49
+ required: false,
50
+ serialized_name: 'state',
51
+ type: {
52
+ name: 'String'
53
+ }
54
+ },
55
+ ignore_missing_vnet_service_endpoint: {
56
+ client_side_validation: true,
57
+ required: false,
58
+ serialized_name: 'ignoreMissingVnetServiceEndpoint',
59
+ type: {
60
+ name: 'Boolean'
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ end
67
+ end
68
+ end
69
+ end
@@ -56,6 +56,7 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
56
56
  #
57
57
  def list_async(custom_headers:nil)
58
58
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
59
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
59
60
 
60
61
 
61
62
  request_headers = {}
@@ -86,6 +87,8 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
86
87
  end
87
88
 
88
89
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
90
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
91
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
89
92
  # Deserialize Response
90
93
  if status_code == 200
91
94
  begin
@@ -174,6 +177,8 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
174
177
  end
175
178
 
176
179
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
180
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
181
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
177
182
  # Deserialize Response
178
183
  if status_code == 200
179
184
  begin
@@ -0,0 +1,373 @@
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::CognitiveServices::Mgmt::V2017_04_18
7
+ #
8
+ # Cognitive Services Management Client
9
+ #
10
+ class PrivateEndpointConnections
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PrivateEndpointConnections class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CognitiveServicesManagementClient] reference to the CognitiveServicesManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets the specified private endpoint connection associated with the Cognitive
26
+ # Services account.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group. The name
29
+ # is case insensitive.
30
+ # @param account_name [String] The name of Cognitive Services account.
31
+ # @param private_endpoint_connection_name [String] The name of the private
32
+ # endpoint connection associated with the Cognitive Services Account
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [PrivateEndpointConnection] operation results.
37
+ #
38
+ def get(resource_group_name, account_name, private_endpoint_connection_name, custom_headers:nil)
39
+ response = get_async(resource_group_name, account_name, private_endpoint_connection_name, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Gets the specified private endpoint connection associated with the Cognitive
45
+ # Services account.
46
+ #
47
+ # @param resource_group_name [String] The name of the resource group. The name
48
+ # is case insensitive.
49
+ # @param account_name [String] The name of Cognitive Services account.
50
+ # @param private_endpoint_connection_name [String] The name of the private
51
+ # endpoint connection associated with the Cognitive Services Account
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def get_with_http_info(resource_group_name, account_name, private_endpoint_connection_name, custom_headers:nil)
58
+ get_async(resource_group_name, account_name, private_endpoint_connection_name, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Gets the specified private endpoint connection associated with the Cognitive
63
+ # Services account.
64
+ #
65
+ # @param resource_group_name [String] The name of the resource group. The name
66
+ # is case insensitive.
67
+ # @param account_name [String] The name of Cognitive Services account.
68
+ # @param private_endpoint_connection_name [String] The name of the private
69
+ # endpoint connection associated with the Cognitive Services Account
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def get_async(resource_group_name, account_name, private_endpoint_connection_name, custom_headers:nil)
76
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
77
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
78
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
79
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
80
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
81
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '64'" if !account_name.nil? && account_name.length > 64
82
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '2'" if !account_name.nil? && account_name.length < 2
83
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
84
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
85
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
86
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
87
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
88
+ fail ArgumentError, 'private_endpoint_connection_name is nil' if private_endpoint_connection_name.nil?
89
+
90
+
91
+ request_headers = {}
92
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
93
+
94
+ # Set Headers
95
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
96
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
97
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'
98
+
99
+ request_url = @base_url || @client.base_url
100
+
101
+ options = {
102
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
103
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'privateEndpointConnectionName' => private_endpoint_connection_name},
104
+ query_params: {'api-version' => @client.api_version},
105
+ headers: request_headers.merge(custom_headers || {}),
106
+ base_url: request_url
107
+ }
108
+ promise = @client.make_request_async(:get, path_template, options)
109
+
110
+ promise = promise.then do |result|
111
+ http_response = result.response
112
+ status_code = http_response.status
113
+ response_content = http_response.body
114
+ unless status_code == 200
115
+ error_model = JSON.load(response_content)
116
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
117
+ end
118
+
119
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
120
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
121
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
122
+ # Deserialize Response
123
+ if status_code == 200
124
+ begin
125
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
126
+ result_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::PrivateEndpointConnection.mapper()
127
+ result.body = @client.deserialize(result_mapper, parsed_response)
128
+ rescue Exception => e
129
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
130
+ end
131
+ end
132
+
133
+ result
134
+ end
135
+
136
+ promise.execute
137
+ end
138
+
139
+ #
140
+ # Update the state of specified private endpoint connection associated with the
141
+ # Cognitive Services account.
142
+ #
143
+ # @param resource_group_name [String] The name of the resource group. The name
144
+ # is case insensitive.
145
+ # @param account_name [String] The name of Cognitive Services account.
146
+ # @param private_endpoint_connection_name [String] The name of the private
147
+ # endpoint connection associated with the Cognitive Services Account
148
+ # @param properties [PrivateEndpointConnection] The private endpoint connection
149
+ # properties.
150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
151
+ # will be added to the HTTP request.
152
+ #
153
+ # @return [PrivateEndpointConnection] operation results.
154
+ #
155
+ def create_or_update(resource_group_name, account_name, private_endpoint_connection_name, properties, custom_headers:nil)
156
+ response = create_or_update_async(resource_group_name, account_name, private_endpoint_connection_name, properties, custom_headers:custom_headers).value!
157
+ response.body unless response.nil?
158
+ end
159
+
160
+ #
161
+ # Update the state of specified private endpoint connection associated with the
162
+ # Cognitive Services account.
163
+ #
164
+ # @param resource_group_name [String] The name of the resource group. The name
165
+ # is case insensitive.
166
+ # @param account_name [String] The name of Cognitive Services account.
167
+ # @param private_endpoint_connection_name [String] The name of the private
168
+ # endpoint connection associated with the Cognitive Services Account
169
+ # @param properties [PrivateEndpointConnection] The private endpoint connection
170
+ # properties.
171
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
172
+ # will be added to the HTTP request.
173
+ #
174
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
175
+ #
176
+ def create_or_update_with_http_info(resource_group_name, account_name, private_endpoint_connection_name, properties, custom_headers:nil)
177
+ create_or_update_async(resource_group_name, account_name, private_endpoint_connection_name, properties, custom_headers:custom_headers).value!
178
+ end
179
+
180
+ #
181
+ # Update the state of specified private endpoint connection associated with the
182
+ # Cognitive Services account.
183
+ #
184
+ # @param resource_group_name [String] The name of the resource group. The name
185
+ # is case insensitive.
186
+ # @param account_name [String] The name of Cognitive Services account.
187
+ # @param private_endpoint_connection_name [String] The name of the private
188
+ # endpoint connection associated with the Cognitive Services Account
189
+ # @param properties [PrivateEndpointConnection] The private endpoint connection
190
+ # properties.
191
+ # @param [Hash{String => String}] A hash of custom headers that will be added
192
+ # to the HTTP request.
193
+ #
194
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
195
+ #
196
+ def create_or_update_async(resource_group_name, account_name, private_endpoint_connection_name, properties, custom_headers:nil)
197
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
198
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
199
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
200
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
201
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
202
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '64'" if !account_name.nil? && account_name.length > 64
203
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '2'" if !account_name.nil? && account_name.length < 2
204
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
205
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
206
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
207
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
208
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
209
+ fail ArgumentError, 'private_endpoint_connection_name is nil' if private_endpoint_connection_name.nil?
210
+ fail ArgumentError, 'properties is nil' if properties.nil?
211
+
212
+
213
+ request_headers = {}
214
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
215
+
216
+ # Set Headers
217
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
218
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
219
+
220
+ # Serialize Request
221
+ request_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::PrivateEndpointConnection.mapper()
222
+ request_content = @client.serialize(request_mapper, properties)
223
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
224
+
225
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'
226
+
227
+ request_url = @base_url || @client.base_url
228
+
229
+ options = {
230
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
231
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'privateEndpointConnectionName' => private_endpoint_connection_name},
232
+ query_params: {'api-version' => @client.api_version},
233
+ body: request_content,
234
+ headers: request_headers.merge(custom_headers || {}),
235
+ base_url: request_url
236
+ }
237
+ promise = @client.make_request_async(:put, path_template, options)
238
+
239
+ promise = promise.then do |result|
240
+ http_response = result.response
241
+ status_code = http_response.status
242
+ response_content = http_response.body
243
+ unless status_code == 200
244
+ error_model = JSON.load(response_content)
245
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
246
+ end
247
+
248
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
249
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
250
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
251
+ # Deserialize Response
252
+ if status_code == 200
253
+ begin
254
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
255
+ result_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::PrivateEndpointConnection.mapper()
256
+ result.body = @client.deserialize(result_mapper, parsed_response)
257
+ rescue Exception => e
258
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
259
+ end
260
+ end
261
+
262
+ result
263
+ end
264
+
265
+ promise.execute
266
+ end
267
+
268
+ #
269
+ # Deletes the specified private endpoint connection associated with the
270
+ # Cognitive Services account.
271
+ #
272
+ # @param resource_group_name [String] The name of the resource group. The name
273
+ # is case insensitive.
274
+ # @param account_name [String] The name of Cognitive Services account.
275
+ # @param private_endpoint_connection_name [String] The name of the private
276
+ # endpoint connection associated with the Cognitive Services Account
277
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
278
+ # will be added to the HTTP request.
279
+ #
280
+ #
281
+ def delete(resource_group_name, account_name, private_endpoint_connection_name, custom_headers:nil)
282
+ response = delete_async(resource_group_name, account_name, private_endpoint_connection_name, custom_headers:custom_headers).value!
283
+ nil
284
+ end
285
+
286
+ #
287
+ # Deletes the specified private endpoint connection associated with the
288
+ # Cognitive Services account.
289
+ #
290
+ # @param resource_group_name [String] The name of the resource group. The name
291
+ # is case insensitive.
292
+ # @param account_name [String] The name of Cognitive Services account.
293
+ # @param private_endpoint_connection_name [String] The name of the private
294
+ # endpoint connection associated with the Cognitive Services Account
295
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
296
+ # will be added to the HTTP request.
297
+ #
298
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
299
+ #
300
+ def delete_with_http_info(resource_group_name, account_name, private_endpoint_connection_name, custom_headers:nil)
301
+ delete_async(resource_group_name, account_name, private_endpoint_connection_name, custom_headers:custom_headers).value!
302
+ end
303
+
304
+ #
305
+ # Deletes the specified private endpoint connection associated with the
306
+ # Cognitive Services account.
307
+ #
308
+ # @param resource_group_name [String] The name of the resource group. The name
309
+ # is case insensitive.
310
+ # @param account_name [String] The name of Cognitive Services account.
311
+ # @param private_endpoint_connection_name [String] The name of the private
312
+ # endpoint connection associated with the Cognitive Services Account
313
+ # @param [Hash{String => String}] A hash of custom headers that will be added
314
+ # to the HTTP request.
315
+ #
316
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
317
+ #
318
+ def delete_async(resource_group_name, account_name, private_endpoint_connection_name, custom_headers:nil)
319
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
320
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
321
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
322
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
323
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
324
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '64'" if !account_name.nil? && account_name.length > 64
325
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '2'" if !account_name.nil? && account_name.length < 2
326
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
327
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
328
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
329
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
330
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
331
+ fail ArgumentError, 'private_endpoint_connection_name is nil' if private_endpoint_connection_name.nil?
332
+
333
+
334
+ request_headers = {}
335
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
336
+
337
+ # Set Headers
338
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
339
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
340
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'
341
+
342
+ request_url = @base_url || @client.base_url
343
+
344
+ options = {
345
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
346
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id,'privateEndpointConnectionName' => private_endpoint_connection_name},
347
+ query_params: {'api-version' => @client.api_version},
348
+ headers: request_headers.merge(custom_headers || {}),
349
+ base_url: request_url
350
+ }
351
+ promise = @client.make_request_async(:delete, path_template, options)
352
+
353
+ promise = promise.then do |result|
354
+ http_response = result.response
355
+ status_code = http_response.status
356
+ response_content = http_response.body
357
+ unless status_code == 200 || status_code == 204
358
+ error_model = JSON.load(response_content)
359
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
360
+ end
361
+
362
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
363
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
364
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
365
+
366
+ result
367
+ end
368
+
369
+ promise.execute
370
+ end
371
+
372
+ end
373
+ end