/// <inheritdoc cref="ServerReference.SnapshotAsync"/>
 public static Image Snapshot(this ServerReference server, SnapshotServerRequest request)
 {
     return server.SnapshotAsync(request).ForceSynchronous();
 }
        /// <inheritdoc cref="ComputeApi.SnapshotServerAsync{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 <Image> SnapshotAsync(SnapshotServerRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var compute = this.GetOwnerOrThrow <ComputeApi>();

            return(await compute.SnapshotServerAsync <Image>(Id, request, cancellationToken).ConfigureAwait(false));
        }
 /// <inheritdoc cref="ComputeApi.SnapshotServerAsync{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<Image> SnapshotAsync(SnapshotServerRequest request, CancellationToken cancellationToken = default(CancellationToken))
 {
     var compute = this.GetOwnerOrThrow<ComputeApi>();
     return await compute.SnapshotServerAsync<Image>(Id, request, cancellationToken).ConfigureAwait(false);
 }
 /// <inheritdoc cref="ComputeService.SnapshotServerAsync" />
 public static Image SnapshotServer(this ComputeService service, Identifier serverId, SnapshotServerRequest request)
 {
     return service.SnapshotServerAsync(serverId, request).ForceSynchronous();
 }
 /// <inheritdoc cref="ComputeApi.SnapshotServerAsync{T}" />
 public Task <Image> SnapshotServerAsync(Identifier serverId, SnapshotServerRequest request, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(_computeApi.SnapshotServerAsync <Image>(serverId, request, cancellationToken));
 }
示例#6
0
        public async Task SnapshotServerTest()
        {
            var server = await _testData.CreateServer();
            await server.WaitUntilActiveAsync();
            Trace.WriteLine($"Created server named: {server.Name}");

            var request = new SnapshotServerRequest(server.Name + "-SNAPSHOT")
            {
                Metadata =
                {
                    ["category"] = "ci"
                }
            };

            Trace.WriteLine("Taking a snapshot of the server...");
            var image = await server.SnapshotAsync(request);
            _testData.Register(image);
            await image.WaitUntilActiveAsync();

            Assert.NotNull(image);
            Assert.Equal(request.Name, image.Name);
            Assert.True(image.Metadata["category"] == "ci");
        }