示例#1
0
        public async Task GetAllSystemImagesAllLocations()
        {
            using (ComputeApiClient apiClient = new ComputeApiClient("AU"))
            {
                await apiClient.LoginAsync(
                    accountCredentials : GetIntegrationTestCredentials()
                    );

                foreach (DatacenterSummary datacenter in await apiClient.GetAvailableDataCentersAsync())
                {
                    TestContext.WriteLine("DataCenter '{0}' ({1}):", datacenter.LocationCode, datacenter.DisplayName);

                    foreach (var image in await apiClient.GetImagesAsync(datacenter.LocationCode))
                    {
                        TestContext.WriteLine(
                            "\tImage '{0}' (Id = '{1}') - '{2}' ({3})",
                            image.name,
                            image.id,
                            image
                            .machineSpecification
                            .operatingSystem
                            .displayName,
                            image
                            .machineSpecification
                            .operatingSystem
                            .type
                            );
                    }
                }
            }
        }
示例#2
0
        public async Task GetAvailableDatacenters()
        {
            ICredentials credentials = GetIntegrationTestCredentials();

            using (ComputeApiClient computeApiClient = new ComputeApiClient("au"))
            {
                IAccount account = await
                                   computeApiClient
                                   .LoginAsync(credentials);

                Assert.IsNotNull(account);

                Guid organizationId = account.OrganizationId;
                Assert.AreNotEqual(Guid.Empty, organizationId);

                IReadOnlyList <IDatacenterDetail> dataCenters =
                    await computeApiClient
                    .GetAvailableDataCentersAsync();

                Assert.AreNotEqual(0, dataCenters.Count);
                foreach (IDatacenterDetail dataCenter in dataCenters)
                {
                    TestContext.WriteLine("{0}:{1} ({2})", dataCenter.LocationCode, dataCenter.DisplayName, dataCenter.Country);
                }
            }
        }