Exemplo n.º 1
0
        /// <inheritdoc cref="ComputeApi.AttachVolumeAsync{T}" />
        /// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
        public async Task <ServerVolume> AttachVolumeAsync(ServerVolumeDefinition volume, CancellationToken cancellationToken = default(CancellationToken))
        {
            var compute = this.GetOwnerOrThrow <ComputeApi>();
            var result  = await compute.AttachVolumeAsync <ServerVolume>(Id, volume, cancellationToken).ConfigureAwait(false);

            AttachedVolumes.Add(result);
            ((IChildResource)result).SetParent(this);
            return(result);
        }
Exemplo n.º 2
0
 /// <inheritdoc cref="ComputeApi.AttachVolumeAsync{T}" />
 public Task <ServerVolume> AttachVolumeAsync(Identifier serverId, ServerVolumeDefinition volume, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(_computeApi.AttachVolumeAsync <ServerVolume>(serverId, volume, cancellationToken));
 }
Exemplo n.º 3
0
 /// <inheritdoc cref="Server.AttachVolumeAsync"/>
 public static ServerVolume AttachVolume(this Server server, ServerVolumeDefinition volume)
 {
     return server.AttachVolumeAsync(volume).ForceSynchronous();
 }
 /// <inheritdoc cref="ComputeService.AttachVolumeAsync" />
 public static void AttachVolume(this ComputeService service, Identifier serverId, ServerVolumeDefinition volume)
 {
     service.AttachVolumeAsync(serverId, volume).ForceSynchronous();
 }
Exemplo n.º 5
0
 /// <inheritdoc cref="ComputeApi.AttachVolumeAsync{T}" />
 /// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception>
 public async Task<ServerVolume> AttachVolumeAsync(ServerVolumeDefinition volume, CancellationToken cancellationToken = default(CancellationToken))
 {
     var compute = this.GetOwnerOrThrow<ComputeApi>();
     var result = await compute.AttachVolumeAsync<ServerVolume>(Id, volume, cancellationToken).ConfigureAwait(false);
     AttachedVolumes.Add(result);
     ((IChildResource)result).SetParent(this);
     return result;
 }