/***************************************DatastoreVersions Start**************************************************/ /// <summary> /// 查询数据库版本信息 /// </summary> public static void ListDatastoreVersion(DdsClient client) { ListDatastoreVersionsRequest req = new ListDatastoreVersionsRequest { DatastoreName = ListDatastoreVersionsRequest.DatastoreNameEnum.DDS_COMMUNITY }; try { ListDatastoreVersionsResponse resp = client.ListDatastoreVersions(req); foreach (var version in resp.Versions) { Console.WriteLine(version); } Console.WriteLine("List Datastore Success!"); } 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); } }
/// <summary> /// 查询数据库版本信息 /// </summary> public ListDatastoreVersionsResponse ListDatastoreVersions(ListDatastoreVersionsRequest listDatastoreVersionsRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("datastore_name", listDatastoreVersionsRequest.DatastoreName.ToString()); string urlPath = HttpUtils.AddUrlPath("/v3/{project_id}/datastores/{datastore_name}/versions", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, listDatastoreVersionsRequest); SdkResponse response = DoHttpRequest("GET", request); return(JsonUtils.DeSerialize <ListDatastoreVersionsResponse>(response)); }
/// <summary> /// 查询数据库版本信息 /// </summary> public async Task <ListDatastoreVersionsResponse> ListDatastoreVersionsAsync(ListDatastoreVersionsRequest listDatastoreVersionsRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("datastore_name", listDatastoreVersionsRequest.DatastoreName.ToString()); string urlPath = HttpUtils.AddUrlPath("/v3/{project_id}/datastores/{datastore_name}/versions", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", listDatastoreVersionsRequest); HttpResponseMessage response = await DoHttpRequestAsync("GET", request); return(JsonUtils.DeSerialize <ListDatastoreVersionsResponse>(response)); }