コード例 #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);
        }
コード例 #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));
 }
コード例 #3
0
 /// <inheritdoc cref="Server.AttachVolumeAsync"/>
 public static ServerVolume AttachVolume(this Server server, ServerVolumeDefinition volume)
 {
     return server.AttachVolumeAsync(volume).ForceSynchronous();
 }
コード例 #4
0
 /// <inheritdoc cref="ComputeService.AttachVolumeAsync" />
 public static void AttachVolume(this ComputeService service, Identifier serverId, ServerVolumeDefinition volume)
 {
     service.AttachVolumeAsync(serverId, volume).ForceSynchronous();
 }
コード例 #5
0
ファイル: Server.cs プロジェクト: ravikamachi/openstack.net
 /// <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;
 }