Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Server"/> class.
 /// </summary>
 public Server()
 {
     Addresses       = new Dictionary <string, IList <ServerAddress> >();
     AttachedVolumes = new List <ServerVolumeReference>();
     Metadata        = new ServerMetadata();
     SecurityGroups  = new List <SecurityGroupReference>();
 }
Ejemplo n.º 2
0
        public void GetServerMetadata()
        {
            using (var httpTest = new HttpTest())
            {
                Identifier serverId = "1";
                httpTest.RespondWithJson(new ServerSummaryCollection {
                    new ServerSummary {
                        Id = serverId
                    }
                });
                httpTest.RespondWithJson(new ServerMetadata {
                    ["stuff"] = "things"
                });

                var            servers = _compute.ListServerSummaries();
                ServerMetadata result  = servers.First().GetMetadata();

                httpTest.ShouldHaveCalled($"*/servers/{serverId}/metadata");
                Assert.NotNull(result);
                Assert.Single(result);
                Assert.True(result.ContainsKey("stuff"));
                Assert.IsType <ComputeApi>(((IServiceResource)result).Owner);
            }
        }
Ejemplo n.º 3
0
 /// <inheritdoc cref="ComputeApi.UpdateServerMetadataAsync{T}" />
 public Task <ServerMetadata> UpdateServerMetadataAsync(Identifier serverId, ServerMetadata metadata, bool overwrite = false, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(_computeApi.UpdateServerMetadataAsync <ServerMetadata>(serverId, metadata, overwrite, cancellationToken));
 }