Vault IOperationSource <Vault> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = VaultData.DeserializeVaultData(document.RootElement);

            return(new Vault(_client, data));
        }
        public async Task <Response <VaultData> > UpdateAsync(string resourceGroupName, string vaultName, IDictionary <string, string> tags = null, VaultPatchProperties properties = null, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (vaultName == null)
            {
                throw new ArgumentNullException(nameof(vaultName));
            }

            using var message = CreateUpdateRequest(resourceGroupName, vaultName, tags, properties);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            case 201:
            {
                VaultData value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = VaultData.DeserializeVaultData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Example #3
0
 internal Vault(ArmResource options, VaultData resource) : base(options, resource.Id)
 {
     HasData            = true;
     _data              = resource;
     _clientDiagnostics = new ClientDiagnostics(ClientOptions);
     _vaultsRestClient  = new VaultsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
     _privateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
 }
Example #4
0
 internal Vault(ArmClient armClient, VaultData data) : this(armClient, data.Id)
 {
     HasData = true;
     _data   = data;
 }
Example #5
0
 internal VaultResource(ArmClient client, VaultData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }