diff --git a/Changelog b/Changelog index 29e1f5e..c70b2ea 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,10 @@ 发行说明:记录每次SDK更新的说明,最新版本的SDK包含以前所有版本的更新内容。 --------------------------------------------------------------------- +【版本:v0.9.216】 +涉及产品:HPAS + 修改创建券、查询券、查询镜像列表等接口的参数命名 +涉及产品:BCC + 实例列表接口支持fuzzyInstanceName参数 【版本:v0.9.215】 涉及产品:BCC 变配相关接口新增是否开启Jumbo帧参数、创建相关接口支持传递超线程和numa参数 diff --git a/services/bcc/api/instance.go b/services/bcc/api/instance.go index 11bcdec..74a9790 100644 --- a/services/bcc/api/instance.go +++ b/services/bcc/api/instance.go @@ -260,6 +260,9 @@ func ListInstances(cli bce.Client, args *ListInstanceArgs) (*ListInstanceResult, if len(args.EhcClusterId) != 0 { req.SetParam("ehcClusterId", args.EhcClusterId) } + if len(args.FuzzyInstanceName) != 0 { + req.SetParam("fuzzyInstanceName", args.FuzzyInstanceName) + } } if args == nil || args.MaxKeys == 0 { req.SetParam("maxKeys", "1000") diff --git a/services/bcc/api/model.go b/services/bcc/api/model.go index 4cf1192..6cf8053 100644 --- a/services/bcc/api/model.go +++ b/services/bcc/api/model.go @@ -776,25 +776,26 @@ type CreateInstanceBySpecResult struct { } type ListInstanceArgs struct { - Marker string - MaxKeys int - InternalIp string - DedicatedHostId string - ZoneName string - KeypairId string - AutoRenew bool - InstanceIds string - InstanceNames string - CdsIds string - DeploySetIds string - SecurityGroupIds string - PaymentTiming string - Status string - Tags string - VpcId string - PrivateIps string - Ipv6Addresses string - EhcClusterId string + Marker string + MaxKeys int + InternalIp string + DedicatedHostId string + ZoneName string + KeypairId string + AutoRenew bool + InstanceIds string + InstanceNames string + CdsIds string + DeploySetIds string + SecurityGroupIds string + PaymentTiming string + Status string + Tags string + VpcId string + PrivateIps string + Ipv6Addresses string + EhcClusterId string + FuzzyInstanceName string } type ListInstanceResult struct { diff --git a/services/bcc/client_test.go b/services/bcc/client_test.go index 2758a89..fe2e64b 100644 --- a/services/bcc/client_test.go +++ b/services/bcc/client_test.go @@ -311,6 +311,15 @@ func TestListInstances(t *testing.T) { fmt.Println(res) } +func TestListInstanceByFuzzyInstanceName(t *testing.T) { + listArgs := &api.ListInstanceArgs{ + FuzzyInstanceName: "g80wwjst", + } + res, err := BCC_CLIENT.ListInstances(listArgs) + ExpectEqual(t.Errorf, err, nil) + fmt.Println(res) +} + func TestListInstancesByVpcAndIp(t *testing.T) { listArgs := &api.ListInstanceArgs{ VpcId: "vpc-41avheyaawqc", diff --git a/services/hpas/api/api.go b/services/hpas/api/api.go index 4acc7c3..7438ae7 100644 --- a/services/hpas/api/api.go +++ b/services/hpas/api/api.go @@ -262,15 +262,15 @@ func ModifyPasswordHpas(cli bce.Client, body *ModifyPasswordHpasReq) error { return nil } -// CreateHpasCoupon - +// CreateReservedHpas - // // PARAMS: // - cli: the client agent which can perform sending request // - body: // RETURNS: -// - *api.CreateHpasCouponResp: +// - *api.CreateReservedHpasResp: // - error: the return error if any occurs -func CreateHpasCoupon(cli bce.Client, body *CreateHpasCouponReq) (*CreateHpasCouponResp, error) { +func CreateReservedHpas(cli bce.Client, body *CreateReservedHpasReq) (*CreateReservedHpasResp, error) { req := &bce.BceRequest{} req.SetMethod(http.POST) path := "/" @@ -294,23 +294,23 @@ func CreateHpasCoupon(cli bce.Client, body *CreateHpasCouponReq) (*CreateHpasCou if resp.IsFail() { return nil, resp.ServiceError() } - res := &CreateHpasCouponResp{} + res := &CreateReservedHpasResp{} if err := resp.ParseJsonBody(res); err != nil { return nil, err } return res, nil } -// DescribeCouponHpas - +// DescribeReservedHpas - // // PARAMS: // - cli: the client agent which can perform sending request // - body: // RETURNS: -// - *api.ListHpasCouponByPageResp: +// - *api.ListReservedHpasByPageResp: // - error: the return error if any occurs -func DescribeCouponHpas(cli bce.Client, body *ListCouponHpasPageReq) ( - *ListHpasCouponByPageResp, error) { +func DescribeReservedHpas(cli bce.Client, body *ListReservedHpasPageReq) ( + *ListReservedHpasByPageResp, error) { req := &bce.BceRequest{} req.SetMethod(http.POST) path := "/" @@ -334,7 +334,7 @@ func DescribeCouponHpas(cli bce.Client, body *ListCouponHpasPageReq) ( if resp.IsFail() { return nil, resp.ServiceError() } - res := &ListHpasCouponByPageResp{} + res := &ListReservedHpasByPageResp{} if err := resp.ParseJsonBody(res); err != nil { return nil, err } diff --git a/services/hpas/api/model_create_reserved_hpas_req.go b/services/hpas/api/model_create_reserved_hpas_req.go new file mode 100644 index 0000000..6168dc6 --- /dev/null +++ b/services/hpas/api/model_create_reserved_hpas_req.go @@ -0,0 +1,26 @@ +/* + * Copyright 2025 Baidu, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package api + +type CreateReservedHpasReq struct { + Name string `json:"name,omitempty"` + ZoneName string `json:"zoneName,omitempty"` + AppType string `json:"appType,omitempty"` + AppPerformanceLevel string `json:"appPerformanceLevel,omitempty"` + BillingModel BillingModel `json:"billingModel,omitempty"` + PurchaseNum int `json:"purchaseNum,omitempty"` + EhcClusterId string `json:"ehcClusterId,omitempty"` + Tags []TagModel `json:"tags,omitempty"` +} diff --git a/services/hpas/api/model_create_reserved_hpas_resp.go b/services/hpas/api/model_create_reserved_hpas_resp.go new file mode 100644 index 0000000..a122edd --- /dev/null +++ b/services/hpas/api/model_create_reserved_hpas_resp.go @@ -0,0 +1,20 @@ +/* + * Copyright 2025 Baidu, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package api + +type CreateReservedHpasResp struct { + OrderId string `json:"orderId,omitempty"` + ReservedHpasIds []string `json:"reservedHpasIds,omitempty"` +} diff --git a/services/hpas/api/model_image_response.go b/services/hpas/api/model_image_response.go index da6413c..0ccb1f8 100644 --- a/services/hpas/api/model_image_response.go +++ b/services/hpas/api/model_image_response.go @@ -16,9 +16,6 @@ package api type ImageResponse struct { ImageId string `json:"imageId"` - ImageUuid string `json:"imageUuid"` - OsName string `json:"osName"` - OsArch string `json:"osArch"` Name string `json:"name"` ImageType string `json:"imageType"` SupportedAppType []string `json:"supportedAppType"` diff --git a/services/hpas/api/model_list_reserved_hpas_by_page_resp.go b/services/hpas/api/model_list_reserved_hpas_by_page_resp.go new file mode 100644 index 0000000..681c31e --- /dev/null +++ b/services/hpas/api/model_list_reserved_hpas_by_page_resp.go @@ -0,0 +1,24 @@ +/* + * Copyright 2025 Baidu, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package api + +type ListReservedHpasByPageResp struct { + OrderBy string `json:"orderBy"` + Order string `json:"order"` + PageNo int32 `json:"pageNo"` + PageSize int32 `json:"pageSize"` + TotalCount int64 `json:"totalCount"` + ReservedHpasList []HpasReservedResponse `json:"reservedHpasList"` +} diff --git a/services/hpas/api/model_list_reserved_hpas_page_req.go b/services/hpas/api/model_list_reserved_hpas_page_req.go new file mode 100644 index 0000000..952770c --- /dev/null +++ b/services/hpas/api/model_list_reserved_hpas_page_req.go @@ -0,0 +1,25 @@ +/* + * Copyright 2025 Baidu, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package api + +type ListReservedHpasPageReq struct { + ReservedHpasIds []string `json:"reservedHpasIds,omitempty"` + Name string `json:"name,omitempty"` + ZoneName string `json:"zoneName,omitempty"` + ReservedHpasStatus string `json:"reservedHpasStatus,omitempty"` + AppType string `json:"appType,omitempty"` + PageNo int `json:"pageNo,omitempty"` + PageSize int `json:"pageSize,omitempty"` +} diff --git a/services/hpas/api/model_reserved_hpas_response.go b/services/hpas/api/model_reserved_hpas_response.go new file mode 100644 index 0000000..08c1c26 --- /dev/null +++ b/services/hpas/api/model_reserved_hpas_response.go @@ -0,0 +1,29 @@ +/* + * Copyright 2025 Baidu, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ + +package api + +type HpasReservedResponse struct { + ReservedHpasId string `json:"reservedHpasId"` + Name string `json:"name"` + ZoneName string `json:"zoneName"` + AppType string `json:"appType"` + OfferingType string `json:"offeringType"` + Status string `json:"status"` + ReservedHpasPeriod int `json:"reservedHpasPeriod"` + AppPerformanceLevel string `json:"appPerformanceLevel"` + CreateTime string `json:"createTime"` + ExpireTime string `json:"expireTime"` + Tags []TagResponse `json:"tags"` +} diff --git a/services/hpas/client.go b/services/hpas/client.go index cfc8ce3..a5aedf0 100644 --- a/services/hpas/client.go +++ b/services/hpas/client.go @@ -142,28 +142,28 @@ func (c *Client) ModifyPasswordHpas(body *api.ModifyPasswordHpasReq) error { return api.ModifyPasswordHpas(c, body) } -// CreateHpasCoupon - +// CreateReservedHpas - // // PARAMS: // - body: body参数 // RETURNS: -// - *api.CreateHpasCouponResp: +// - *api.CreateReservedHpasResp: // - error: the return error if any occurs -func (c *Client) CreateHpasCoupon(body *api.CreateHpasCouponReq) ( - *api.CreateHpasCouponResp, error) { - return api.CreateHpasCoupon(c, body) +func (c *Client) CreateReservedHpas(body *api.CreateReservedHpasReq) ( + *api.CreateReservedHpasResp, error) { + return api.CreateReservedHpas(c, body) } -// DescribeCouponHpas - +// DescribeReservedHpas - // // PARAMS: // - body: body参数 // RETURNS: -// - *api.ListHpasCouponByPageResp: +// - *api.ListReservedHpasByPageResp: // - error: the return error if any occurs -func (c *Client) DescribeCouponHpas(body *api.ListCouponHpasPageReq) ( - *api.ListHpasCouponByPageResp, error) { - return api.DescribeCouponHpas(c, body) +func (c *Client) DescribeReservedHpas(body *api.ListReservedHpasPageReq) ( + *api.ListReservedHpasByPageResp, error) { + return api.DescribeReservedHpas(c, body) } // ListHpas - diff --git a/services/hpas/client_test.go b/services/hpas/client_test.go index a23d146..06900fd 100644 --- a/services/hpas/client_test.go +++ b/services/hpas/client_test.go @@ -140,8 +140,8 @@ func TestModifyPasswordHpas(t *testing.T) { ExpectEqual(t.Errorf, err, nil) } -func TestCreateHpasCoupon(t *testing.T) { - createHpasCouponArgs := &api.CreateHpasCouponReq{ +func TestCreateReservedHpas(t *testing.T) { + createReservedHpasReq := &api.CreateReservedHpasReq{ AppType: "llama2_7B_train", AppPerformanceLevel: "10k", Name: "create_hpas_test", @@ -149,19 +149,19 @@ func TestCreateHpasCoupon(t *testing.T) { ZoneName: "cn-bj-a", Tags: []api.TagModel{{TagKey: "test1", TagValue: "test1"}}, } - createResult, err := HPAS_CLIENT.CreateHpasCoupon(createHpasCouponArgs) + createResult, err := HPAS_CLIENT.CreateReservedHpas(createReservedHpasReq) ExpectEqual(t.Errorf, err, nil) fmt.Println(createResult) - Hpas_id = createResult.CouponHpasIds[0] + Hpas_id = createResult.ReservedHpasIds[0] } -func TestDescribeCouponHpas(t *testing.T) { - listCouponHpasPageReq := &api.ListCouponHpasPageReq{ - CouponHpasIds: []string{"k-eZgiHDOY"}, - PageNo: 1, - PageSize: 10, +func TestDescribeReservedHpas(t *testing.T) { + listReservedHpasPageReq := &api.ListReservedHpasPageReq{ + ReservedHpasIds: []string{"k-eZgiHDOY"}, + PageNo: 1, + PageSize: 10, } - describeResult, err := HPAS_CLIENT.DescribeCouponHpas(listCouponHpasPageReq) + describeResult, err := HPAS_CLIENT.DescribeReservedHpas(listReservedHpasPageReq) ExpectEqual(t.Errorf, err, nil) fmt.Println(describeResult) }