Exemple #1
0
        TagRuleResource IOperationSource <TagRuleResource> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = TagRuleData.DeserializeTagRuleData(document.RootElement);

            return(new TagRuleResource(_client, data));
        }
Exemple #2
0
        public async Task <Response <TagRuleData> > GetAsync(string subscriptionId, string resourceGroupName, string monitorName, string ruleSetName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(monitorName, nameof(monitorName));
            Argument.AssertNotNullOrEmpty(ruleSetName, nameof(ruleSetName));

            using var message = CreateGetRequest(subscriptionId, resourceGroupName, monitorName, ruleSetName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = TagRuleData.DeserializeTagRuleData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }