Exemplo n.º 1
0
        private ApiResult GetCvmInfo(AvailabilityZone zone, string unInstanceId)
        {
            var resultString = _client.DescribeInstances(Enums.Endpoint.Cvm, zone.Region,
                                                         new KeyValuePair <string, string>("instanceIds.1", unInstanceId));

            return(JsonConvert.DeserializeObject <ApiResult>(resultString));
        }
Exemplo n.º 2
0
        private ApiResult CreateCvm(AvailabilityZone zone, string password)
        {
            var resultString = _client.RunInstancesHour(Enums.Endpoint.Cvm, zone.Region, new[] {
                new KeyValuePair <string, string>("zoneId", zone.ZoneId),
                new KeyValuePair <string, string>("cpu", "1"),
                new KeyValuePair <string, string>("mem", "1"),
                new KeyValuePair <string, string>("imageId", "img-3wnd9xpl"),
                new KeyValuePair <string, string>("imageType", "2"),
                new KeyValuePair <string, string>("bandwidthType", "PayByTraffic"),
                new KeyValuePair <string, string>("bandwidth", "1"),
                new KeyValuePair <string, string>("storageSize", "0"),
                new KeyValuePair <string, string>("password", password),
            });

            return(JsonConvert.DeserializeObject <ApiResult>(resultString));
        }