private static void listInstance(RabbitmqClient client)
        {
            var req = new ListInstancesDetailsRequest
            {
                Engine = ListInstancesDetailsRequest.EngineEnum.RABBITMQ,
            };

            try
            {
                var resp = client.ListInstancesDetails(req);
                Console.WriteLine(resp.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);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查询所有实例列表
        /// </summary>
        public async Task <ListInstancesDetailsResponse> ListInstancesDetailsAsync(ListInstancesDetailsRequest listInstancesDetailsRequest)
        {
            Dictionary <string, string> urlParam = new Dictionary <string, string>();
            string              urlPath          = HttpUtils.AddUrlPath("/v2/{project_id}/instances", urlParam);
            SdkRequest          request          = HttpUtils.InitSdkRequest(urlPath, listInstancesDetailsRequest);
            HttpResponseMessage response         = await DoHttpRequestAsync("GET", request);

            return(JsonUtils.DeSerialize <ListInstancesDetailsResponse>(response));
        }