Ejemplo n.º 1
0
        public async Task <Response <CloudServiceRole> > GetAsync(string resourceGroupName, string cloudServiceName, string roleName, CancellationToken cancellationToken = default)
        {
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (cloudServiceName == null)
            {
                throw new ArgumentNullException(nameof(cloudServiceName));
            }
            if (roleName == null)
            {
                throw new ArgumentNullException(nameof(roleName));
            }

            using var message = CreateGetRequest(resourceGroupName, cloudServiceName, roleName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

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

                value = CloudServiceRole.DeserializeCloudServiceRole(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
Ejemplo n.º 2
0
 public static CloudServiceRole GetCloudServiceRole(this ArmClient client, ResourceIdentifier id)
 {
     return(client.GetClient(() =>
     {
         CloudServiceRole.ValidateResourceId(id);
         return new CloudServiceRole(client, id);
     }
                             ));
 }
Ejemplo n.º 3
0
 public static CloudServiceRole GetCloudServiceRole(this ArmClient armClient, ResourceIdentifier id)
 {
     CloudServiceRole.ValidateResourceId(id);
     return(armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new CloudServiceRole(clientOptions, credential, uri, pipeline, id)));
 }
 public static CloudServiceRole GetCloudServiceRole(this ArmClient armClient, ResourceIdentifier id)
 {
     CloudServiceRole.ValidateResourceId(id);
     return(new CloudServiceRole(armClient, id));
 }