Пример #1
0
        //query images(openstack)
        private static void QueryImagesByGlance(ImsClient glanceV2Client)
        {
            var getImageListRequest = new ListImagesRequest()
            {
                Name = "Test"
            };

            try
            {
                var getImageList = glanceV2Client.ListImages(getImageListRequest);
                Console.WriteLine(getImageList.Images);
            }
            catch (RequestTimeoutException requestTimeoutException)
            {
                Console.WriteLine(requestTimeoutException.ErrorMessage);
            }
            catch (ServiceResponseException clientRequestException)
            {
                Console.WriteLine(clientRequestException.HttpStatusCode);
                Console.WriteLine(clientRequestException.ErrorCode);
                Console.WriteLine(clientRequestException.ErrorMsg);
            }
            catch (ConnectionException connectionException)
            {
                Console.WriteLine(connectionException.ErrorMessage);
            }
        }
Пример #2
0
        //query images list
        private static void ListImages(ImsClient imsV2Client)
        {
            ListImagesRequest getImsListInfoRequest = new ListImagesRequest()
            {
                Name = "dataImageTest"
            };

            try
            {
                ListImagesResponse getImsListInfoResponse = imsV2Client.ListImages(getImsListInfoRequest);
                Console.WriteLine(getImsListInfoResponse.Images);
            }
            catch (RequestTimeoutException requestTimeoutException)
            {
                Console.WriteLine(requestTimeoutException.ErrorMessage);
            }
            catch (ServiceResponseException clientRequestException)
            {
                Console.WriteLine(clientRequestException.HttpStatusCode);
                Console.WriteLine(clientRequestException.ErrorCode);
                Console.WriteLine(clientRequestException.ErrorMsg);
            }
            catch (ConnectionException connectionException)
            {
                Console.WriteLine(connectionException.ErrorMessage);
            }
        }
        //private static void GlanceShowImageSchemas(ImsClient glanceV2Client)
        //{
        //    GlanceShowImageSchemasRequest getImageSchemasRequest = new GlanceShowImageSchemasRequest();
        //
        //    try
        //    {
        //        GlanceShowImageSchemasResponse getImageSchemasResponse = glanceV2Client.GlanceShowImageSchemas(getImageSchemasRequest);
        //        Console.WriteLine(getImageSchemasResponse.GetHttpBody());
        //    }
        //    catch (RequestTimeoutException requestTimeoutException)
        //    {
        //        Console.WriteLine(requestTimeoutException.ErrorMessage);
        //    }
        //    catch (ServiceResponseException clientRequestException)
        //    {
        //        Console.WriteLine(clientRequestException.HttpStatusCode);
        //        Console.WriteLine(clientRequestException.ErrorCode);
        //        Console.WriteLine(clientRequestException.ErrorMsg);
        //    }
        //    catch (ConnectionException connectionException)
        //    {
        //        Console.WriteLine(connectionException.ErrorMessage);
        //    }
        //}

        private static void GlanceListImageSchemas(ImsClient glanceV2Client)
        {
            var imageListSchemasRequest = new ListImagesRequest();

            try
            {
                var imageListSchemasResponse = glanceV2Client.ListImages(imageListSchemasRequest);
                Console.WriteLine(imageListSchemasResponse.GetHttpBody());
            }
            catch (RequestTimeoutException requestTimeoutException)
            {
                Console.WriteLine(requestTimeoutException.ErrorMessage);
            }
            catch (ServiceResponseException clientRequestException)
            {
                Console.WriteLine(clientRequestException.HttpStatusCode);
                Console.WriteLine(clientRequestException.ErrorCode);
                Console.WriteLine(clientRequestException.ErrorMsg);
            }
            catch (ConnectionException connectionException)
            {
                Console.WriteLine(connectionException.ErrorMessage);
            }
        }