diff --git a/go.mod b/go.mod index 02c01bea58..5775855102 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb v1.0.199 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn v1.0.199 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfs v1.0.199 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.199 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.310 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.283 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.199 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.291 diff --git a/go.sum b/go.sum index 24ff7003cd..a4c2619149 100644 --- a/go.sum +++ b/go.sum @@ -464,6 +464,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfs v1.0.199 h1:VyOKZOl github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfs v1.0.199/go.mod h1:9ldm0D1ToaztnlD2bFC5yjMMqvQfVeAMhvcoCCVnZb8= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.199 h1:bxeY9H4O5nYmSYrsm0e/NhOxrtIcdiZx72mYIZ1IbP4= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.199/go.mod h1:toYhD7pJDpz6XY3cf/zhUXtKDRt1CbLkgmOidQ2j8kA= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.310 h1:Pvmbf9yy3QVaBobjQKV1sqOQrWFChrsazO8nlLjRryw= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.310/go.mod h1:toYhD7pJDpz6XY3cf/zhUXtKDRt1CbLkgmOidQ2j8kA= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.283 h1:8pML0UtXgui5WZFLLrCv6QdR8e0fUva0V4W5wSgTCSc= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.283/go.mod h1:zgARzAnsLzpLhdpAHrHTUilOXytH9aEJy5ssCdizVV0= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.199 h1:o41qFAFJGPDTLNWXs7nLw4fsDxFUCe5gkO2YXI9Ye6Q= diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index 4acb11b4bb..85733b778f 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -118,6 +118,7 @@ Ckafka tencentcloud_ckafka_topics Resource + tencentcloud_ckafka_instance tencentcloud_ckafka_user tencentcloud_ckafka_acl tencentcloud_ckafka_topic @@ -975,6 +976,7 @@ func Provider() terraform.ResourceProvider { "tencentcloud_sqlserver_account": resourceTencentCloudSqlserverAccount(), "tencentcloud_sqlserver_account_db_attachment": resourceTencentCloudSqlserverAccountDBAttachment(), "tencentcloud_sqlserver_readonly_instance": resourceTencentCloudSqlserverReadonlyInstance(), + "tencentcloud_ckafka_instance": resourceTencentCloudCkafkaInstance(), "tencentcloud_ckafka_user": resourceTencentCloudCkafkaUser(), "tencentcloud_ckafka_acl": resourceTencentCloudCkafkaAcl(), "tencentcloud_ckafka_topic": resourceTencentCloudCkafkaTopic(), diff --git a/tencentcloud/resource_tc_ckafka_instance.go b/tencentcloud/resource_tc_ckafka_instance.go new file mode 100644 index 0000000000..c208e5b105 --- /dev/null +++ b/tencentcloud/resource_tc_ckafka_instance.go @@ -0,0 +1,621 @@ +/* +Use this resource to create ckafka instance. + +Example Usage + +```hcl +resource "tencentcloud_ckafka_instance" "foo" { + instance_name = "demo-hello" + zone_id = 100006 + period = 1 + vpc_id = "vpc-boi1ah65" + subnet_id = "subnet-7ros461e" + msg_retention_time = 1440 + + config { + auto_create_topic_enable = true + default_num_partitions = 3 + default_replication_factor = 3 + } + + dynamic_retention_config { + enable = 1 + } +} +``` + +Import + +ckafka instance can be imported using the instance_id, e.g. + +``` +$ terraform import tencentcloud_ckafka_instance.foo ckafka-f9ife4zz +``` +*/ +package tencentcloud + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + ckafka "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" + "log" +) + +func resourceTencentCloudCkafkaInstance() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudCkafkaInstanceCreate, + Read: resourceTencentCloudCkafkaInstanceRead, + Update: resourceTencentCloudCkafkaInstanceUpdate, + Delete: resourceTencentCLoudCkafkaInstanceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + + Schema: map[string]*schema.Schema{ + "instance_name": { + Type: schema.TypeString, + Required: true, + Description: "Instance name.", + }, + "zone_id": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + Description: "Available zone id.", + }, + "period": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + Description: "Prepaid purchase time, such as 1, is one month.", + }, + "vpc_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Vpc id.", + }, + "subnet_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Subnet id.", + }, + "msg_retention_time": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "The maximum retention time of instance logs, in minutes." + + " the default is 10080 (7 days), the maximum is 30 days, and the default 0 is not filled," + + " which means that the log retention time recovery policy is not enabled.", + }, + "renew_flag": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Computed: true, + Description: "Prepaid automatic renewal mark, 0 means the default state, the initial state," + + " 1 means automatic renewal, 2 means clear no automatic renewal (user setting).", + }, + "kafka_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: "Kafka version (0.10.2/1.1.1/2.4.1).", + }, + "disk_size": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ForceNew: true, + Description: "Disk Size.", + }, + "band_width": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ForceNew: true, + Description: "Whether to open the ip whitelist, `true`: open, `false`: close.", + }, + "partition": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + ForceNew: true, + Description: "Partition size, the professional version does not need set.", + }, + "tags": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: "Partition size, the professional version does not need tag.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + Description: "Tag key.", + }, + "value": { + Type: schema.TypeString, + Required: true, + Description: "Tag value.", + }, + }, + }, + }, + "disk_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: "Type of disk.", + }, + "config": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auto_create_topic_enable": { + Type: schema.TypeBool, + Required: true, + Description: "Automatic creation. true: enabled, false: not enabled.", + }, + "default_num_partitions": { + Type: schema.TypeInt, + Required: true, + Description: "If auto.create.topic.enable is set to true and this value is not set, " + + "3 will be used by default.", + }, + "default_replication_factor": { + Type: schema.TypeInt, + Required: true, + Description: "If auto.create.topic.enable is set to true but this value is not set, " + + "2 will be used by default.", + }, + }, + }, + Description: "Instance configuration.", + }, + "dynamic_retention_config": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enable": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Whether the dynamic message retention time configuration is " + + "enabled. 0: disabled; 1: enabled.", + }, + "disk_quota_percentage": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Disk quota threshold (in percentage) for triggering " + + "the message retention time change event.", + }, + "step_forward_percentage": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Percentage by which the message retention " + + "time is shortened each time.", + }, + "bottom_retention": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Minimum retention time, in minutes.", + }, + }, + }, + Description: "Dynamic message retention policy configuration.", + }, + "rebalance_time": { + Type: schema.TypeInt, + Optional: true, + Description: "Modification of the rebalancing time after upgrade.", + }, + "public_network": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Timestamp.", + }, + }, + } +} + +func resourceTencentCloudCkafkaInstanceCreate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_ckafka_instance.create")() + var ( + logId = getLogId(contextNil) + service = CkafkaService{ + client: meta.(*TencentCloudClient).apiV3Conn, + } + request = ckafka.NewCreateInstancePreRequest() + response = ckafka.NewCreateInstancePreResponse() + ctx = context.WithValue(context.TODO(), logIdKey, logId) + ) + instanceName := d.Get("instance_name").(string) + request.InstanceName = &instanceName + + zoneId := int64(d.Get("zone_id").(int)) + request.ZoneId = &zoneId + + period := int64(d.Get("period").(int)) + log.Printf(fmt.Sprintf("%dm", period)) + request.Period = helper.String(fmt.Sprintf("%dm", period)) + // only support create profession instance + request.InstanceType = helper.Int64(1) + request.SpecificationsType = helper.String("profession") + + if v, ok := d.GetOk("vpc_id"); ok { + vpcId := v.(string) + request.VpcId = helper.String(vpcId) + } + + if v, ok := d.GetOk("subnet_id"); ok { + subnetId := v.(string) + request.SubnetId = helper.String(subnetId) + } + + if v, ok := d.GetOk("renew_flag"); ok { + renewFlag := int64(v.(int)) + request.RenewFlag = helper.Int64(renewFlag) + } + + if v, ok := d.GetOk("kafka_version"); ok { + kafkaVersion := v.(string) + request.KafkaVersion = helper.String(kafkaVersion) + } + + if v, ok := d.GetOk("disk_size"); ok { + diskSize := int64(v.(int)) + request.DiskSize = helper.Int64(diskSize) + } + + if v, ok := d.GetOk("band_width"); ok { + bandWidth := int64(v.(int)) + request.BandWidth = helper.Int64(bandWidth) + } + + if v, ok := d.GetOk("partition"); ok { + partition := int64(v.(int)) + request.Partition = helper.Int64(partition) + } + + if v, ok := d.GetOk("tags"); ok { + tagSet := make([]*ckafka.Tag, 0, 10) + for _, item := range v.([]interface{}) { + m := item.(map[string]interface{}) + tagInfo := ckafka.Tag{ + TagKey: helper.String(m["key"].(string)), + TagValue: helper.String(m["value"].(string)), + } + tagSet = append(tagSet, &tagInfo) + } + request.Tags = tagSet + } + + if v, ok := d.GetOk("disk_type"); ok { + diskType := v.(string) + request.DiskType = helper.String(diskType) + } + + result, err := service.client.UseCkafkaClient().CreateInstancePre(request) + response = result + + if err != nil { + log.Printf("[CRITAL]%s create ckafka instance failed, reason:%s\n", logId, err.Error()) + return err + } + + instanceId := response.Response.Result.Data.InstanceId + + err = resource.Retry(5*readRetryTimeout, func() *resource.RetryError { + has, ready, err := service.CheckCkafkaInstanceReady(ctx, *instanceId) + if err != nil { + return resource.NonRetryableError(err) + } + if !has { + return resource.NonRetryableError(fmt.Errorf("ckafka instance not exists.")) + } + if ready { + return nil + } + return resource.RetryableError(fmt.Errorf("create ckafka instance task is processing")) + }) + d.SetId(*instanceId) + + // modify instance attributes + var ( + needModify = false + modifyRequest = ckafka.NewModifyInstanceAttributesRequest() + ) + modifyRequest.InstanceId = instanceId + + if v, ok := d.GetOk("msg_retention_time"); ok { + retentionTime := int64(v.(int)) + modifyRequest.MsgRetentionTime = helper.Int64(retentionTime) + } + + if v, ok := d.GetOk("config"); ok { + needModify = true + config := make([]*ckafka.ModifyInstanceAttributesConfig, 0, 10) + for _, item := range v.([]interface{}) { + dMap := item.(map[string]interface{}) + configInfo := ckafka.ModifyInstanceAttributesConfig{} + if autoCreateTopicEnable, ok := dMap["auto_create_topic_enable"]; ok { + configInfo.AutoCreateTopicEnable = helper.Bool(autoCreateTopicEnable.(bool)) + } + if defaultNumPartitions, ok := dMap["default_num_partitions"]; ok { + configInfo.DefaultNumPartitions = helper.Int64(int64(defaultNumPartitions.(int))) + } + if defaultReplicationFactor, ok := dMap["default_replication_factor"]; ok { + configInfo.DefaultReplicationFactor = helper.Int64(int64(defaultReplicationFactor.(int))) + } + config = append(config, &configInfo) + } + modifyRequest.Config = config[0] + } + + if v, ok := d.GetOk("dynamic_retention_config"); ok { + needModify = true + dynamic := make([]*ckafka.DynamicRetentionTime, 0, 10) + for _, item := range v.([]interface{}) { + dMap := item.(map[string]interface{}) + dynamicInfo := ckafka.DynamicRetentionTime{} + if enable, ok := dMap["enable"]; ok { + dynamicInfo.Enable = helper.Int64(int64(enable.(int))) + } + if diskQuotaPercentage, ok := dMap["disk_quota_percentage"]; ok { + dynamicInfo.DiskQuotaPercentage = helper.Int64(int64(diskQuotaPercentage.(int))) + } + if stepForwardPercentage, ok := dMap["step_forward_percentage"]; ok { + dynamicInfo.StepForwardPercentage = helper.Int64(int64(stepForwardPercentage.(int))) + } + if bottomRetention, ok := dMap["bottom_retention"]; ok { + dynamicInfo.BottomRetention = helper.Int64(int64(bottomRetention.(int))) + } + dynamic = append(dynamic, &dynamicInfo) + } + modifyRequest.DynamicRetentionConfig = dynamic[0] + } + + if v, ok := d.GetOk("rebalance_time"); ok { + needModify = true + modifyRequest.RebalanceTime = helper.Int64(int64(v.(int))) + } + + if v, ok := d.GetOk("public_network"); ok { + needModify = true + modifyRequest.PublicNetwork = helper.Int64(int64(v.(int))) + } + + if needModify { + error := service.ModifyCkafkaInstanceAttributes(ctx, modifyRequest) + if error != nil { + return fmt.Errorf("[API]Set kafka instance attributes fail, reason:%s", error.Error()) + } + } + return resourceTencentCloudCkafkaInstanceRead(d, meta) +} + +func resourceTencentCloudCkafkaInstanceRead(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_ckafka_instance.read")() + defer inconsistentCheck(d, meta)() + + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + + var service = CkafkaService{ + client: meta.(*TencentCloudClient).apiV3Conn, + } + instanceId := d.Id() + + var info *ckafka.InstanceDetail + + err := resource.Retry(readRetryTimeout, func() *resource.RetryError { + res, has, e := service.DescribeCkafkaInstanceById(ctx, instanceId) + if e != nil { + return retryError(e) + } + if !has { + d.SetId("") + return nil + } + info = res + return nil + }) + if err != nil { + return fmt.Errorf("[API]Describe kafka instance fail, reason:%s", err.Error()) + } + _ = d.Set("instance_name", info.InstanceName) + _ = d.Set("zone_id", info.ZoneId) + // calculate period + createTime := *info.CreateTime + expireTime := *info.ExpireTime + period := (expireTime - createTime) / (3600 * 24 * 31) + _ = d.Set("period", &period) + _ = d.Set("vpc_id", info.VpcId) + _ = d.Set("subnet_id", info.SubnetId) + _ = d.Set("renew_flag", info.RenewFlag) + _ = d.Set("kafka_version", info.Version) + _ = d.Set("disk_size", info.DiskSize) + _ = d.Set("band_width", info.Bandwidth) + _ = d.Set("partition", info.MaxPartitionNumber) + tagSets := make([]map[string]interface{}, 0, len(info.Tags)) + for _, item := range info.Tags { + tagSets = append(tagSets, map[string]interface{}{ + "key": item.TagKey, + "value": item.TagValue, + }) + } + _ = d.Set("tags", tagSets) + _ = d.Set("disk_type", info.DiskType) + _ = d.Set("rebalance_time", info.RebalanceTime) + + // query msg_retention_time + var ( + request = ckafka.NewDescribeInstanceAttributesRequest() + response = ckafka.NewDescribeInstanceAttributesResponse() + ) + request.InstanceId = &instanceId + err = resource.Retry(readRetryTimeout, func() *resource.RetryError { + result, e := service.client.UseCkafkaClient().DescribeInstanceAttributes(request) + if e != nil { + return retryError(e) + } + response = result + attr := response.Response.Result + _ = d.Set("msg_retention_time", attr.MsgRetentionTime) + + if attr.Config != nil { + config := make([]map[string]interface{}, 0) + config = append(config, map[string]interface{}{ + "auto_create_topic_enable": attr.Config.AutoCreateTopicsEnable, + "default_num_partitions": attr.Config.DefaultNumPartitions, + "default_replication_factor": attr.Config.DefaultReplicationFactor, + }) + _ = d.Set("config", config) + } + + dynamicConfig := make([]map[string]interface{}, 0) + dynamicConfig = append(dynamicConfig, map[string]interface{}{ + "enable": attr.RetentionTimeConfig.Enable, + "disk_quota_percentage": attr.RetentionTimeConfig.DiskQuotaPercentage, + "step_forward_percentage": attr.RetentionTimeConfig.StepForwardPercentage, + "bottom_retention": attr.RetentionTimeConfig.BottomRetention, + }) + _ = d.Set("dynamic_retention_config", dynamicConfig) + _ = d.Set("public_network", attr.PublicNetwork) + + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s read Ckafka Instance Attributes failed, reason:%s\n", logId, err.Error()) + return err + } + return nil +} + +func resourceTencentCloudCkafkaInstanceUpdate(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_ckafka_instance.update")() + logId := getLogId(contextNil) + ctx := context.WithValue(context.TODO(), logIdKey, logId) + service := CkafkaService{ + client: meta.(*TencentCloudClient).apiV3Conn, + } + instanceId := d.Id() + request := ckafka.NewModifyInstanceAttributesRequest() + request.InstanceId = &instanceId + if d.HasChange("instance_name") { + if v, ok := d.GetOk("instance_name"); ok { + request.InstanceName = helper.String(v.(string)) + } + } + + if d.HasChange("msg_retention_time") { + if v, ok := d.GetOk("msg_retention_time"); ok { + request.MsgRetentionTime = helper.Int64(int64(v.(int))) + } + } + + if d.HasChange("config") { + if v, ok := d.GetOk("config"); ok { + items := v.([]interface{}) + dMap := items[0].(map[string]interface{}) + configInfo := ckafka.ModifyInstanceAttributesConfig{} + if autoCreateTopicEnable, ok := dMap["auto_create_topic_enable"]; ok { + configInfo.AutoCreateTopicEnable = helper.Bool(autoCreateTopicEnable.(bool)) + } + if defaultNumPartitions, ok := dMap["default_num_partitions"]; ok { + configInfo.DefaultNumPartitions = helper.Int64(int64(defaultNumPartitions.(int))) + } + if defaultReplicationFactor, ok := dMap["default_replication_factor"]; ok { + configInfo.DefaultReplicationFactor = helper.Int64(int64(defaultReplicationFactor.(int))) + } + request.Config = &configInfo + } + } + + if d.HasChange("dynamic_retention_config") { + if v, ok := d.GetOk("dynamic_retention_config"); ok { + items := v.([]interface{}) + dMap := items[0].(map[string]interface{}) + dynamicInfo := ckafka.DynamicRetentionTime{} + if enable, ok := dMap["enable"]; ok { + dynamicInfo.Enable = helper.Int64(int64(enable.(int))) + } + if diskQuotaPercentage, ok := dMap["disk_quota_percentage"]; ok { + dynamicInfo.DiskQuotaPercentage = helper.Int64(int64(diskQuotaPercentage.(int))) + } + if stepForwardPercentage, ok := dMap["step_forward_percentage"]; ok { + dynamicInfo.StepForwardPercentage = helper.Int64(int64(stepForwardPercentage.(int))) + } + if bottomRetention, ok := dMap["bottom_retention"]; ok { + dynamicInfo.BottomRetention = helper.Int64(int64(bottomRetention.(int))) + } + request.DynamicRetentionConfig = &dynamicInfo + } + } + + if d.HasChange("rebalance_time") { + if v, ok := d.GetOk("rebalance_time"); ok { + request.RebalanceTime = helper.Int64(int64(v.(int))) + } + } + + if d.HasChange("public_network") { + if v, ok := d.GetOk("public_network"); ok { + request.PublicNetwork = helper.Int64(int64(v.(int))) + } + } + + error := service.ModifyCkafkaInstanceAttributes(ctx, request) + if error != nil { + return fmt.Errorf("[API]Set kafka instance attributes fail, reason:%s", error.Error()) + } + + return resourceTencentCloudCkafkaInstanceRead(d, meta) +} + +func resourceTencentCLoudCkafkaInstanceDelete(d *schema.ResourceData, meta interface{}) error { + defer logElapsed("resource.tencentcloud_ckafka_instance.delete")() + var ( + logId = getLogId(contextNil) + ctx = context.WithValue(context.TODO(), logIdKey, logId) + service = CkafkaService{ + client: meta.(*TencentCloudClient).apiV3Conn, + } + request = ckafka.NewDeleteInstancePreRequest() + ) + instanceId := d.Id() + request.InstanceId = &instanceId + _, err := service.client.UseCkafkaClient().DeleteInstancePre(request) + if err != nil { + return err + } + + err = resource.Retry(5*readRetryTimeout, func() *resource.RetryError { + has, _, err := service.CheckCkafkaInstanceReady(ctx, instanceId) + if err != nil { + return resource.NonRetryableError(err) + } + if !has { + return nil + } + return resource.RetryableError(fmt.Errorf("delete ckafka instance task is processing")) + }) + return nil +} diff --git a/tencentcloud/service_tencentcloud_ckafka.go b/tencentcloud/service_tencentcloud_ckafka.go index 245e3132ac..45014b57cc 100644 --- a/tencentcloud/service_tencentcloud_ckafka.go +++ b/tencentcloud/service_tencentcloud_ckafka.go @@ -18,6 +18,88 @@ type CkafkaService struct { client *connectivity.TencentCloudClient } +func (me *CkafkaService) CheckCkafkaInstanceReady(ctx context.Context, + instanceId string) (has bool, ready bool, errRet error) { + logId := getLogId(ctx) + var ( + request = ckafka.NewDescribeInstancesDetailRequest() + response = ckafka.NewDescribeInstancesDetailResponse() + info *ckafka.InstanceDetail + ) + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + request.InstanceId = &instanceId + if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, err := me.client.UseCkafkaClient().DescribeInstancesDetail(request) + if err != nil { + return retryError(err) + } + response = result + return nil + }); err != nil { + log.Printf("[CRITAL]%s read ckafka instance failed, reason: %v", logId, err) + return false, false, err + } + if len(response.Response.Result.InstanceList) < 1 { + return + } + has = true + info = response.Response.Result.InstanceList[0] + if *info.Status == 1 { + ready = true + } + return +} + +func (me *CkafkaService) ModifyCkafkaInstanceAttributes(ctx context.Context, + request *ckafka.ModifyInstanceAttributesRequest) (errRet error) { + logId := getLogId(ctx) + ratelimit.Check(request.GetAction()) + _, err := me.client.UseCkafkaClient().ModifyInstanceAttributes(request) + if err != nil { + return fmt.Errorf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]", logId, + request.GetAction(), request.ToJsonString(), err.Error()) + } + return +} + +func (me *CkafkaService) DescribeCkafkaInstanceById(ctx context.Context, + instanceId string) (info *ckafka.InstanceDetail, has bool, errRet error) { + logId := getLogId(ctx) + var ( + request = ckafka.NewDescribeInstancesDetailRequest() + response = ckafka.NewDescribeInstancesDetailResponse() + ) + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", + logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + request.InstanceId = &instanceId + if err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, err := me.client.UseCkafkaClient().DescribeInstancesDetail(request) + if err != nil { + return retryError(err) + } + response = result + return nil + }); err != nil { + log.Printf("[CRITAL]%s read ckafka instance failed, reason: %v", logId, err) + return nil, false, err + } + if len(response.Response.Result.InstanceList) < 1 { + return + } + has = true + info = response.Response.Result.InstanceList[0] + return +} + func (me *CkafkaService) CreateUser(ctx context.Context, instanceId, user, password string) (errRet error) { logId := getLogId(ctx) request := ckafka.NewCreateUserRequest() diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/client.go index 387c78537a..8d6e7b6fff 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/client.go @@ -34,7 +34,7 @@ func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, return } -func NewClient(credential *common.Credential, region string, clientProfile *profile.ClientProfile) (client *Client, err error) { +func NewClient(credential common.CredentialIface, region string, clientProfile *profile.ClientProfile) (client *Client, err error) { client = &Client{} client.Init(region). WithCredential(credential). @@ -43,11 +43,46 @@ func NewClient(credential *common.Credential, region string, clientProfile *prof } +func NewBatchCreateAclRequest() (request *BatchCreateAclRequest) { + request = &BatchCreateAclRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("ckafka", APIVersion, "BatchCreateAcl") + + + return +} + +func NewBatchCreateAclResponse() (response *BatchCreateAclResponse) { + response = &BatchCreateAclResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// BatchCreateAcl +// 批量添加ACL策略 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +func (c *Client) BatchCreateAcl(request *BatchCreateAclRequest) (response *BatchCreateAclResponse, err error) { + if request == nil { + request = NewBatchCreateAclRequest() + } + + response = NewBatchCreateAclResponse() + err = c.Send(request, response) + return +} + func NewCreateAclRequest() (request *CreateAclRequest) { request = &CreateAclRequest{ BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "CreateAcl") + + return } @@ -79,6 +114,7 @@ func (c *Client) CreateAcl(request *CreateAclRequest) (response *CreateAclRespon if request == nil { request = NewCreateAclRequest() } + response = NewCreateAclResponse() err = c.Send(request, response) return @@ -89,6 +125,8 @@ func NewCreateInstancePreRequest() (request *CreateInstancePreRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "CreateInstancePre") + + return } @@ -120,6 +158,7 @@ func (c *Client) CreateInstancePre(request *CreateInstancePreRequest) (response if request == nil { request = NewCreateInstancePreRequest() } + response = NewCreateInstancePreResponse() err = c.Send(request, response) return @@ -130,6 +169,8 @@ func NewCreatePartitionRequest() (request *CreatePartitionRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "CreatePartition") + + return } @@ -161,6 +202,7 @@ func (c *Client) CreatePartition(request *CreatePartitionRequest) (response *Cre if request == nil { request = NewCreatePartitionRequest() } + response = NewCreatePartitionResponse() err = c.Send(request, response) return @@ -171,6 +213,8 @@ func NewCreateTopicRequest() (request *CreateTopicRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "CreateTopic") + + return } @@ -202,6 +246,7 @@ func (c *Client) CreateTopic(request *CreateTopicRequest) (response *CreateTopic if request == nil { request = NewCreateTopicRequest() } + response = NewCreateTopicResponse() err = c.Send(request, response) return @@ -212,6 +257,8 @@ func NewCreateTopicIpWhiteListRequest() (request *CreateTopicIpWhiteListRequest) BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "CreateTopicIpWhiteList") + + return } @@ -243,6 +290,7 @@ func (c *Client) CreateTopicIpWhiteList(request *CreateTopicIpWhiteListRequest) if request == nil { request = NewCreateTopicIpWhiteListRequest() } + response = NewCreateTopicIpWhiteListResponse() err = c.Send(request, response) return @@ -253,6 +301,8 @@ func NewCreateUserRequest() (request *CreateUserRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "CreateUser") + + return } @@ -284,6 +334,7 @@ func (c *Client) CreateUser(request *CreateUserRequest) (response *CreateUserRes if request == nil { request = NewCreateUserRequest() } + response = NewCreateUserResponse() err = c.Send(request, response) return @@ -294,6 +345,8 @@ func NewDeleteAclRequest() (request *DeleteAclRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DeleteAcl") + + return } @@ -325,6 +378,7 @@ func (c *Client) DeleteAcl(request *DeleteAclRequest) (response *DeleteAclRespon if request == nil { request = NewDeleteAclRequest() } + response = NewDeleteAclResponse() err = c.Send(request, response) return @@ -335,6 +389,8 @@ func NewDeleteAclRuleRequest() (request *DeleteAclRuleRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DeleteAclRule") + + return } @@ -349,8 +405,10 @@ func NewDeleteAclRuleResponse() (response *DeleteAclRuleResponse) { // 删除ACL规则 // // 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" // INTERNALERROR = "InternalError" // INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" // INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist" // INVALIDPARAMETERVALUE_REPETITIONVALUE = "InvalidParameterValue.RepetitionValue" // INVALIDPARAMETERVALUE_SUBNETIDINVALID = "InvalidParameterValue.SubnetIdInvalid" @@ -366,16 +424,101 @@ func (c *Client) DeleteAclRule(request *DeleteAclRuleRequest) (response *DeleteA if request == nil { request = NewDeleteAclRuleRequest() } + response = NewDeleteAclRuleResponse() err = c.Send(request, response) return } +func NewDeleteInstancePreRequest() (request *DeleteInstancePreRequest) { + request = &DeleteInstancePreRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("ckafka", APIVersion, "DeleteInstancePre") + + + return +} + +func NewDeleteInstancePreResponse() (response *DeleteInstancePreResponse) { + response = &DeleteInstancePreResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DeleteInstancePre +// 删除预付费实例 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist" +// INVALIDPARAMETERVALUE_REPETITIONVALUE = "InvalidParameterValue.RepetitionValue" +// INVALIDPARAMETERVALUE_SUBNETIDINVALID = "InvalidParameterValue.SubnetIdInvalid" +// INVALIDPARAMETERVALUE_SUBNETNOTBELONGTOZONE = "InvalidParameterValue.SubnetNotBelongToZone" +// INVALIDPARAMETERVALUE_VPCIDINVALID = "InvalidParameterValue.VpcIdInvalid" +// INVALIDPARAMETERVALUE_WRONGACTION = "InvalidParameterValue.WrongAction" +// INVALIDPARAMETERVALUE_ZONENOTSUPPORT = "InvalidParameterValue.ZoneNotSupport" +// RESOURCEUNAVAILABLE = "ResourceUnavailable" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// UNSUPPORTEDOPERATION_BATCHDELINSTANCELIMIT = "UnsupportedOperation.BatchDelInstanceLimit" +// UNSUPPORTEDOPERATION_OSSREJECT = "UnsupportedOperation.OssReject" +func (c *Client) DeleteInstancePre(request *DeleteInstancePreRequest) (response *DeleteInstancePreResponse, err error) { + if request == nil { + request = NewDeleteInstancePreRequest() + } + + response = NewDeleteInstancePreResponse() + err = c.Send(request, response) + return +} + +func NewDeleteRouteTriggerTimeRequest() (request *DeleteRouteTriggerTimeRequest) { + request = &DeleteRouteTriggerTimeRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("ckafka", APIVersion, "DeleteRouteTriggerTime") + + + return +} + +func NewDeleteRouteTriggerTimeResponse() (response *DeleteRouteTriggerTimeResponse) { + response = &DeleteRouteTriggerTimeResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DeleteRouteTriggerTime +// 修改删除路由延迟触发时间 +// +// 可能返回的错误码: +// AUTHFAILURE = "AuthFailure" +// DRYRUNOPERATION = "DryRunOperation" +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +func (c *Client) DeleteRouteTriggerTime(request *DeleteRouteTriggerTimeRequest) (response *DeleteRouteTriggerTimeResponse, err error) { + if request == nil { + request = NewDeleteRouteTriggerTimeRequest() + } + + response = NewDeleteRouteTriggerTimeResponse() + err = c.Send(request, response) + return +} + func NewDeleteTopicRequest() (request *DeleteTopicRequest) { request = &DeleteTopicRequest{ BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DeleteTopic") + + return } @@ -399,6 +542,7 @@ func NewDeleteTopicResponse() (response *DeleteTopicResponse) { // INVALIDPARAMETERVALUE_VPCIDINVALID = "InvalidParameterValue.VpcIdInvalid" // INVALIDPARAMETERVALUE_WRONGACTION = "InvalidParameterValue.WrongAction" // INVALIDPARAMETERVALUE_ZONENOTSUPPORT = "InvalidParameterValue.ZoneNotSupport" +// RESOURCEINUSE = "ResourceInUse" // RESOURCEUNAVAILABLE = "ResourceUnavailable" // UNAUTHORIZEDOPERATION = "UnauthorizedOperation" // UNSUPPORTEDOPERATION_BATCHDELINSTANCELIMIT = "UnsupportedOperation.BatchDelInstanceLimit" @@ -407,6 +551,7 @@ func (c *Client) DeleteTopic(request *DeleteTopicRequest) (response *DeleteTopic if request == nil { request = NewDeleteTopicRequest() } + response = NewDeleteTopicResponse() err = c.Send(request, response) return @@ -417,6 +562,8 @@ func NewDeleteTopicIpWhiteListRequest() (request *DeleteTopicIpWhiteListRequest) BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DeleteTopicIpWhiteList") + + return } @@ -448,6 +595,7 @@ func (c *Client) DeleteTopicIpWhiteList(request *DeleteTopicIpWhiteListRequest) if request == nil { request = NewDeleteTopicIpWhiteListRequest() } + response = NewDeleteTopicIpWhiteListResponse() err = c.Send(request, response) return @@ -458,6 +606,8 @@ func NewDeleteUserRequest() (request *DeleteUserRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DeleteUser") + + return } @@ -489,6 +639,7 @@ func (c *Client) DeleteUser(request *DeleteUserRequest) (response *DeleteUserRes if request == nil { request = NewDeleteUserRequest() } + response = NewDeleteUserResponse() err = c.Send(request, response) return @@ -499,6 +650,8 @@ func NewDescribeACLRequest() (request *DescribeACLRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeACL") + + return } @@ -530,6 +683,7 @@ func (c *Client) DescribeACL(request *DescribeACLRequest) (response *DescribeACL if request == nil { request = NewDescribeACLRequest() } + response = NewDescribeACLResponse() err = c.Send(request, response) return @@ -540,6 +694,8 @@ func NewDescribeAppInfoRequest() (request *DescribeAppInfoRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeAppInfo") + + return } @@ -571,6 +727,7 @@ func (c *Client) DescribeAppInfo(request *DescribeAppInfoRequest) (response *Des if request == nil { request = NewDescribeAppInfoRequest() } + response = NewDescribeAppInfoResponse() err = c.Send(request, response) return @@ -581,6 +738,8 @@ func NewDescribeCkafkaZoneRequest() (request *DescribeCkafkaZoneRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeCkafkaZone") + + return } @@ -612,6 +771,7 @@ func (c *Client) DescribeCkafkaZone(request *DescribeCkafkaZoneRequest) (respons if request == nil { request = NewDescribeCkafkaZoneRequest() } + response = NewDescribeCkafkaZoneResponse() err = c.Send(request, response) return @@ -622,6 +782,8 @@ func NewDescribeConsumerGroupRequest() (request *DescribeConsumerGroupRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeConsumerGroup") + + return } @@ -653,6 +815,7 @@ func (c *Client) DescribeConsumerGroup(request *DescribeConsumerGroupRequest) (r if request == nil { request = NewDescribeConsumerGroupRequest() } + response = NewDescribeConsumerGroupResponse() err = c.Send(request, response) return @@ -663,6 +826,8 @@ func NewDescribeGroupRequest() (request *DescribeGroupRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeGroup") + + return } @@ -694,6 +859,7 @@ func (c *Client) DescribeGroup(request *DescribeGroupRequest) (response *Describ if request == nil { request = NewDescribeGroupRequest() } + response = NewDescribeGroupResponse() err = c.Send(request, response) return @@ -704,6 +870,8 @@ func NewDescribeGroupInfoRequest() (request *DescribeGroupInfoRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeGroupInfo") + + return } @@ -735,6 +903,7 @@ func (c *Client) DescribeGroupInfo(request *DescribeGroupInfoRequest) (response if request == nil { request = NewDescribeGroupInfoRequest() } + response = NewDescribeGroupInfoResponse() err = c.Send(request, response) return @@ -745,6 +914,8 @@ func NewDescribeGroupOffsetsRequest() (request *DescribeGroupOffsetsRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeGroupOffsets") + + return } @@ -776,6 +947,7 @@ func (c *Client) DescribeGroupOffsets(request *DescribeGroupOffsetsRequest) (res if request == nil { request = NewDescribeGroupOffsetsRequest() } + response = NewDescribeGroupOffsetsResponse() err = c.Send(request, response) return @@ -786,6 +958,8 @@ func NewDescribeInstanceAttributesRequest() (request *DescribeInstanceAttributes BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeInstanceAttributes") + + return } @@ -817,6 +991,7 @@ func (c *Client) DescribeInstanceAttributes(request *DescribeInstanceAttributesR if request == nil { request = NewDescribeInstanceAttributesRequest() } + response = NewDescribeInstanceAttributesResponse() err = c.Send(request, response) return @@ -827,6 +1002,8 @@ func NewDescribeInstancesRequest() (request *DescribeInstancesRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeInstances") + + return } @@ -854,6 +1031,7 @@ func (c *Client) DescribeInstances(request *DescribeInstancesRequest) (response if request == nil { request = NewDescribeInstancesRequest() } + response = NewDescribeInstancesResponse() err = c.Send(request, response) return @@ -864,6 +1042,8 @@ func NewDescribeInstancesDetailRequest() (request *DescribeInstancesDetailReques BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeInstancesDetail") + + return } @@ -895,6 +1075,7 @@ func (c *Client) DescribeInstancesDetail(request *DescribeInstancesDetailRequest if request == nil { request = NewDescribeInstancesDetailRequest() } + response = NewDescribeInstancesDetailResponse() err = c.Send(request, response) return @@ -905,6 +1086,8 @@ func NewDescribeRegionRequest() (request *DescribeRegionRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeRegion") + + return } @@ -936,6 +1119,7 @@ func (c *Client) DescribeRegion(request *DescribeRegionRequest) (response *Descr if request == nil { request = NewDescribeRegionRequest() } + response = NewDescribeRegionResponse() err = c.Send(request, response) return @@ -946,6 +1130,8 @@ func NewDescribeRouteRequest() (request *DescribeRouteRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeRoute") + + return } @@ -977,6 +1163,7 @@ func (c *Client) DescribeRoute(request *DescribeRouteRequest) (response *Describ if request == nil { request = NewDescribeRouteRequest() } + response = NewDescribeRouteResponse() err = c.Send(request, response) return @@ -987,6 +1174,8 @@ func NewDescribeTopicRequest() (request *DescribeTopicRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeTopic") + + return } @@ -1020,6 +1209,7 @@ func (c *Client) DescribeTopic(request *DescribeTopicRequest) (response *Describ if request == nil { request = NewDescribeTopicRequest() } + response = NewDescribeTopicResponse() err = c.Send(request, response) return @@ -1030,6 +1220,8 @@ func NewDescribeTopicAttributesRequest() (request *DescribeTopicAttributesReques BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeTopicAttributes") + + return } @@ -1061,6 +1253,7 @@ func (c *Client) DescribeTopicAttributes(request *DescribeTopicAttributesRequest if request == nil { request = NewDescribeTopicAttributesRequest() } + response = NewDescribeTopicAttributesResponse() err = c.Send(request, response) return @@ -1071,6 +1264,8 @@ func NewDescribeTopicDetailRequest() (request *DescribeTopicDetailRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeTopicDetail") + + return } @@ -1085,6 +1280,7 @@ func NewDescribeTopicDetailResponse() (response *DescribeTopicDetailResponse) { // 获取主题列表详情(仅控制台调用) // // 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" // INTERNALERROR = "InternalError" // INVALIDPARAMETER = "InvalidParameter" // INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist" @@ -1097,16 +1293,104 @@ func (c *Client) DescribeTopicDetail(request *DescribeTopicDetailRequest) (respo if request == nil { request = NewDescribeTopicDetailRequest() } + response = NewDescribeTopicDetailResponse() err = c.Send(request, response) return } +func NewDescribeTopicSubscribeGroupRequest() (request *DescribeTopicSubscribeGroupRequest) { + request = &DescribeTopicSubscribeGroupRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("ckafka", APIVersion, "DescribeTopicSubscribeGroup") + + + return +} + +func NewDescribeTopicSubscribeGroupResponse() (response *DescribeTopicSubscribeGroupResponse) { + response = &DescribeTopicSubscribeGroupResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeTopicSubscribeGroup +// 查询订阅某主题消息分组信息 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist" +// INVALIDPARAMETERVALUE_NOTALLOWEDEMPTY = "InvalidParameterValue.NotAllowedEmpty" +// INVALIDPARAMETERVALUE_REPETITIONVALUE = "InvalidParameterValue.RepetitionValue" +// INVALIDPARAMETERVALUE_SUBNETIDINVALID = "InvalidParameterValue.SubnetIdInvalid" +// INVALIDPARAMETERVALUE_SUBNETNOTBELONGTOZONE = "InvalidParameterValue.SubnetNotBelongToZone" +// INVALIDPARAMETERVALUE_VPCIDINVALID = "InvalidParameterValue.VpcIdInvalid" +// INVALIDPARAMETERVALUE_WRONGACTION = "InvalidParameterValue.WrongAction" +// INVALIDPARAMETERVALUE_ZONENOTSUPPORT = "InvalidParameterValue.ZoneNotSupport" +// OPERATIONDENIED = "OperationDenied" +// REQUESTLIMITEXCEEDED = "RequestLimitExceeded" +// UNAUTHORIZEDOPERATION = "UnauthorizedOperation" +// UNKNOWNPARAMETER = "UnknownParameter" +// UNSUPPORTEDOPERATION = "UnsupportedOperation" +// UNSUPPORTEDOPERATION_BATCHDELINSTANCELIMIT = "UnsupportedOperation.BatchDelInstanceLimit" +// UNSUPPORTEDOPERATION_OSSREJECT = "UnsupportedOperation.OssReject" +func (c *Client) DescribeTopicSubscribeGroup(request *DescribeTopicSubscribeGroupRequest) (response *DescribeTopicSubscribeGroupResponse, err error) { + if request == nil { + request = NewDescribeTopicSubscribeGroupRequest() + } + + response = NewDescribeTopicSubscribeGroupResponse() + err = c.Send(request, response) + return +} + +func NewDescribeTopicSyncReplicaRequest() (request *DescribeTopicSyncReplicaRequest) { + request = &DescribeTopicSyncReplicaRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("ckafka", APIVersion, "DescribeTopicSyncReplica") + + + return +} + +func NewDescribeTopicSyncReplicaResponse() (response *DescribeTopicSyncReplicaResponse) { + response = &DescribeTopicSyncReplicaResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// DescribeTopicSyncReplica +// 获取Topic 副本详情信息 +// +// 可能返回的错误码: +// INTERNALERROR = "InternalError" +// INVALIDPARAMETER = "InvalidParameter" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist" +func (c *Client) DescribeTopicSyncReplica(request *DescribeTopicSyncReplicaRequest) (response *DescribeTopicSyncReplicaResponse, err error) { + if request == nil { + request = NewDescribeTopicSyncReplicaRequest() + } + + response = NewDescribeTopicSyncReplicaResponse() + err = c.Send(request, response) + return +} + func NewDescribeUserRequest() (request *DescribeUserRequest) { request = &DescribeUserRequest{ BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "DescribeUser") + + return } @@ -1138,16 +1422,51 @@ func (c *Client) DescribeUser(request *DescribeUserRequest) (response *DescribeU if request == nil { request = NewDescribeUserRequest() } + response = NewDescribeUserResponse() err = c.Send(request, response) return } +func NewFetchMessageByOffsetRequest() (request *FetchMessageByOffsetRequest) { + request = &FetchMessageByOffsetRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + request.Init().WithApiInfo("ckafka", APIVersion, "FetchMessageByOffset") + + + return +} + +func NewFetchMessageByOffsetResponse() (response *FetchMessageByOffsetResponse) { + response = &FetchMessageByOffsetResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// FetchMessageByOffset +// 根据指定offset位置的消息 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +func (c *Client) FetchMessageByOffset(request *FetchMessageByOffsetRequest) (response *FetchMessageByOffsetResponse, err error) { + if request == nil { + request = NewFetchMessageByOffsetRequest() + } + + response = NewFetchMessageByOffsetResponse() + err = c.Send(request, response) + return +} + func NewModifyGroupOffsetsRequest() (request *ModifyGroupOffsetsRequest) { request = &ModifyGroupOffsetsRequest{ BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "ModifyGroupOffsets") + + return } @@ -1179,6 +1498,7 @@ func (c *Client) ModifyGroupOffsets(request *ModifyGroupOffsetsRequest) (respons if request == nil { request = NewModifyGroupOffsetsRequest() } + response = NewModifyGroupOffsetsResponse() err = c.Send(request, response) return @@ -1189,6 +1509,8 @@ func NewModifyInstanceAttributesRequest() (request *ModifyInstanceAttributesRequ BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "ModifyInstanceAttributes") + + return } @@ -1220,6 +1542,7 @@ func (c *Client) ModifyInstanceAttributes(request *ModifyInstanceAttributesReque if request == nil { request = NewModifyInstanceAttributesRequest() } + response = NewModifyInstanceAttributesResponse() err = c.Send(request, response) return @@ -1230,6 +1553,8 @@ func NewModifyPasswordRequest() (request *ModifyPasswordRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "ModifyPassword") + + return } @@ -1261,6 +1586,7 @@ func (c *Client) ModifyPassword(request *ModifyPasswordRequest) (response *Modif if request == nil { request = NewModifyPasswordRequest() } + response = NewModifyPasswordResponse() err = c.Send(request, response) return @@ -1271,6 +1597,8 @@ func NewModifyTopicAttributesRequest() (request *ModifyTopicAttributesRequest) { BaseRequest: &tchttp.BaseRequest{}, } request.Init().WithApiInfo("ckafka", APIVersion, "ModifyTopicAttributes") + + return } @@ -1302,6 +1630,7 @@ func (c *Client) ModifyTopicAttributes(request *ModifyTopicAttributesRequest) (r if request == nil { request = NewModifyTopicAttributesRequest() } + response = NewModifyTopicAttributesResponse() err = c.Send(request, response) return diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/errors.go index a70f18531c..8d86cced16 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/errors.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/errors.go @@ -17,12 +17,24 @@ package v20190819 const ( // 此产品的特有错误码 + // CAM签名/鉴权错误。 + AUTHFAILURE = "AuthFailure" + + // DryRun 操作,代表请求将会是成功的,只是多传了 DryRun 参数。 + DRYRUNOPERATION = "DryRunOperation" + + // 操作失败。 + FAILEDOPERATION = "FailedOperation" + // 内部错误。 INTERNALERROR = "InternalError" // 参数错误。 INVALIDPARAMETER = "InvalidParameter" + // 参数取值错误。 + INVALIDPARAMETERVALUE = "InvalidParameterValue" + // 实例不存在。 INVALIDPARAMETERVALUE_INSTANCENOTEXIST = "InvalidParameterValue.InstanceNotExist" @@ -47,12 +59,27 @@ const ( // zone不支持。 INVALIDPARAMETERVALUE_ZONENOTSUPPORT = "InvalidParameterValue.ZoneNotSupport" + // 操作被拒绝。 + OPERATIONDENIED = "OperationDenied" + + // 请求的次数超过了频率限制。 + REQUESTLIMITEXCEEDED = "RequestLimitExceeded" + + // 资源被占用。 + RESOURCEINUSE = "ResourceInUse" + // 资源不可用。 RESOURCEUNAVAILABLE = "ResourceUnavailable" // 未授权操作。 UNAUTHORIZEDOPERATION = "UnauthorizedOperation" + // 未知参数错误。 + UNKNOWNPARAMETER = "UnknownParameter" + + // 操作不支持。 + UNSUPPORTEDOPERATION = "UnsupportedOperation" + // 批量删除实例限制。 UNSUPPORTEDOPERATION_BATCHDELINSTANCELIMIT = "UnsupportedOperation.BatchDelInstanceLimit" diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/models.go index 3de347b4fb..c0e07b0621 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/models.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819/models.go @@ -53,6 +53,76 @@ type AclResponse struct { AclList []*Acl `json:"AclList,omitempty" name:"AclList"` } +type AclRule struct { + + // Acl规则名称 + // 注意:此字段可能返回 null,表示取不到有效值。 + RuleName *string `json:"RuleName,omitempty" name:"RuleName"` + + // 实例ID + // 注意:此字段可能返回 null,表示取不到有效值。 + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` + + // 匹配类型,目前只支持前缀匹配,枚举值列表:PREFIXED + // 注意:此字段可能返回 null,表示取不到有效值。 + PatternType *string `json:"PatternType,omitempty" name:"PatternType"` + + // 表示前缀匹配的前缀的值 + // 注意:此字段可能返回 null,表示取不到有效值。 + Pattern *string `json:"Pattern,omitempty" name:"Pattern"` + + // Acl资源类型,目前只支持Topic,枚举值列表:Topic + // 注意:此字段可能返回 null,表示取不到有效值。 + ResourceType *string `json:"ResourceType,omitempty" name:"ResourceType"` + + // 该规则所包含的ACL信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + AclList *string `json:"AclList,omitempty" name:"AclList"` + + // 规则所创建的时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + CreateTimeStamp *string `json:"CreateTimeStamp,omitempty" name:"CreateTimeStamp"` + + // 预设ACL规则是否应用到新增的topic中 + // 注意:此字段可能返回 null,表示取不到有效值。 + IsApplied *int64 `json:"IsApplied,omitempty" name:"IsApplied"` + + // 规则更新时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + UpdateTimeStamp *string `json:"UpdateTimeStamp,omitempty" name:"UpdateTimeStamp"` + + // 规则的备注 + // 注意:此字段可能返回 null,表示取不到有效值。 + Comment *string `json:"Comment,omitempty" name:"Comment"` + + // 其中一个显示的对应的TopicName + // 注意:此字段可能返回 null,表示取不到有效值。 + TopicName *string `json:"TopicName,omitempty" name:"TopicName"` + + // 应用该ACL规则的Topic数 + // 注意:此字段可能返回 null,表示取不到有效值。 + TopicCount *int64 `json:"TopicCount,omitempty" name:"TopicCount"` + + // patternType的中文显示 + // 注意:此字段可能返回 null,表示取不到有效值。 + PatternTypeTitle *string `json:"PatternTypeTitle,omitempty" name:"PatternTypeTitle"` +} + +type AclRuleInfo struct { + + // Acl操作方式,枚举值(所有操作: All, 读:Read,写:Write) + Operation *string `json:"Operation,omitempty" name:"Operation"` + + // 权限类型,(Deny,Allow) + PermissionType *string `json:"PermissionType,omitempty" name:"PermissionType"` + + // 默认为*,表示任何host都可以访问,当前ckafka不支持host为*和ip网段 + Host *string `json:"Host,omitempty" name:"Host"` + + // 用户列表,默认为User:*,表示任何user都可以访问,当前用户只能是用户列表中包含的用户。传入格式需要带【User:】前缀。例如用户A,传入为User:A。 + Principal *string `json:"Principal,omitempty" name:"Principal"` +} + type AppIdResponse struct { // 符合要求的所有AppId数量 @@ -73,6 +143,67 @@ type Assignment struct { Topics []*GroupInfoTopics `json:"Topics,omitempty" name:"Topics"` } +type BatchCreateAclRequest struct { + *tchttp.BaseRequest + + // 实例ID + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` + + // Acl资源类型,(2:TOPIC) + ResourceType *int64 `json:"ResourceType,omitempty" name:"ResourceType"` + + // 资源列表数组 + ResourceNames []*string `json:"ResourceNames,omitempty" name:"ResourceNames"` + + // 设置的ACL规则列表 + RuleList []*AclRuleInfo `json:"RuleList,omitempty" name:"RuleList"` +} + +func (r *BatchCreateAclRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *BatchCreateAclRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "InstanceId") + delete(f, "ResourceType") + delete(f, "ResourceNames") + delete(f, "RuleList") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "BatchCreateAclRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +type BatchCreateAclResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 状态码 + Result *int64 `json:"Result,omitempty" name:"Result"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *BatchCreateAclResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *BatchCreateAclResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type ClusterInfo struct { // 集群Id @@ -136,6 +267,10 @@ type Config struct { // 最大消息字节数 // 注意:此字段可能返回 null,表示取不到有效值。 MaxMessageBytes *int64 `json:"MaxMessageBytes,omitempty" name:"MaxMessageBytes"` + + // 消息保留文件大小 + // 注意:此字段可能返回 null,表示取不到有效值。 + RetentionBytes *int64 `json:"RetentionBytes,omitempty" name:"RetentionBytes"` } type ConsumerGroup struct { @@ -190,22 +325,46 @@ type ConsumerGroupTopic struct { TopicName *string `json:"TopicName,omitempty" name:"TopicName"` } +type ConsumerRecord struct { + + // 主题名 + Topic *string `json:"Topic,omitempty" name:"Topic"` + + // 分区id + Partition *int64 `json:"Partition,omitempty" name:"Partition"` + + // 位点 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` + + // 消息key + // 注意:此字段可能返回 null,表示取不到有效值。 + Key *string `json:"Key,omitempty" name:"Key"` + + // 消息value + // 注意:此字段可能返回 null,表示取不到有效值。 + Value *string `json:"Value,omitempty" name:"Value"` + + // 消息时间戳 + // 注意:此字段可能返回 null,表示取不到有效值。 + Timestamp *int64 `json:"Timestamp,omitempty" name:"Timestamp"` +} + type CreateAclRequest struct { *tchttp.BaseRequest // 实例id信息 InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` - // Acl资源类型,(0:UNKNOWN,1:ANY,2:TOPIC,3:GROUP,4:CLUSTER,5:TRANSACTIONAL_ID),当前只有TOPIC,其它字段用于后续兼容开源kafka的acl时使用 + // Acl资源类型,(2:TOPIC,3:GROUP,4:CLUSTER) ResourceType *int64 `json:"ResourceType,omitempty" name:"ResourceType"` - // Acl操作方式,(0:UNKNOWN,1:ANY,2:ALL,3:READ,4:WRITE,5:CREATE,6:DELETE,7:ALTER,8:DESCRIBE,9:CLUSTER_ACTION,10:DESCRIBE_CONFIGS,11:ALTER_CONFIGS) + // Acl操作方式,(2:ALL,3:READ,4:WRITE,5:CREATE,6:DELETE,7:ALTER,8:DESCRIBE,9:CLUSTER_ACTION,10:DESCRIBE_CONFIGS,11:ALTER_CONFIGS,12:IDEMPOTENT_WRITE) Operation *int64 `json:"Operation,omitempty" name:"Operation"` - // 权限类型,(0:UNKNOWN,1:ANY,2:DENY,3:ALLOW),当前ckakfa支持ALLOW(相当于白名单),其它用于后续兼容开源kafka的acl时使用 + // 权限类型,(2:DENY,3:ALLOW),当前ckakfa支持ALLOW(相当于白名单),其它用于后续兼容开源kafka的acl时使用 PermissionType *int64 `json:"PermissionType,omitempty" name:"PermissionType"` - // 资源名称,和resourceType相关,如当resourceType为TOPIC时,则该字段表示topic名称,当resourceType为GROUP时,该字段表示group名称 + // 资源名称,和resourceType相关,如当resourceType为TOPIC时,则该字段表示topic名称,当resourceType为GROUP时,该字段表示group名称,当resourceType为CLUSTER时,该字段可为空。 ResourceName *string `json:"ResourceName,omitempty" name:"ResourceName"` // 默认为\*,表示任何host都可以访问,当前ckafka不支持host为\*,但是后面开源kafka的产品化会直接支持 @@ -213,6 +372,9 @@ type CreateAclRequest struct { // 用户列表,默认为User:*,表示任何user都可以访问,当前用户只能是用户列表中包含的用户。传入时需要加 User: 前缀,如用户A则传入User:A。 Principal *string `json:"Principal,omitempty" name:"Principal"` + + // 资源名称列表,Json字符串格式。ResourceName和resourceNameList只能指定其中一个。 + ResourceNameList *string `json:"ResourceNameList,omitempty" name:"ResourceNameList"` } func (r *CreateAclRequest) ToJsonString() string { @@ -234,6 +396,7 @@ func (r *CreateAclRequest) FromJsonString(s string) error { delete(f, "ResourceName") delete(f, "Host") delete(f, "Principal") + delete(f, "ResourceNameList") if len(f) > 0 { return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateAclRequest has unknown keys!", "") } @@ -272,6 +435,10 @@ type CreateInstancePreData struct { // 订单号列表 // 注意:此字段可能返回 null,表示取不到有效值。 DealNames []*string `json:"DealNames,omitempty" name:"DealNames"` + + // 实例Id + // 注意:此字段可能返回 null,表示取不到有效值。 + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` } type CreateInstancePreRequest struct { @@ -286,7 +453,7 @@ type CreateInstancePreRequest struct { // 预付费购买时长,例如 "1m",就是一个月 Period *string `json:"Period,omitempty" name:"Period"` - // 实例规格,1:入门型 ,2: 标准型,3 :进阶型,4 :容量型,5: 高阶型1,6:高阶性2, 7: 高阶型3,8: 高阶型4, 9 :独占型。 + // 实例规格,专业版默认填写1。1:入门型 ,2: 标准型,3 :进阶型,4 :容量型,5: 高阶型1,6:高阶性2, 7: 高阶型3,8: 高阶型4, 9 :独占型。 InstanceType *int64 `json:"InstanceType,omitempty" name:"InstanceType"` // vpcId,不填默认基础网络 @@ -303,6 +470,27 @@ type CreateInstancePreRequest struct { // 预付费自动续费标记,0表示默认状态(用户未设置,即初始状态), 1表示自动续费,2表示明确不自动续费(用户设置) RenewFlag *int64 `json:"RenewFlag,omitempty" name:"RenewFlag"` + + // 支持指定版本Kafka版本(0.10.2/1.1.1/2.4.1) 。指定专业版参数specificationsType=pro + KafkaVersion *string `json:"KafkaVersion,omitempty" name:"KafkaVersion"` + + // 专业版必须填写 (专业版:profession、标准版:standard) 默认是standard。专业版填profession + SpecificationsType *string `json:"SpecificationsType,omitempty" name:"SpecificationsType"` + + // 磁盘大小,专业版不填写默认最小磁盘,填写后根据磁盘带宽分区数弹性计算 + DiskSize *int64 `json:"DiskSize,omitempty" name:"DiskSize"` + + // 带宽,专业版不填写默认最小带宽,填写后根据磁盘带宽分区数弹性计算 + BandWidth *int64 `json:"BandWidth,omitempty" name:"BandWidth"` + + // 分区大小,专业版不填写默认最小分区数,填写后根据磁盘带宽分区数弹性计算 + Partition *int64 `json:"Partition,omitempty" name:"Partition"` + + // 标签 + Tags []*Tag `json:"Tags,omitempty" name:"Tags"` + + // 磁盘类型(ssd填写CLOUD_SSD,sata填写CLOUD_BASIC) + DiskType *string `json:"DiskType,omitempty" name:"DiskType"` } func (r *CreateInstancePreRequest) ToJsonString() string { @@ -326,25 +514,45 @@ func (r *CreateInstancePreRequest) FromJsonString(s string) error { delete(f, "MsgRetentionTime") delete(f, "ClusterId") delete(f, "RenewFlag") + delete(f, "KafkaVersion") + delete(f, "SpecificationsType") + delete(f, "DiskSize") + delete(f, "BandWidth") + delete(f, "Partition") + delete(f, "Tags") + delete(f, "DiskType") if len(f) > 0 { return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateInstancePreRequest has unknown keys!", "") } return json.Unmarshal([]byte(s), &r) } +type CreateInstancePreResp struct { + + // 返回的code,0为正常,非0为错误 + ReturnCode *string `json:"ReturnCode,omitempty" name:"ReturnCode"` + + // 成功消息 + ReturnMessage *string `json:"ReturnMessage,omitempty" name:"ReturnMessage"` + + // 操作型返回的Data数据 + // 注意:此字段可能返回 null,表示取不到有效值。 + Data *CreateInstancePreData `json:"Data,omitempty" name:"Data"` + + // 删除是时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + DeleteRouteTimestamp *string `json:"DeleteRouteTimestamp,omitempty" name:"DeleteRouteTimestamp"` +} + type CreateInstancePreResponse struct { *tchttp.BaseResponse Response *struct { - // 返回的code,0为正常,非0为错误 - ReturnCode *string `json:"ReturnCode,omitempty" name:"ReturnCode"` - - // 成功消息 - ReturnMessage *string `json:"ReturnMessage,omitempty" name:"ReturnMessage"` + // 返回结果 + Result *CreateInstancePreResp `json:"Result,omitempty" name:"Result"` - // 操作型返回的Data数据 - // 注意:此字段可能返回 null,表示取不到有效值。 - Data *CreateInstancePreData `json:"Data,omitempty" name:"Data"` + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` } `json:"Response"` } @@ -479,7 +687,7 @@ type CreateTopicRequest struct { // 实例Id InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` - // 主题名称,是一个不超过 64 个字符的字符串,必须以字母为首字符,剩余部分可以包含字母、数字和横划线(-) + // 主题名称,是一个不超过 128 个字符的字符串,必须以字母为首字符,剩余部分可以包含字母、数字和横划线(-) TopicName *string `json:"TopicName,omitempty" name:"TopicName"` // Partition个数,大于0 @@ -511,6 +719,15 @@ type CreateTopicRequest struct { // Segment分片滚动的时长,单位ms,当前最小为3600000ms SegmentMs *int64 `json:"SegmentMs,omitempty" name:"SegmentMs"` + + // 预设ACL规则, 1:打开 0:关闭,默认不打开 + EnableAclRule *int64 `json:"EnableAclRule,omitempty" name:"EnableAclRule"` + + // 预设ACL规则的名称 + AclRuleName *string `json:"AclRuleName,omitempty" name:"AclRuleName"` + + // 可选, 保留文件大小. 默认为-1,单位bytes, 当前最小值为1048576B + RetentionBytes *int64 `json:"RetentionBytes,omitempty" name:"RetentionBytes"` } func (r *CreateTopicRequest) ToJsonString() string { @@ -537,6 +754,9 @@ func (r *CreateTopicRequest) FromJsonString(s string) error { delete(f, "UncleanLeaderElectionEnable") delete(f, "RetentionMs") delete(f, "SegmentMs") + delete(f, "EnableAclRule") + delete(f, "AclRuleName") + delete(f, "RetentionBytes") if len(f) > 0 { return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateTopicRequest has unknown keys!", "") } @@ -635,16 +855,16 @@ type DeleteAclRequest struct { // 实例id信息 InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` - // Acl资源类型,(0:UNKNOWN,1:ANY,2:TOPIC,3:GROUP,4:CLUSTER,5:TRANSACTIONAL_ID),当前只有TOPIC,其它字段用于后续兼容开源kafka的acl时使用 + // Acl资源类型,(2:TOPIC,3:GROUP,4:CLUSTER) ResourceType *int64 `json:"ResourceType,omitempty" name:"ResourceType"` - // 资源名称,和resourceType相关,如当resourceType为TOPIC时,则该字段表示topic名称,当resourceType为GROUP时,该字段表示group名称 + // 资源名称,和resourceType相关,如当resourceType为TOPIC时,则该字段表示topic名称,当resourceType为GROUP时,该字段表示group名称,当resourceType为CLUSTER时,该字段可为空。 ResourceName *string `json:"ResourceName,omitempty" name:"ResourceName"` - // Acl操作方式,(0:UNKNOWN,1:ANY,2:ALL,3:READ,4:WRITE,5:CREATE,6:DELETE,7:ALTER,8:DESCRIBE,9:CLUSTER_ACTION,10:DESCRIBE_CONFIGS,11:ALTER_CONFIGS,12:IDEMPOTEN_WRITE),当前ckafka只支持READ,WRITE,其它用于后续兼容开源kafka的acl时使用 + // Acl操作方式,(2:ALL,3:READ,4:WRITE,5:CREATE,6:DELETE,7:ALTER,8:DESCRIBE,9:CLUSTER_ACTION,10:DESCRIBE_CONFIGS,11:ALTER_CONFIGS,12:IDEMPOTENT_WRITE) Operation *int64 `json:"Operation,omitempty" name:"Operation"` - // 权限类型,(0:UNKNOWN,1:ANY,2:DENY,3:ALLOW),当前ckakfa支持ALLOW(相当于白名单),其它用于后续兼容开源kafka的acl时使用 + // 权限类型,(2:DENY,3:ALLOW),当前ckakfa支持ALLOW(相当于白名单),其它用于后续兼容开源kafka的acl时使用 PermissionType *int64 `json:"PermissionType,omitempty" name:"PermissionType"` // 默认为\*,表示任何host都可以访问,当前ckafka不支持host为\*,但是后面开源kafka的产品化会直接支持 @@ -755,6 +975,101 @@ func (r *DeleteAclRuleResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type DeleteInstancePreRequest struct { + *tchttp.BaseRequest + + // 实例id + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` +} + +func (r *DeleteInstancePreRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteInstancePreRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "InstanceId") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteInstancePreRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +type DeleteInstancePreResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 返回结果 + Result *CreateInstancePreResp `json:"Result,omitempty" name:"Result"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteInstancePreResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteInstancePreResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DeleteRouteTriggerTimeRequest struct { + *tchttp.BaseRequest + + // 修改时间 + DelayTime *string `json:"DelayTime,omitempty" name:"DelayTime"` +} + +func (r *DeleteRouteTriggerTimeRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteRouteTriggerTimeRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "DelayTime") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DeleteRouteTriggerTimeRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +type DeleteRouteTriggerTimeResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DeleteRouteTriggerTimeResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DeleteRouteTriggerTimeResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type DeleteTopicIpWhiteListRequest struct { *tchttp.BaseRequest @@ -924,10 +1239,10 @@ type DescribeACLRequest struct { // 实例Id InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` - // Acl资源类型,(0:UNKNOWN,1:ANY,2:TOPIC,3:GROUP,4:CLUSTER,5:TRANSACTIONAL_ID),当前只有TOPIC,其它字段用于后续兼容开源kafka的acl时使用 + // Acl资源类型,(2:TOPIC,3:GROUP,4:CLUSTER) ResourceType *int64 `json:"ResourceType,omitempty" name:"ResourceType"` - // 资源名称,和resourceType相关,如当resourceType为TOPIC时,则该字段表示topic名称,当resourceType为GROUP时,该字段表示group名称 + // 资源名称,和resourceType相关,如当resourceType为TOPIC时,则该字段表示topic名称,当resourceType为GROUP时,该字段表示group名称,当resourceType为CLUSTER时,该字段可为空。 ResourceName *string `json:"ResourceName,omitempty" name:"ResourceName"` // 偏移位置 @@ -1373,7 +1688,7 @@ type DescribeInstanceAttributesResponse struct { *tchttp.BaseResponse Response *struct { - // 实例属性返回结果对象 + // 实例属性返回结果对象。 Result *InstanceAttributesResponse `json:"Result,omitempty" name:"Result"` // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 @@ -1708,6 +2023,9 @@ type DescribeTopicDetailRequest struct { // 返回数量,不填则默认 10,最大值20,取值要大于0 Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // Acl预设策略名称 + AclRuleName *string `json:"AclRuleName,omitempty" name:"AclRuleName"` } func (r *DescribeTopicDetailRequest) ToJsonString() string { @@ -1726,6 +2044,7 @@ func (r *DescribeTopicDetailRequest) FromJsonString(s string) error { delete(f, "SearchWord") delete(f, "Offset") delete(f, "Limit") + delete(f, "AclRuleName") if len(f) > 0 { return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTopicDetailRequest has unknown keys!", "") } @@ -1769,6 +2088,9 @@ type DescribeTopicRequest struct { // 返回数量,不填则默认为10,最大值为50 Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // Acl预设策略名称 + AclRuleName *string `json:"AclRuleName,omitempty" name:"AclRuleName"` } func (r *DescribeTopicRequest) ToJsonString() string { @@ -1787,6 +2109,7 @@ func (r *DescribeTopicRequest) FromJsonString(s string) error { delete(f, "SearchWord") delete(f, "Offset") delete(f, "Limit") + delete(f, "AclRuleName") if len(f) > 0 { return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTopicRequest has unknown keys!", "") } @@ -1817,6 +2140,132 @@ func (r *DescribeTopicResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type DescribeTopicSubscribeGroupRequest struct { + *tchttp.BaseRequest + + // 实例Id + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` + + // 主题名称 + TopicName *string `json:"TopicName,omitempty" name:"TopicName"` + + // 分页时的起始位置 + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` + + // 分页时的个数 + Limit *uint64 `json:"Limit,omitempty" name:"Limit"` +} + +func (r *DescribeTopicSubscribeGroupRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTopicSubscribeGroupRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "InstanceId") + delete(f, "TopicName") + delete(f, "Offset") + delete(f, "Limit") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTopicSubscribeGroupRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +type DescribeTopicSubscribeGroupResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 返回结果 + Result *TopicSubscribeGroup `json:"Result,omitempty" name:"Result"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeTopicSubscribeGroupResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTopicSubscribeGroupResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + +type DescribeTopicSyncReplicaRequest struct { + *tchttp.BaseRequest + + // 实例ID + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` + + // 主题名称 + TopicName *string `json:"TopicName,omitempty" name:"TopicName"` + + // 偏移量,不填默认为0 + Offset *uint64 `json:"Offset,omitempty" name:"Offset"` + + // 返回数量,不填则默认10,最大值20。 + Limit *int64 `json:"Limit,omitempty" name:"Limit"` + + // 仅筛选未同步副本 + OutOfSyncReplicaOnly *bool `json:"OutOfSyncReplicaOnly,omitempty" name:"OutOfSyncReplicaOnly"` +} + +func (r *DescribeTopicSyncReplicaRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTopicSyncReplicaRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "InstanceId") + delete(f, "TopicName") + delete(f, "Offset") + delete(f, "Limit") + delete(f, "OutOfSyncReplicaOnly") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "DescribeTopicSyncReplicaRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +type DescribeTopicSyncReplicaResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 返回topic 副本详情 + Result *TopicInSyncReplicaResult `json:"Result,omitempty" name:"Result"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *DescribeTopicSyncReplicaResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *DescribeTopicSyncReplicaResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type DescribeUserRequest struct { *tchttp.BaseRequest @@ -1897,6 +2346,67 @@ type DynamicRetentionTime struct { BottomRetention *int64 `json:"BottomRetention,omitempty" name:"BottomRetention"` } +type FetchMessageByOffsetRequest struct { + *tchttp.BaseRequest + + // 实例Id + InstanceId *string `json:"InstanceId,omitempty" name:"InstanceId"` + + // 主题名 + Topic *string `json:"Topic,omitempty" name:"Topic"` + + // 分区id + Partition *int64 `json:"Partition,omitempty" name:"Partition"` + + // 位点信息 + Offset *int64 `json:"Offset,omitempty" name:"Offset"` +} + +func (r *FetchMessageByOffsetRequest) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *FetchMessageByOffsetRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "InstanceId") + delete(f, "Topic") + delete(f, "Partition") + delete(f, "Offset") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "FetchMessageByOffsetRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +type FetchMessageByOffsetResponse struct { + *tchttp.BaseResponse + Response *struct { + + // 返回结果 + Result *ConsumerRecord `json:"Result,omitempty" name:"Result"` + + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` + } `json:"Response"` +} + +func (r *FetchMessageByOffsetResponse) ToJsonString() string { + b, _ := json.Marshal(r) + return string(b) +} + +// FromJsonString It is highly **NOT** recommended to use this function +// because it has no param check, nor strict type check +func (r *FetchMessageByOffsetResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + type Filter struct { // 需要过滤的字段。 @@ -2129,6 +2639,18 @@ type InstanceAttributesResponse struct { // 动态消息保留策略 // 注意:此字段可能返回 null,表示取不到有效值。 RetentionTimeConfig *DynamicRetentionTime `json:"RetentionTimeConfig,omitempty" name:"RetentionTimeConfig"` + + // 最大连接数 + // 注意:此字段可能返回 null,表示取不到有效值。 + MaxConnection *uint64 `json:"MaxConnection,omitempty" name:"MaxConnection"` + + // 公网带宽 + // 注意:此字段可能返回 null,表示取不到有效值。 + PublicNetwork *int64 `json:"PublicNetwork,omitempty" name:"PublicNetwork"` + + // 时间 + // 注意:此字段可能返回 null,表示取不到有效值。 + DeleteRouteTimestamp *string `json:"DeleteRouteTimestamp,omitempty" name:"DeleteRouteTimestamp"` } type InstanceConfigDO struct { @@ -2377,6 +2899,9 @@ type ModifyInstanceAttributesRequest struct { // 修改升配置rebalance时间 RebalanceTime *int64 `json:"RebalanceTime,omitempty" name:"RebalanceTime"` + + // 时间戳 + PublicNetwork *int64 `json:"PublicNetwork,omitempty" name:"PublicNetwork"` } func (r *ModifyInstanceAttributesRequest) ToJsonString() string { @@ -2397,6 +2922,7 @@ func (r *ModifyInstanceAttributesRequest) FromJsonString(s string) error { delete(f, "Config") delete(f, "DynamicRetentionConfig") delete(f, "RebalanceTime") + delete(f, "PublicNetwork") if len(f) > 0 { return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyInstanceAttributesRequest has unknown keys!", "") } @@ -2519,6 +3045,18 @@ type ModifyTopicAttributesRequest struct { // 消息删除策略,可以选择delete 或者compact CleanUpPolicy *string `json:"CleanUpPolicy,omitempty" name:"CleanUpPolicy"` + + // Ip白名单列表,配额限制,enableWhileList=1时必选 + IpWhiteList []*string `json:"IpWhiteList,omitempty" name:"IpWhiteList"` + + // 预设ACL规则, 1:打开 0:关闭,默认不打开 + EnableAclRule *int64 `json:"EnableAclRule,omitempty" name:"EnableAclRule"` + + // 预设ACL规则的名称 + AclRuleName *string `json:"AclRuleName,omitempty" name:"AclRuleName"` + + // 可选, 保留文件大小. 默认为-1,单位bytes, 当前最小值为1048576B + RetentionBytes *int64 `json:"RetentionBytes,omitempty" name:"RetentionBytes"` } func (r *ModifyTopicAttributesRequest) ToJsonString() string { @@ -2543,6 +3081,10 @@ func (r *ModifyTopicAttributesRequest) FromJsonString(s string) error { delete(f, "SegmentMs") delete(f, "MaxMessageBytes") delete(f, "CleanUpPolicy") + delete(f, "IpWhiteList") + delete(f, "EnableAclRule") + delete(f, "AclRuleName") + delete(f, "RetentionBytes") if len(f) > 0 { return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "ModifyTopicAttributesRequest has unknown keys!", "") } @@ -2574,7 +3116,7 @@ func (r *ModifyTopicAttributesResponse) FromJsonString(s string) error { type OperateResponseData struct { - // FlowId + // FlowId11 // 注意:此字段可能返回 null,表示取不到有效值。 FlowId *int64 `json:"FlowId,omitempty" name:"FlowId"` } @@ -2649,7 +3191,7 @@ type Route struct { // 路由ID RouteId *int64 `json:"RouteId,omitempty" name:"RouteId"` - // vip网络类型(1:外网TGW 2:基础网络 3:VPC网络 4:腾讯云支持环境(一般用于内部实例) 5:SSL外网访问方式访问 6:黑石环境vpc) + // vip网络类型(1:外网TGW 2:基础网络 3:VPC网络 4:支撑网络(标准版) 5:SSL外网访问方式访问 6:黑石环境vpc 7:支撑网络(专业版)) VipType *int64 `json:"VipType,omitempty" name:"VipType"` // 虚拟IP列表 @@ -2662,6 +3204,10 @@ type Route struct { // 域名port // 注意:此字段可能返回 null,表示取不到有效值。 DomainPort *int64 `json:"DomainPort,omitempty" name:"DomainPort"` + + // 时间戳 + // 注意:此字段可能返回 null,表示取不到有效值。 + DeleteTimestamp *string `json:"DeleteTimestamp,omitempty" name:"DeleteTimestamp"` } type RouteResponse struct { @@ -2671,6 +3217,25 @@ type RouteResponse struct { Routers []*Route `json:"Routers,omitempty" name:"Routers"` } +type SaleInfo struct { + + // 手动设置的flag标志 + // 注意:此字段可能返回 null,表示取不到有效值。 + Flag *bool `json:"Flag,omitempty" name:"Flag"` + + // ckakfa版本号(1.1.1/2.4.2/0.10.2) + // 注意:此字段可能返回 null,表示取不到有效值。 + Version *string `json:"Version,omitempty" name:"Version"` + + // 专业版、标准版标志 + // 注意:此字段可能返回 null,表示取不到有效值。 + Platform *string `json:"Platform,omitempty" name:"Platform"` + + // 售罄标志:true售罄 + // 注意:此字段可能返回 null,表示取不到有效值。 + SoldOut *bool `json:"SoldOut,omitempty" name:"SoldOut"` +} + type SubscribedInfo struct { // 订阅的主题名 @@ -2737,6 +3302,14 @@ type TopicAttributesResponse struct { // 分区详情 Partitions []*TopicPartitionDO `json:"Partitions,omitempty" name:"Partitions"` + + // ACL预设策略开关,1:打开; 0:关闭 + // 注意:此字段可能返回 null,表示取不到有效值。 + EnableAclRule *int64 `json:"EnableAclRule,omitempty" name:"EnableAclRule"` + + // 预设策略列表 + // 注意:此字段可能返回 null,表示取不到有效值。 + AclRuleList []*AclRule `json:"AclRuleList,omitempty" name:"AclRuleList"` } type TopicDetail struct { @@ -2783,6 +3356,10 @@ type TopicDetail struct { // 消息保留时间配置(用于动态配置变更记录) // 注意:此字段可能返回 null,表示取不到有效值。 RetentionTimeConfig *TopicRetentionTimeConfigRsp `json:"RetentionTimeConfig,omitempty" name:"RetentionTimeConfig"` + + // 0:正常,1:已删除,2:删除中 + // 注意:此字段可能返回 null,表示取不到有效值。 + Status *int64 `json:"Status,omitempty" name:"Status"` } type TopicDetailResponse struct { @@ -2795,6 +3372,46 @@ type TopicDetailResponse struct { TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` } +type TopicInSyncReplicaInfo struct { + + // 分区名称 + Partition *string `json:"Partition,omitempty" name:"Partition"` + + // Leader Id + Leader *uint64 `json:"Leader,omitempty" name:"Leader"` + + // 副本集 + Replica *string `json:"Replica,omitempty" name:"Replica"` + + // ISR + InSyncReplica *string `json:"InSyncReplica,omitempty" name:"InSyncReplica"` + + // 起始Offset + // 注意:此字段可能返回 null,表示取不到有效值。 + BeginOffset *uint64 `json:"BeginOffset,omitempty" name:"BeginOffset"` + + // 末端Offset + // 注意:此字段可能返回 null,表示取不到有效值。 + EndOffset *uint64 `json:"EndOffset,omitempty" name:"EndOffset"` + + // 消息数 + // 注意:此字段可能返回 null,表示取不到有效值。 + MessageCount *uint64 `json:"MessageCount,omitempty" name:"MessageCount"` + + // 未同步副本集 + // 注意:此字段可能返回 null,表示取不到有效值。 + OutOfSyncReplica *string `json:"OutOfSyncReplica,omitempty" name:"OutOfSyncReplica"` +} + +type TopicInSyncReplicaResult struct { + + // Topic详情及副本合集 + TopicInSyncReplicaList []*TopicInSyncReplicaInfo `json:"TopicInSyncReplicaList,omitempty" name:"TopicInSyncReplicaList"` + + // 总计个数 + TotalCount *uint64 `json:"TotalCount,omitempty" name:"TotalCount"` +} + type TopicPartitionDO struct { // Partition ID @@ -2836,6 +3453,23 @@ type TopicRetentionTimeConfigRsp struct { ModTimeStamp *int64 `json:"ModTimeStamp,omitempty" name:"ModTimeStamp"` } +type TopicSubscribeGroup struct { + + // 总数 + TotalCount *int64 `json:"TotalCount,omitempty" name:"TotalCount"` + + // 消费分组状态数量信息 + StatusCountInfo *string `json:"StatusCountInfo,omitempty" name:"StatusCountInfo"` + + // 消费分组信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + GroupsInfo []*GroupInfoResponse `json:"GroupsInfo,omitempty" name:"GroupsInfo"` + + // 此次请求是否异步的状态。实例里分组较少的会直接返回结果,Status为1。当分组较多时,会异步更新缓存,Status为0时不会返回分组信息,直至Status为1更新完毕返回结果。 + // 注意:此字段可能返回 null,表示取不到有效值。 + Status *int64 `json:"Status,omitempty" name:"Status"` +} + type User struct { // 用户id @@ -2895,6 +3529,10 @@ type ZoneInfo struct { // json对象,key为机型,value true为售罄,false为未售罄 SoldOut *string `json:"SoldOut,omitempty" name:"SoldOut"` + + // 标准版售罄信息 + // 注意:此字段可能返回 null,表示取不到有效值。 + SalesInfo []*SaleInfo `json:"SalesInfo,omitempty" name:"SalesInfo"` } type ZoneResponse struct { diff --git a/vendor/modules.txt b/vendor/modules.txt index 1098503074..6a04b88d07 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -545,7 +545,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn/v20180606 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfs v1.0.199 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfs/v20190719 -# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.199 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.310 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka/v20190819 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.283 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317 diff --git a/website/docs/r/ckafka_instance.html.markdown b/website/docs/r/ckafka_instance.html.markdown new file mode 100644 index 0000000000..9726ab7bf9 --- /dev/null +++ b/website/docs/r/ckafka_instance.html.markdown @@ -0,0 +1,92 @@ +--- +subcategory: "Ckafka" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_ckafka_instance" +sidebar_current: "docs-tencentcloud-resource-ckafka_instance" +description: |- + Use this resource to create ckafka instance. +--- + +# tencentcloud_ckafka_instance + +Use this resource to create ckafka instance. + +## Example Usage + +```hcl +resource "tencentcloud_ckafka_instance" "foo" { + instance_name = "demo-hello" + zone_id = 100006 + period = 1 + vpc_id = "vpc-boi1ah65" + subnet_id = "subnet-7ros461e" + msg_retention_time = 1440 + + config { + auto_create_topic_enable = true + default_num_partitions = 3 + default_replication_factor = 3 + } + + dynamic_retention_config { + enable = 1 + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `instance_name` - (Required) Instance name. +* `period` - (Required, ForceNew) Prepaid purchase time, such as 1, is one month. +* `subnet_id` - (Required, ForceNew) Subnet id. +* `vpc_id` - (Required, ForceNew) Vpc id. +* `zone_id` - (Required, ForceNew) Available zone id. +* `band_width` - (Optional, ForceNew) Whether to open the ip whitelist, `true`: open, `false`: close. +* `config` - (Optional) Instance configuration. +* `disk_size` - (Optional, ForceNew) Disk Size. +* `disk_type` - (Optional, ForceNew) Type of disk. +* `dynamic_retention_config` - (Optional) Dynamic message retention policy configuration. +* `kafka_version` - (Optional, ForceNew) Kafka version (0.10.2/1.1.1/2.4.1). +* `msg_retention_time` - (Optional) The maximum retention time of instance logs, in minutes. the default is 10080 (7 days), the maximum is 30 days, and the default 0 is not filled, which means that the log retention time recovery policy is not enabled. +* `partition` - (Optional, ForceNew) Partition size, the professional version does not need set. +* `public_network` - (Optional) Timestamp. +* `rebalance_time` - (Optional) Modification of the rebalancing time after upgrade. +* `renew_flag` - (Optional, ForceNew) Prepaid automatic renewal mark, 0 means the default state, the initial state, 1 means automatic renewal, 2 means clear no automatic renewal (user setting). +* `tags` - (Optional, ForceNew) Partition size, the professional version does not need tag. + +The `config` object supports the following: + +* `auto_create_topic_enable` - (Required) Automatic creation. true: enabled, false: not enabled. +* `default_num_partitions` - (Required) If auto.create.topic.enable is set to true and this value is not set, 3 will be used by default. +* `default_replication_factor` - (Required) If auto.create.topic.enable is set to true but this value is not set, 2 will be used by default. + +The `dynamic_retention_config` object supports the following: + +* `bottom_retention` - (Optional) Minimum retention time, in minutes. +* `disk_quota_percentage` - (Optional) Disk quota threshold (in percentage) for triggering the message retention time change event. +* `enable` - (Optional) Whether the dynamic message retention time configuration is enabled. 0: disabled; 1: enabled. +* `step_forward_percentage` - (Optional) Percentage by which the message retention time is shortened each time. + +The `tags` object supports the following: + +* `key` - (Required) Tag key. +* `value` - (Required) Tag value. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + +## Import + +ckafka instance can be imported using the instance_id, e.g. + +``` +$ terraform import tencentcloud_ckafka_instance.foo ckafka-f9ife4zz +``` + diff --git a/website/tencentcloud.erb b/website/tencentcloud.erb index a5a3fd45c3..33c7afa288 100644 --- a/website/tencentcloud.erb +++ b/website/tencentcloud.erb @@ -269,6 +269,9 @@
  • tencentcloud_ckafka_acl
  • +
  • + tencentcloud_ckafka_instance +
  • tencentcloud_ckafka_topic