public async Task <Response <EncryptionScope> > PutAsync(string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScope encryptionScope, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } if (accountName == null) { throw new ArgumentNullException(nameof(accountName)); } if (encryptionScopeName == null) { throw new ArgumentNullException(nameof(encryptionScopeName)); } if (encryptionScope == null) { throw new ArgumentNullException(nameof(encryptionScope)); } using var message = CreatePutRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: case 201: { EncryptionScope value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = EncryptionScope.DeserializeEncryptionScope(document.RootElement); return(Response.FromValue(value, message.Response)); }
public static EncryptionScope GetEncryptionScope(this ArmClient client, ResourceIdentifier id) { return(client.GetClient(() => { EncryptionScope.ValidateResourceId(id); return new EncryptionScope(client, id); } )); }
public static EncryptionScope GetEncryptionScope(this ArmClient armClient, ResourceIdentifier id) { EncryptionScope.ValidateResourceId(id); return(new EncryptionScope(armClient, id)); }
public virtual async Task <Response <EncryptionScope> > PatchAsync(string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScope encryptionScope, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.Patch"); scope.Start(); try { return(await RestClient.PatchAsync(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellationToken).ConfigureAwait(false)); } catch (Exception e) { scope.Failed(e); throw; } }
public virtual Response <EncryptionScope> Put(string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScope encryptionScope, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("EncryptionScopesOperations.Put"); scope.Start(); try { return(RestClient.Put(resourceGroupName, accountName, encryptionScopeName, encryptionScope, cancellationToken)); } catch (Exception e) { scope.Failed(e); throw; } }
internal HttpMessage CreatePutRequest(string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScope encryptionScope) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); uri.AppendPath(accountName, true); uri.AppendPath("/encryptionScopes/", false); uri.AppendPath(encryptionScopeName, true); uri.AppendQuery("api-version", apiVersion, true); request.Uri = uri; request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(encryptionScope); request.Content = content; return(message); }