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

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

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

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

                value = SapCentralServerInstanceData.DeserializeSapCentralServerInstanceData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }