public async Task <Response <ServerAzureADOnlyAuthenticationData> > GetAsync(string subscriptionId, string resourceGroupName, string serverName, AuthenticationName authenticationName, CancellationToken cancellationToken = default) { if (subscriptionId == null) { throw new ArgumentNullException(nameof(subscriptionId)); } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (serverName == null) { throw new ArgumentNullException(nameof(serverName)); } using var message = CreateGetRequest(subscriptionId, resourceGroupName, serverName, authenticationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { ServerAzureADOnlyAuthenticationData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = ServerAzureADOnlyAuthenticationData.DeserializeServerAzureADOnlyAuthenticationData(document.RootElement); return(Response.FromValue(value, message.Response)); }
ServerAzureADOnlyAuthentication IOperationSource <ServerAzureADOnlyAuthentication> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = ServerAzureADOnlyAuthenticationData.DeserializeServerAzureADOnlyAuthenticationData(document.RootElement); return(new ServerAzureADOnlyAuthentication(_client, data)); }
internal ServerAzureADOnlyAuthentication(ArmResource options, ServerAzureADOnlyAuthenticationData resource) : base(options, resource.Id) { HasData = true; _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _serverAzureADOnlyAuthenticationsRestClient = new ServerAzureADOnlyAuthenticationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); }
public virtual async Task <ArmOperation <ServerAzureADOnlyAuthenticationResource> > CreateOrUpdateAsync(WaitUntil waitUntil, AuthenticationName authenticationName, ServerAzureADOnlyAuthenticationData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); using var scope = _serverAzureADOnlyAuthenticationClientDiagnostics.CreateScope("ServerAzureADOnlyAuthenticationCollection.CreateOrUpdate"); scope.Start(); try { var response = await _serverAzureADOnlyAuthenticationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authenticationName, data, cancellationToken).ConfigureAwait(false); var operation = new SqlArmOperation <ServerAzureADOnlyAuthenticationResource>(new ServerAzureADOnlyAuthenticationOperationSource(Client), _serverAzureADOnlyAuthenticationClientDiagnostics, Pipeline, _serverAzureADOnlyAuthenticationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authenticationName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
public async virtual Task <ServerAzureADOnlyAuthenticationCreateOrUpdateOperation> CreateOrUpdateAsync(bool waitForCompletion, AuthenticationName authenticationName, ServerAzureADOnlyAuthenticationData parameters, CancellationToken cancellationToken = default) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } using var scope = _serverAzureADOnlyAuthenticationClientDiagnostics.CreateScope("ServerAzureADOnlyAuthenticationCollection.CreateOrUpdate"); scope.Start(); try { var response = await _serverAzureADOnlyAuthenticationRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authenticationName, parameters, cancellationToken).ConfigureAwait(false); var operation = new ServerAzureADOnlyAuthenticationCreateOrUpdateOperation(ArmClient, _serverAzureADOnlyAuthenticationClientDiagnostics, Pipeline, _serverAzureADOnlyAuthenticationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authenticationName, parameters).Request, response); if (waitForCompletion) { await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }
internal ServerAzureADOnlyAuthenticationResource(ArmClient client, ServerAzureADOnlyAuthenticationData data) : this(client, data.Id) { HasData = true; _data = data; }
internal ServerAzureADOnlyAuthentication(ArmClient armClient, ServerAzureADOnlyAuthenticationData data) : this(armClient, data.Id) { HasData = true; _data = data; }
public virtual ArmOperation <ServerAzureADOnlyAuthentication> CreateOrUpdate(bool waitForCompletion, AuthenticationName authenticationName, ServerAzureADOnlyAuthenticationData parameters, CancellationToken cancellationToken = default) { Argument.AssertNotNull(parameters, nameof(parameters)); using var scope = _serverAzureADOnlyAuthenticationClientDiagnostics.CreateScope("ServerAzureADOnlyAuthenticationCollection.CreateOrUpdate"); scope.Start(); try { var response = _serverAzureADOnlyAuthenticationRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authenticationName, parameters, cancellationToken); var operation = new SqlArmOperation <ServerAzureADOnlyAuthentication>(new ServerAzureADOnlyAuthenticationOperationSource(Client), _serverAzureADOnlyAuthenticationClientDiagnostics, Pipeline, _serverAzureADOnlyAuthenticationRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authenticationName, parameters).Request, response, OperationFinalStateVia.Location); if (waitForCompletion) { operation.WaitForCompletion(cancellationToken); } return(operation); } catch (Exception e) { scope.Failed(e); throw; } }