Exemple #1
0
 internal ServerDnsAlias(ArmResource options, ServerDnsAliasData resource) : base(options, resource.Id)
 {
     HasData                     = true;
     _data                       = resource;
     _clientDiagnostics          = new ClientDiagnostics(ClientOptions);
     _serverDnsAliasesRestClient = new ServerDnsAliasesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
 }
Exemple #2
0
        public async Task <Response <ServerDnsAliasData> > GetAsync(string subscriptionId, string resourceGroupName, string serverName, string dnsAliasName, CancellationToken cancellationToken = default)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (serverName == null)
            {
                throw new ArgumentNullException(nameof(serverName));
            }
            if (dnsAliasName == null)
            {
                throw new ArgumentNullException(nameof(dnsAliasName));
            }

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

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

                value = ServerDnsAliasData.DeserializeServerDnsAliasData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
        ServerDnsAlias IOperationSource <ServerDnsAlias> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = ServerDnsAliasData.DeserializeServerDnsAliasData(document.RootElement);

            return(new ServerDnsAlias(_client, data));
        }
Exemple #4
0
 internal ServerDnsAlias(ArmClient client, ServerDnsAliasData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }