public async Task <Response <ServiceEndpointPolicy> > GetAsync(string resourceGroupName, string serviceEndpointPolicyName, string expand = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (serviceEndpointPolicyName == null) { throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); } using var message = CreateGetRequest(resourceGroupName, serviceEndpointPolicyName, expand); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { ServiceEndpointPolicy value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); if (document.RootElement.ValueKind == JsonValueKind.Null) { value = null; } else { value = ServiceEndpointPolicy.DeserializeServiceEndpointPolicy(document.RootElement); } return(Response.FromValue(value, message.Response)); }
public virtual ServiceEndpointPoliciesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string serviceEndpointPolicyName, ServiceEndpointPolicy parameters, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (serviceEndpointPolicyName == null) { throw new ArgumentNullException(nameof(serviceEndpointPolicyName)); } if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _clientDiagnostics.CreateScope("ServiceEndpointPoliciesClient.StartCreateOrUpdate"); scope.Start(); try { var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, serviceEndpointPolicyName, parameters, cancellationToken); return(new ServiceEndpointPoliciesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRequest(resourceGroupName, serviceEndpointPolicyName, parameters).Request, originalResponse)); } catch (Exception e) { scope.Failed(e); throw; } }
/// <summary> /// Creates or updates a service Endpoint Policies. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='serviceEndpointPolicyName'> /// The name of the service endpoint policy. /// </param> /// <param name='parameters'> /// Parameters supplied to the create or update service endpoint policy /// operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ServiceEndpointPolicy> BeginCreateOrUpdateAsync(this IServiceEndpointPoliciesOperations operations, string resourceGroupName, string serviceEndpointPolicyName, ServiceEndpointPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceEndpointPolicyName, parameters, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Creates or updates a service Endpoint Policies. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='serviceEndpointPolicyName'> /// The name of the service endpoint policy. /// </param> /// <param name='parameters'> /// Parameters supplied to the create or update service endpoint policy /// operation. /// </param> public static ServiceEndpointPolicy BeginCreateOrUpdate(this IServiceEndpointPoliciesOperations operations, string resourceGroupName, string serviceEndpointPolicyName, ServiceEndpointPolicy parameters) { return(operations.BeginCreateOrUpdateAsync(resourceGroupName, serviceEndpointPolicyName, parameters).GetAwaiter().GetResult()); }
public PSServiceEndpointPolicy ToServiceEndpointPolicy(ServiceEndpointPolicy serviceEndpointPolicy) { var pSServiceEndpointPolicy = NetworkResourceManagerProfile.Mapper.Map <PSServiceEndpointPolicy>(serviceEndpointPolicy); return(pSServiceEndpointPolicy); }