| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Threading; |
| | 10 | | using System.Threading.Tasks; |
| | 11 | | using Azure; |
| | 12 | | using Azure.Core; |
| | 13 | | using Azure.Core.Pipeline; |
| | 14 | | using Azure.ResourceManager.Network.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Network |
| | 17 | | { |
| | 18 | | /// <summary> The ServiceEndpointPolicyDefinitions service client. </summary> |
| | 19 | | public partial class ServiceEndpointPolicyDefinitionsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal ServiceEndpointPolicyDefinitionsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of ServiceEndpointPolicyDefinitionsOperations for mocking. </summary> |
| 0 | 25 | | protected ServiceEndpointPolicyDefinitionsOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of ServiceEndpointPolicyDefinitionsOperations. </summary> |
| | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 31 | | /// <param name="subscriptionId"> The subscription credentials which uniquely identify the Microsoft Azure subsc |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| 0 | 33 | | internal ServiceEndpointPolicyDefinitionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, |
| | 34 | | { |
| 0 | 35 | | RestClient = new ServiceEndpointPolicyDefinitionsRestOperations(clientDiagnostics, pipeline, subscriptionId, |
| 0 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 37 | | _pipeline = pipeline; |
| 0 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Get the specified service endpoint policy definitions from service endpoint policy. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy name. </param> |
| | 43 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition name. |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<ServiceEndpointPolicyDefinition>> GetAsync(string resourceGroupName, string s |
| | 46 | | { |
| 0 | 47 | | using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionsOperations.Get"); |
| 0 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 0 | 51 | | return await RestClient.GetAsync(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefi |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 0 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Get the specified service endpoint policy definitions from service endpoint policy. </summary> |
| | 61 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 62 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy name. </param> |
| | 63 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition name. |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<ServiceEndpointPolicyDefinition> Get(string resourceGroupName, string serviceEndpointPol |
| | 66 | | { |
| 0 | 67 | | using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionsOperations.Get"); |
| 0 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 0 | 71 | | return RestClient.Get(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 0 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> Gets all service endpoint policy definitions in a service end point policy. </summary> |
| | 81 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 82 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy name. </param> |
| | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 84 | | public virtual AsyncPageable<ServiceEndpointPolicyDefinition> ListByResourceGroupAsync(string resourceGroupName, |
| | 85 | | { |
| 0 | 86 | | if (resourceGroupName == null) |
| | 87 | | { |
| 0 | 88 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 89 | | } |
| 0 | 90 | | if (serviceEndpointPolicyName == null) |
| | 91 | | { |
| 0 | 92 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 93 | | } |
| | 94 | |
|
| | 95 | | async Task<Page<ServiceEndpointPolicyDefinition>> FirstPageFunc(int? pageSizeHint) |
| | 96 | | { |
| 0 | 97 | | using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionsOperations.ListByResou |
| 0 | 98 | | scope.Start(); |
| | 99 | | try |
| | 100 | | { |
| 0 | 101 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, serviceEndpointPolicyNam |
| 0 | 102 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 103 | | } |
| 0 | 104 | | catch (Exception e) |
| | 105 | | { |
| 0 | 106 | | scope.Failed(e); |
| 0 | 107 | | throw; |
| | 108 | | } |
| 0 | 109 | | } |
| | 110 | | async Task<Page<ServiceEndpointPolicyDefinition>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 111 | | { |
| 0 | 112 | | using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionsOperations.ListByResou |
| 0 | 113 | | scope.Start(); |
| | 114 | | try |
| | 115 | | { |
| 0 | 116 | | var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, servic |
| 0 | 117 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 118 | | } |
| 0 | 119 | | catch (Exception e) |
| | 120 | | { |
| 0 | 121 | | scope.Failed(e); |
| 0 | 122 | | throw; |
| | 123 | | } |
| 0 | 124 | | } |
| 0 | 125 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 126 | | } |
| | 127 | |
|
| | 128 | | /// <summary> Gets all service endpoint policy definitions in a service end point policy. </summary> |
| | 129 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 130 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy name. </param> |
| | 131 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 132 | | public virtual Pageable<ServiceEndpointPolicyDefinition> ListByResourceGroup(string resourceGroupName, string se |
| | 133 | | { |
| 0 | 134 | | if (resourceGroupName == null) |
| | 135 | | { |
| 0 | 136 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 137 | | } |
| 0 | 138 | | if (serviceEndpointPolicyName == null) |
| | 139 | | { |
| 0 | 140 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 141 | | } |
| | 142 | |
|
| | 143 | | Page<ServiceEndpointPolicyDefinition> FirstPageFunc(int? pageSizeHint) |
| | 144 | | { |
| 0 | 145 | | using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionsOperations.ListByResou |
| 0 | 146 | | scope.Start(); |
| | 147 | | try |
| | 148 | | { |
| 0 | 149 | | var response = RestClient.ListByResourceGroup(resourceGroupName, serviceEndpointPolicyName, cancella |
| 0 | 150 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 151 | | } |
| 0 | 152 | | catch (Exception e) |
| | 153 | | { |
| 0 | 154 | | scope.Failed(e); |
| 0 | 155 | | throw; |
| | 156 | | } |
| 0 | 157 | | } |
| | 158 | | Page<ServiceEndpointPolicyDefinition> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 159 | | { |
| 0 | 160 | | using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionsOperations.ListByResou |
| 0 | 161 | | scope.Start(); |
| | 162 | | try |
| | 163 | | { |
| 0 | 164 | | var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, serviceEndpointPo |
| 0 | 165 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 166 | | } |
| 0 | 167 | | catch (Exception e) |
| | 168 | | { |
| 0 | 169 | | scope.Failed(e); |
| 0 | 170 | | throw; |
| | 171 | | } |
| 0 | 172 | | } |
| 0 | 173 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 174 | | } |
| | 175 | |
|
| | 176 | | /// <summary> Deletes the specified ServiceEndpoint policy definitions. </summary> |
| | 177 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 178 | | /// <param name="serviceEndpointPolicyName"> The name of the Service Endpoint Policy. </param> |
| | 179 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition. </par |
| | 180 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 181 | | public virtual async Task<ServiceEndpointPolicyDefinitionsDeleteOperation> StartDeleteAsync(string resourceGroup |
| | 182 | | { |
| 0 | 183 | | if (resourceGroupName == null) |
| | 184 | | { |
| 0 | 185 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 186 | | } |
| 0 | 187 | | if (serviceEndpointPolicyName == null) |
| | 188 | | { |
| 0 | 189 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 190 | | } |
| 0 | 191 | | if (serviceEndpointPolicyDefinitionName == null) |
| | 192 | | { |
| 0 | 193 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitionName)); |
| | 194 | | } |
| | 195 | |
|
| 0 | 196 | | using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionsOperations.StartDelete"); |
| 0 | 197 | | scope.Start(); |
| | 198 | | try |
| | 199 | | { |
| 0 | 200 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, serviceEndpointPolicyName, servic |
| 0 | 201 | | return new ServiceEndpointPolicyDefinitionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.Cre |
| | 202 | | } |
| 0 | 203 | | catch (Exception e) |
| | 204 | | { |
| 0 | 205 | | scope.Failed(e); |
| 0 | 206 | | throw; |
| | 207 | | } |
| 0 | 208 | | } |
| | 209 | |
|
| | 210 | | /// <summary> Deletes the specified ServiceEndpoint policy definitions. </summary> |
| | 211 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 212 | | /// <param name="serviceEndpointPolicyName"> The name of the Service Endpoint Policy. </param> |
| | 213 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition. </par |
| | 214 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 215 | | public virtual ServiceEndpointPolicyDefinitionsDeleteOperation StartDelete(string resourceGroupName, string serv |
| | 216 | | { |
| 0 | 217 | | if (resourceGroupName == null) |
| | 218 | | { |
| 0 | 219 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 220 | | } |
| 0 | 221 | | if (serviceEndpointPolicyName == null) |
| | 222 | | { |
| 0 | 223 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 224 | | } |
| 0 | 225 | | if (serviceEndpointPolicyDefinitionName == null) |
| | 226 | | { |
| 0 | 227 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitionName)); |
| | 228 | | } |
| | 229 | |
|
| 0 | 230 | | using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionsOperations.StartDelete"); |
| 0 | 231 | | scope.Start(); |
| | 232 | | try |
| | 233 | | { |
| 0 | 234 | | var originalResponse = RestClient.Delete(resourceGroupName, serviceEndpointPolicyName, serviceEndpointPo |
| 0 | 235 | | return new ServiceEndpointPolicyDefinitionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.Cre |
| | 236 | | } |
| 0 | 237 | | catch (Exception e) |
| | 238 | | { |
| 0 | 239 | | scope.Failed(e); |
| 0 | 240 | | throw; |
| | 241 | | } |
| 0 | 242 | | } |
| | 243 | |
|
| | 244 | | /// <summary> Creates or updates a service endpoint policy definition in the specified service endpoint policy. |
| | 245 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 246 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param> |
| | 247 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition name. |
| | 248 | | /// <param name="serviceEndpointPolicyDefinitions"> Parameters supplied to the create or update service endpoint |
| | 249 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 250 | | public virtual async Task<ServiceEndpointPolicyDefinitionsCreateOrUpdateOperation> StartCreateOrUpdateAsync(stri |
| | 251 | | { |
| 0 | 252 | | if (resourceGroupName == null) |
| | 253 | | { |
| 0 | 254 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 255 | | } |
| 0 | 256 | | if (serviceEndpointPolicyName == null) |
| | 257 | | { |
| 0 | 258 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 259 | | } |
| 0 | 260 | | if (serviceEndpointPolicyDefinitionName == null) |
| | 261 | | { |
| 0 | 262 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitionName)); |
| | 263 | | } |
| 0 | 264 | | if (serviceEndpointPolicyDefinitions == null) |
| | 265 | | { |
| 0 | 266 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitions)); |
| | 267 | | } |
| | 268 | |
|
| 0 | 269 | | using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionsOperations.StartCreateOrUp |
| 0 | 270 | | scope.Start(); |
| | 271 | | try |
| | 272 | | { |
| 0 | 273 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, serviceEndpointPolicyName |
| 0 | 274 | | return new ServiceEndpointPolicyDefinitionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestCl |
| | 275 | | } |
| 0 | 276 | | catch (Exception e) |
| | 277 | | { |
| 0 | 278 | | scope.Failed(e); |
| 0 | 279 | | throw; |
| | 280 | | } |
| 0 | 281 | | } |
| | 282 | |
|
| | 283 | | /// <summary> Creates or updates a service endpoint policy definition in the specified service endpoint policy. |
| | 284 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 285 | | /// <param name="serviceEndpointPolicyName"> The name of the service endpoint policy. </param> |
| | 286 | | /// <param name="serviceEndpointPolicyDefinitionName"> The name of the service endpoint policy definition name. |
| | 287 | | /// <param name="serviceEndpointPolicyDefinitions"> Parameters supplied to the create or update service endpoint |
| | 288 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 289 | | public virtual ServiceEndpointPolicyDefinitionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupN |
| | 290 | | { |
| 0 | 291 | | if (resourceGroupName == null) |
| | 292 | | { |
| 0 | 293 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 294 | | } |
| 0 | 295 | | if (serviceEndpointPolicyName == null) |
| | 296 | | { |
| 0 | 297 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); |
| | 298 | | } |
| 0 | 299 | | if (serviceEndpointPolicyDefinitionName == null) |
| | 300 | | { |
| 0 | 301 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitionName)); |
| | 302 | | } |
| 0 | 303 | | if (serviceEndpointPolicyDefinitions == null) |
| | 304 | | { |
| 0 | 305 | | throw new ArgumentNullException(nameof(serviceEndpointPolicyDefinitions)); |
| | 306 | | } |
| | 307 | |
|
| 0 | 308 | | using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPolicyDefinitionsOperations.StartCreateOrUp |
| 0 | 309 | | scope.Start(); |
| | 310 | | try |
| | 311 | | { |
| 0 | 312 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serviceEndpointPolicyName, serviceEn |
| 0 | 313 | | return new ServiceEndpointPolicyDefinitionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestCl |
| | 314 | | } |
| 0 | 315 | | catch (Exception e) |
| | 316 | | { |
| 0 | 317 | | scope.Failed(e); |
| 0 | 318 | | throw; |
| | 319 | | } |
| 0 | 320 | | } |
| | 321 | | } |
| | 322 | | } |