diff --git a/baiducloud/provider.go b/baiducloud/provider.go index ac1e81f8..2cf6234c 100644 --- a/baiducloud/provider.go +++ b/baiducloud/provider.go @@ -122,6 +122,7 @@ package baiducloud import ( "bytes" "fmt" + "github.com/terraform-providers/terraform-provider-baiducloud/baiducloud/service/bcc" "github.com/terraform-providers/terraform-provider-baiducloud/baiducloud/service/bec" "github.com/terraform-providers/terraform-provider-baiducloud/baiducloud/service/cdn" "github.com/terraform-providers/terraform-provider-baiducloud/baiducloud/service/snic" @@ -231,6 +232,7 @@ func Provider() terraform.ResourceProvider { "baiducloud_snic_public_services": snic.DataSourcePublicServices(), "baiducloud_bec_nodes": bec.DataSourceNodes(), "baiducloud_bec_vm_instances": bec.DataSourceVMInstances(), + "baiducloud_bcc_key_pairs": bcc.DataSourceKeyPairs(), }, ResourcesMap: map[string]*schema.Resource{ diff --git a/baiducloud/service/bcc/convert.go b/baiducloud/service/bcc/convert.go new file mode 100644 index 00000000..226cc986 --- /dev/null +++ b/baiducloud/service/bcc/convert.go @@ -0,0 +1,21 @@ +package bcc + +import "github.com/baidubce/bce-sdk-go/services/bcc/api" + +func flattenKeyPairList(keyPairs []api.KeypairModel) interface{} { + tfList := []map[string]interface{}{} + for _, v := range keyPairs { + tfMap := map[string]interface{}{ + "keypair_id": v.KeypairId, + "name": v.Name, + "description": v.Description, + "created_time": v.CreatedTime, + "public_key": v.PublicKey, + "instance_count": v.InstanceCount, + "region_id": v.RegionId, + "fingerprint": v.FingerPrint, + } + tfList = append(tfList, tfMap) + } + return tfList +} diff --git a/baiducloud/service/bcc/data_source_key_pairs.go b/baiducloud/service/bcc/data_source_key_pairs.go new file mode 100644 index 00000000..3492e4d9 --- /dev/null +++ b/baiducloud/service/bcc/data_source_key_pairs.go @@ -0,0 +1,95 @@ +package bcc + +import ( + "fmt" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/terraform-providers/terraform-provider-baiducloud/baiducloud/connectivity" + "log" +) + +func DataSourceKeyPairs() *schema.Resource { + return &schema.Resource{ + Description: "Use this data source to query BCC key pairs. \n\n", + + Read: dataSourceKeyPairsRead, + + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Description: "The name of key pair. Use this to filter key pair list.", + Optional: true, + }, + "key_pairs": { + Type: schema.TypeList, + Description: "The key pair list.", + Computed: true, + Elem: KeyPairSchema(), + }, + }, + } +} + +func KeyPairSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "keypair_id": { + Type: schema.TypeString, + Description: "The id of key pair.", + Computed: true, + }, + "name": { + Type: schema.TypeString, + Description: "The name of key pair.", + Computed: true, + }, + "description": { + Type: schema.TypeString, + Description: "The description of key pair.", + Computed: true, + }, + "created_time": { + Type: schema.TypeString, + Description: "The creation time of key pair.", + Computed: true, + }, + "public_key": { + Type: schema.TypeString, + Description: "The public key of keypair.", + Computed: true, + }, + "instance_count": { + Type: schema.TypeInt, + Description: "The number of instances bound to key pair.", + Computed: true, + }, + "region_id": { + Type: schema.TypeString, + Description: "The id of the region to which key pair belongs.", + Computed: true, + }, + "fingerprint": { + Type: schema.TypeString, + Description: "The fingerprint of key pair.", + Computed: true, + }, + }, + } +} + +func dataSourceKeyPairsRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*connectivity.BaiduClient) + keyPairs, err := FindKeyPairs(conn, d.Get("name").(string)) + + log.Printf("[DEBUG] Read BCC key pairs result: %+v", keyPairs) + if err != nil { + return fmt.Errorf("error reading BCC key pairs: %w", err) + } + + if err := d.Set("key_pairs", flattenKeyPairList(keyPairs)); err != nil { + return fmt.Errorf("error setting key_pairs: %w", err) + } + + d.SetId(resource.UniqueId()) + return nil +} diff --git a/baiducloud/service/bcc/find.go b/baiducloud/service/bcc/find.go new file mode 100644 index 00000000..261430df --- /dev/null +++ b/baiducloud/service/bcc/find.go @@ -0,0 +1,31 @@ +package bcc + +import ( + "github.com/baidubce/bce-sdk-go/services/bcc" + "github.com/baidubce/bce-sdk-go/services/bcc/api" + "github.com/terraform-providers/terraform-provider-baiducloud/baiducloud/connectivity" +) + +func FindKeyPairs(conn *connectivity.BaiduClient, name string) ([]api.KeypairModel, error) { + keyPairs := make([]api.KeypairModel, 0) + args := &api.ListKeypairArgs{Name: name} + for { + raw, err := conn.WithBccClient(func(client *bcc.Client) (interface{}, error) { + return client.ListKeypairs(args) + }) + if err != nil { + return nil, err + } + + result := raw.(*api.ListKeypairResult) + for _, item := range result.Keypairs { + keyPairs = append(keyPairs, item) + } + + if !result.IsTruncated { + break + } + args.Marker = result.NextMarker + } + return keyPairs, nil +} diff --git a/examples/data-sources/baiducloud_bcc_key_pairs/data-source.tf b/examples/data-sources/baiducloud_bcc_key_pairs/data-source.tf new file mode 100644 index 00000000..09dd6b12 --- /dev/null +++ b/examples/data-sources/baiducloud_bcc_key_pairs/data-source.tf @@ -0,0 +1,5 @@ +data "baiducloud_bcc_key_pairs" "example" { + + name = "key_pair_name" + +} diff --git a/go.mod b/go.mod index 04362fcf..5ec23e34 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/terraform-providers/terraform-provider-baiducloud require ( - github.com/baidubce/bce-sdk-go v0.9.153 + github.com/baidubce/bce-sdk-go v0.9.155 github.com/hashicorp/terraform-plugin-sdk v1.17.2 github.com/mitchellh/go-homedir v1.1.0 ) diff --git a/go.sum b/go.sum index be289a19..9753e37c 100644 --- a/go.sum +++ b/go.sum @@ -72,8 +72,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.37.0 h1:GzFnhOIsrGyQ69s7VgqtrG2BG8v7X7vwB3Xpbd/DBBk= github.com/aws/aws-sdk-go v1.37.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/baidubce/bce-sdk-go v0.9.153 h1:h5l2EXehe4C4/bdlAPBaULrbnEDgIu5HOYgniN7bjGM= -github.com/baidubce/bce-sdk-go v0.9.153/go.mod h1:zbYJMQwE4IZuyrJiFO8tO8NbtYiKTFTbwh4eIsqjVdg= +github.com/baidubce/bce-sdk-go v0.9.155 h1:4TeNC0+NSOW5h5+nmZLSKquZsC1WnX5n2ohxxH8/iWg= +github.com/baidubce/bce-sdk-go v0.9.155/go.mod h1:zbYJMQwE4IZuyrJiFO8tO8NbtYiKTFTbwh4eIsqjVdg= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= diff --git a/vendor/github.com/baidubce/bce-sdk-go/bce/config.go b/vendor/github.com/baidubce/bce-sdk-go/bce/config.go index 31d5c4f6..bd2d3771 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/bce/config.go +++ b/vendor/github.com/baidubce/bce-sdk-go/bce/config.go @@ -26,7 +26,7 @@ import ( // Constants and default values for the package bce const ( - SDK_VERSION = "0.9.153" + SDK_VERSION = "0.9.155" URI_PREFIX = "/" // now support uri without prefix "v1" so just set root path DEFAULT_DOMAIN = "baidubce.com" DEFAULT_PROTOCOL = "http" diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bbc/model.go b/vendor/github.com/baidubce/bce-sdk-go/services/bbc/model.go index d4c9effe..f5ae1f89 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bbc/model.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bbc/model.go @@ -977,4 +977,4 @@ type BbcStock struct { type ListInstanceByInstanceIdArgs struct { InstanceIds []string `json:"instanceIdList"` -} \ No newline at end of file +} diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bcc/api/keypair.go b/vendor/github.com/baidubce/bce-sdk-go/services/bcc/api/keypair.go index 78d1741f..1d908c13 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bcc/api/keypair.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bcc/api/keypair.go @@ -217,8 +217,10 @@ func ListKeypairs(cli bce.Client, queryArgs *ListKeypairArgs) (*ListKeypairResul if queryArgs.MaxKeys != 0 { req.SetParam("maxKeys", strconv.Itoa(queryArgs.MaxKeys)) } + if len(queryArgs.Name) != 0 { + req.SetParam("name", queryArgs.Name) + } } - if queryArgs == nil || queryArgs.MaxKeys == 0 { req.SetParam("maxKeys", "1000") } diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bcc/api/model.go b/vendor/github.com/baidubce/bce-sdk-go/services/bcc/api/model.go index 23c47612..a6ab29bf 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bcc/api/model.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bcc/api/model.go @@ -1780,6 +1780,7 @@ type DeleteKeypairArgs struct { type ListKeypairArgs struct { Marker string `json:"marker"` MaxKeys int `json:"maxKeys"` + Name string `json:"name,omitempty"` } type ListKeypairResult struct { diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/bucket.go b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/bucket.go index d2460aa6..dd1b0e02 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/bucket.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/bucket.go @@ -121,7 +121,6 @@ func HeadBucket(cli bce.Client, bucket string) (error, *bce.BceResponse) { return nil, resp } - // PutBucket - create a new bucket with the given name // // PARAMS: @@ -1131,7 +1130,7 @@ func GetBucketMirror(cli bce.Client, bucket string) (*PutBucketMirrorArgs, error if err := resp.ParseJsonBody(result); err != nil { return nil, err } - return result, nil + return result, nil } func DeleteBucketMirror(cli bce.Client, bucket string) error { @@ -1148,4 +1147,62 @@ func DeleteBucketMirror(cli bce.Client, bucket string) error { } defer func() { resp.Body().Close() }() return nil -} \ No newline at end of file +} + + +func PutBucketTag(cli bce.Client, bucket string, putBucketTagReq PutBucketTagReq) error { + req := &bce.BceRequest{} + req.SetUri(getBucketUri(bucket)) + req.SetMethod(http.PUT) + req.SetParam("tagging", "") + reqByte, _ := json.Marshal(putBucketTagReq) + body, err := bce.NewBodyFromString(string(reqByte)) + if err != nil { + return err + } + req.SetBody(body) + resp := &bce.BceResponse{} + if err := SendRequest(cli, req, resp); err != nil { + return err + } + if resp.IsFail() { + return resp.ServiceError() + } + defer func() { resp.Body().Close() }() + return nil +} + +func GetBucketTag(cli bce.Client, bucket string) (*PutBucketTagReq, error) { + req := &bce.BceRequest{} + req.SetUri(getBucketUri(bucket)) + req.SetMethod(http.GET) + req.SetParam("tagging", "") + resp := &bce.BceResponse{} + if err := SendRequest(cli, req, resp); err != nil { + return nil, err + } + if resp.IsFail() { + return nil, resp.ServiceError() + } + result := &PutBucketTagReq{} + if err := resp.ParseJsonBody(result); err != nil { + return nil, err + } + return result, nil +} + +func DeleteBucketTag(cli bce.Client, bucket string) error { + req := &bce.BceRequest{} + req.SetUri(getBucketUri(bucket)) + req.SetMethod(http.DELETE) + req.SetParam("tagging", "") + resp := &bce.BceResponse{} + if err := SendRequest(cli, req, resp); err != nil { + return err + } + if resp.IsFail() { + return resp.ServiceError() + } + defer func() { resp.Body().Close() }() + return nil +} diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/model.go b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/model.go index 73dbbc3f..ce51c527 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/model.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/model.go @@ -613,3 +613,12 @@ type PutBucketMirrorArgs struct { BucketMirroringConfiguration []MirrorConfigurationRule `json:"bucketMirroringConfiguration"` } + +type PutBucketTagReq struct { + Tags []Tag `json:"tags"` +} + +type Tag struct { + TagKey string `json:"tagKey"` + TagValue string `json:"tagValue"` +} \ No newline at end of file diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/object.go b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/object.go index a582799d..bff6a685 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/object.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/bos/api/object.go @@ -195,8 +195,8 @@ func CopyObject(cli bce.Client, bucket, object, source string, } if validCannedAcl(args.CannedAcl) { - req.SetHeader(http.BCE_ACL, args.CannedAcl) - } + req.SetHeader(http.BCE_ACL, args.CannedAcl) + } if err := setUserMetadata(req, args.UserMeta); err != nil { return nil, err @@ -674,6 +674,11 @@ func DeleteMultipleObjects(cli bce.Client, bucket string, return nil, resp.ServiceError() } jsonBody := &DeleteMultipleObjectsResult{} + + if resp.Header(http.CONTENT_LENGTH) == "0" { + resp.Body().Close() + return jsonBody, nil + } if err := resp.ParseJsonBody(jsonBody); err != nil { return nil, err } diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/mobile_black.go b/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/mobile_black.go new file mode 100644 index 00000000..a7fe9f03 --- /dev/null +++ b/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/mobile_black.go @@ -0,0 +1,154 @@ +/* + * Copyright 2023 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. + */ + +// mobile_black.go - the sms MobileBlack APIs definition supported by the SMS service + +package api + +import ( + "encoding/json" + + "github.com/baidubce/bce-sdk-go/bce" + "github.com/baidubce/bce-sdk-go/http" +) + +// CreateMobileBlack - create an sms MobileBlack +// +// PARAMS: +// - cli: the client agent which can perform sending request +// - args: the arguments to create an sms mobileBlack +// RETURNS: +// - error: the return error if any occurs +func CreateMobileBlack(cli bce.Client, args *CreateMobileBlackArgs) error { + if err := CheckError(args != nil, "CreateMobileBlackArgs can not be nil"); err != nil { + return err + } + if err := CheckError(len(args.Type) > 0, "type can not be blank"); err != nil { + return err + } + if err := CheckError(len(args.Phone) > 0, "phone can not be blank"); err != nil { + return err + } + if args.Type == "SignatureBlack" { + if err := CheckError(len(args.SmsType) > 0, + "smsType can not be blank, when 'type' is 'SignatureBlack'."); err != nil { + return err + } + if err := CheckError(len(args.SignatureIdStr) > 0, + "signatureIdStr can not be blank, when 'type' is 'SignatureBlack'."); err != nil { + return err + } + } + + req := &bce.BceRequest{} + req.SetUri(REQUEST_URI_BLACK) + req.SetMethod(http.POST) + req.SetHeader(http.CONTENT_TYPE, bce.DEFAULT_CONTENT_TYPE) + + jsonBytes, jsonErr := json.Marshal(args) + if jsonErr != nil { + return jsonErr + } + body, err := bce.NewBodyFromBytes(jsonBytes) + if err != nil { + return err + } + req.SetBody(body) + resp := &bce.BceResponse{} + if err := cli.SendRequest(req, resp); err != nil { + return err + } + if resp.IsFail() { + return resp.ServiceError() + } + return nil +} + +// DeleteMobileBlack - delete sms mobileBlack by phones +// +// PARAMS: +// - cli: the client agent which can perform sending request +// - args: the arguments to delete sms mobileBlack +// RETURNS: +// - error: the return error if any occurs +func DeleteMobileBlack(cli bce.Client, args *DeleteMobileBlackArgs) error { + if err := CheckError(args != nil, "DeleteMobileBlackArgs can not be nil"); err != nil { + return err + } + if err := CheckError(len(args.Phones) > 0, "Phones can not be blank"); err != nil { + return err + } + return bce.NewRequestBuilder(cli). + WithMethod(http.DELETE). + WithURL(REQUEST_URI_BLACK+"/delete"). + WithQueryParam("phones", args.Phones). + Do() +} + +// GetMobileBlack - get sms mobileBlackList +// +// PARAMS: +// - cli: the client agent which can perform sending request +// - args: the arguments to get sms mobileBlackList +// RETURNS: +// - error: the return error if any occurs +// - *api.GetMobileBlackResult: the result of get sms MobileBlackList +func GetMobileBlack(cli bce.Client, args *GetMobileBlackArgs) (*GetMobileBlackResult, error) { + if err := CheckError(args != nil, "GetMobileBlackArgs can not be nil"); err != nil { + return nil, err + } + + paramsMap := make(map[string]string) + if len(args.Phone) > 0 { + paramsMap["phone"] = args.Phone + } + if len(args.SmsType) > 0 { + paramsMap["smsType"] = args.SmsType + } + if len(args.SignatureIdStr) > 0 { + paramsMap["signatureIdStr"] = args.SignatureIdStr + } + if len(args.StartTime) > 0 { + paramsMap["startTime"] = args.StartTime + } + if len(args.EndTime) > 0 { + paramsMap["endTime"] = args.EndTime + } + if len(args.PageNo) > 0 { + paramsMap["pageNo"] = args.PageNo + } + if len(args.PageSize) > 0 { + paramsMap["pageSize"] = args.PageSize + } + + req := &bce.BceRequest{} + req.SetUri(REQUEST_URI_BLACK) + req.SetMethod(http.GET) + req.SetHeader(http.CONTENT_TYPE, bce.DEFAULT_CONTENT_TYPE) + req.SetParams(paramsMap) + + resp := &bce.BceResponse{} + if err := cli.SendRequest(req, resp); err != nil { + return nil, err + } + if resp.IsFail() { + return nil, resp.ServiceError() + } + + result := &GetMobileBlackResult{} + if err := resp.ParseJsonBody(result); err != nil { + return nil, err + } + return result, nil +} diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/model.go b/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/model.go index 944a7839..f8fa15e1 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/model.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/model.go @@ -150,13 +150,58 @@ type UpdateQuotaRateArgs struct { // QueryQuotaRateResult defines the data structure of querying the user's quota and rate limit type QueryQuotaRateResult struct { - QuotaPerDay int `json:"quotaPerDay"` - QuotaRemainToday int `json:"quotaRemainToday"` - QuotaPerMonth int `json:"quotaPerMonth"` - QuotaRemainThisMonth int `json:"quotaRemainThisMonth"` - QuotaWhitelist bool `json:"quotaWhitelist"` - RateLimitPerDay int `json:"rateLimitPerMobilePerSignByDay"` - RateLimitPerHour int `json:"rateLimitPerMobilePerSignByHour"` - RateLimitPerMinute int `json:"rateLimitPerMobilePerSignByMinute"` - RateLimitWhitelist bool `json:"rateLimitWhitelist"` + QuotaPerDay int `json:"quotaPerDay"` + QuotaRemainToday int `json:"quotaRemainToday"` + QuotaPerMonth int `json:"quotaPerMonth"` + QuotaRemainThisMonth int `json:"quotaRemainThisMonth"` + ApplyQuotaPerDay int `json:"applyQuotaPerDay"` + ApplyQuotaPerMonth int `json:"applyQuotaPerMonth"` + ApplyCheckStatus string `json:"applyCheckStatus"` + ApplyCheckReply string `json:"checkReply"` + RateLimitPerDay int `json:"rateLimitPerMobilePerSignByDay"` + RateLimitPerHour int `json:"rateLimitPerMobilePerSignByHour"` + RateLimitPerMinute int `json:"rateLimitPerMobilePerSignByMinute"` + RateLimitWhitelist bool `json:"rateLimitWhitelist"` +} + +// CreateMobileBlackArgs defines the data structure for creating a mobileBlack +type CreateMobileBlackArgs struct { + Type string `json:"type"` + SmsType string `json:"smsType"` + SignatureIdStr string `json:"signatureIdStr"` + Phone string `json:"phone"` +} + +// DeleteMobileBlackArgs defines the data structure for deleting mobileBlack by phones +type DeleteMobileBlackArgs struct { + Phones string `json:"phones"` +} + +// GetMobileBlackArgs defines the data structure for get mobileBlackList +// startTime态endTime format is yyyy-MM-dd +type GetMobileBlackArgs struct { + Phone string + SmsType string + SignatureIdStr string + StartTime string + EndTime string + PageNo string + PageSize string +} + +// GetMobileBlackResult defines the data structure for get mobileBlackList +type GetMobileBlackResult struct { + TotalCount int `json:"totalCount"` + PageNo int `json:"pageNo"` + PageSize int `json:"pageSize"` + BlackLists []MobileBlackDetail `json:"blacklists"` +} + +// MobileBlackDetail defines the data structure for mobileBlackList detail +type MobileBlackDetail struct { + Phone string `json:"phone"` + Type string `json:"type"` + SmsType string `json:"smsType"` + SignatureIdStr string `json:"signatureIdStr"` + UpdateDate string `json:"updateDate"` } diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/util.go b/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/util.go index 6074f4df..d6841e70 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/util.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/sms/api/util.go @@ -25,6 +25,7 @@ const ( REQUEST_URI_SIGNATURE = "/sms/v3/signatureApply" REQUEST_URI_TEMPLATE = "/sms/v3/template" REQUEST_URI_QUOTA = "/sms/v3/quota" + REQUEST_URI_BLACK = "/sms/v3/blacklist" CLIENT_TOKEN = "clientToken" ) diff --git a/vendor/github.com/baidubce/bce-sdk-go/services/sms/client.go b/vendor/github.com/baidubce/bce-sdk-go/services/sms/client.go index b38bf506..17373ccc 100644 --- a/vendor/github.com/baidubce/bce-sdk-go/services/sms/client.go +++ b/vendor/github.com/baidubce/bce-sdk-go/services/sms/client.go @@ -177,3 +177,34 @@ func (c *Client) QueryQuotaAndRateLimit() (*api.QueryQuotaRateResult, error) { func (c *Client) UpdateQuotaAndRateLimit(args *api.UpdateQuotaRateArgs) error { return api.UpdateQuotaRate(c, args) } + +// CreateMobileBlack - create an sms mobileBlack +// +// PARAMS: +// - args: the arguments to create an sms mobileBlack +// RETURNS: +// - error: the return error if any occurs +func (c *Client) CreateMobileBlack(args *api.CreateMobileBlackArgs) error { + return api.CreateMobileBlack(c, args) +} + +// DeleteMobileBlack - delete sms mobileBlack by phones +// +// PARAMS: +// - args: the arguments to delete an sms mobileBlack +// RETURNS: +// - error: the return error if any occurs +func (c *Client) DeleteMobileBlack(args *api.DeleteMobileBlackArgs) error { + return api.DeleteMobileBlack(c, args) +} + +// GetMobileBlack - get an sms mobileBlack +// +// PARAMS: +// - args: the arguments to get sms mobileBlack +// RETURNS: +// - error: the return error if any occurs +// - *api.GetMobileBlackResult: the result of creating an sms mobileBlack +func (c *Client) GetMobileBlack(args *api.GetMobileBlackArgs) (*api.GetMobileBlackResult, error) { + return api.GetMobileBlack(c, args) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 9a5cfa00..f76c55a0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -74,7 +74,7 @@ github.com/aws/aws-sdk-go/service/sso github.com/aws/aws-sdk-go/service/sso/ssoiface github.com/aws/aws-sdk-go/service/sts github.com/aws/aws-sdk-go/service/sts/stsiface -# github.com/baidubce/bce-sdk-go v0.9.153 +# github.com/baidubce/bce-sdk-go v0.9.155 github.com/baidubce/bce-sdk-go/auth github.com/baidubce/bce-sdk-go/bce github.com/baidubce/bce-sdk-go/http diff --git a/website/docs/d/bcc_key_pairs.html.markdown b/website/docs/d/bcc_key_pairs.html.markdown new file mode 100644 index 00000000..b368d9c3 --- /dev/null +++ b/website/docs/d/bcc_key_pairs.html.markdown @@ -0,0 +1,47 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "baiducloud_bcc_key_pairs Data Source - terraform-provider-baiducloud" +subcategory: "Baidu Cloud Compute (BCC)" +description: |- + Use this data source to query BCC key pairs. +--- + +# baiducloud_bcc_key_pairs (Data Source) + +Use this data source to query BCC key pairs. + +## Example Usage + +```terraform +data "baiducloud_bcc_key_pairs" "example" { + + name = "key_pair_name" + +} +``` + + +## Schema + +### Optional + +- `name` (String) The name of key pair. Use this to filter key pair list. + +### Read-Only + +- `id` (String) The ID of this resource. +- `key_pairs` (List of Object) The key pair list. (see [below for nested schema](#nestedatt--key_pairs)) + + +### Nested Schema for `key_pairs` + +Read-Only: + +- `created_time` (String) The creation time of key pair. +- `description` (String) The description of key pair. +- `fingerprint` (String) The fingerprint of key pair. +- `instance_count` (Number) The number of instances bound to key pair. +- `keypair_id` (String) The id of key pair. +- `name` (String) The name of key pair. +- `public_key` (String) The public key of keypair. +- `region_id` (String) The id of the region to which key pair belongs.