Exemple #1
0
        public async Task <Response <ServiceRegistryResourceData> > GetAsync(string subscriptionId, string resourceGroupName, string serviceName, string serviceRegistryName, CancellationToken cancellationToken = default)
        {
            Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
            Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName));
            Argument.AssertNotNullOrEmpty(serviceName, nameof(serviceName));
            Argument.AssertNotNullOrEmpty(serviceRegistryName, nameof(serviceRegistryName));

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

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

                value = ServiceRegistryResourceData.DeserializeServiceRegistryResourceData(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Exemple #2
0
 internal ServiceRegistryResource(ArmClient client, ServiceRegistryResourceData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }