示例#1
0
        DeploymentScript IOperationSource <DeploymentScript> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = DeploymentScriptData.DeserializeDeploymentScriptData(document.RootElement);

            return(new DeploymentScript(_client, data));
        }
示例#2
0
        public async Task <Response <DeploymentScriptData> > UpdateAsync(string subscriptionId, string resourceGroupName, string scriptName, PatchableDeploymentScriptData data, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(scriptName, nameof(scriptName));
            Argument.AssertNotNull(data, nameof(data));

            using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, scriptName, data);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = DeploymentScriptData.DeserializeDeploymentScriptData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
示例#3
0
        public async Task <Response <DeploymentScriptData> > UpdateAsync(string resourceGroupName, string scriptName, IDictionary <string, string> tags = null, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (scriptName == null)
            {
                throw new ArgumentNullException(nameof(scriptName));
            }

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

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

                value = DeploymentScriptData.DeserializeDeploymentScriptData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }