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

            return(new CommunicationDomainResource(_client, data));
        }
示例#2
0
        public async Task <Response <CommunicationDomainResourceData> > GetAsync(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName));
            Argument.AssertNotNullOrEmpty(domainName, nameof(domainName));

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

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

                value = CommunicationDomainResourceData.DeserializeCommunicationDomainResourceData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }