diff --git a/.changelog/2071.txt b/.changelog/2071.txt new file mode 100644 index 0000000000..9633a0ff17 --- /dev/null +++ b/.changelog/2071.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_scf_trigger_config: support new para, update api UpdateTrigger +``` \ No newline at end of file diff --git a/go.mod b/go.mod index 9e7881be3f..a28edee813 100644 --- a/go.mod +++ b/go.mod @@ -71,7 +71,7 @@ require ( github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.533 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.657 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum v1.0.542 - github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.664 + github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.729 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.529 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.486 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.689 diff --git a/go.sum b/go.sum index d072f58fc6..a7103e6f4d 100644 --- a/go.sum +++ b/go.sum @@ -922,6 +922,8 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum v1.0.542 h1:/U0rTVK github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum v1.0.542/go.mod h1:QF1J13hmuMY5gMrBopRFmHWFs/KsLr5uCNBRJt5aA1M= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.664 h1:57r4xDd0t9zQw8tLO9k13gYy/EYYGtFV3fMPx1BJinY= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.664/go.mod h1:dFFSCohvDzW2jidqjb5GFDhQD/2AfM1tZ8ijkuJUr9Y= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.729 h1:UWTpLpN3UngFNTuMosxSMCcmuoLksvuc9tt7ulCe0D8= +github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.729/go.mod h1:P5cLcaPdmOiRhv79OAvAKf+9JTg/64N7ZxwZHBW2mZA= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.529 h1:NezuBQEG7ihXbwueREo4qavBAo6ZcHuWGZt1dR+VdKc= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.529/go.mod h1:Xfmf4Rq4J2ukz6NoEwpADQS5ws3By3KDPemCQeeMF+M= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.486 h1:eHLaL+hl5X5f8Apuf2SGVclO3MRev/E3AfA/0aZQGUA= diff --git a/tencentcloud/resource_tc_scf_trigger_config.go b/tencentcloud/resource_tc_scf_trigger_config.go index aa6e60df4d..717cbe1f74 100644 --- a/tencentcloud/resource_tc_scf_trigger_config.go +++ b/tencentcloud/resource_tc_scf_trigger_config.go @@ -4,6 +4,7 @@ Provides a resource to create a scf trigger_config Example Usage ```hcl + resource "tencentcloud_scf_trigger_config" "trigger_config" { enable = "OPEN" function_name = "keep-1676351130" @@ -11,7 +12,11 @@ resource "tencentcloud_scf_trigger_config" "trigger_config" { type = "timer" qualifier = "$DEFAULT" namespace = "default" + trigger_desc = "* 1 2 * * * *" + description = "func" + custom_argument = "Information" } + ``` Import @@ -26,6 +31,7 @@ package tencentcloud import ( "context" + "encoding/json" "fmt" "log" "strings" @@ -48,26 +54,28 @@ func resourceTencentCloudScfTriggerConfig() *schema.Resource { Schema: map[string]*schema.Schema{ "function_name": { Required: true, + ForceNew: true, Type: schema.TypeString, Description: "Function name.", }, "trigger_name": { Required: true, + ForceNew: true, Type: schema.TypeString, - Description: "Trigger name.", + Description: "Trigger Name.", }, "type": { Required: true, Type: schema.TypeString, - Description: "Trigger Type.", + Description: "Trigger type.", }, "enable": { - Required: true, + Optional: true, Type: schema.TypeString, - Description: "Initial status of the trigger. Values: `OPEN` (enabled); `CLOSE` disabled).", + Description: "Status of trigger. Values: OPEN (enabled); CLOSE disabled).", }, "qualifier": { @@ -78,40 +86,100 @@ func resourceTencentCloudScfTriggerConfig() *schema.Resource { "namespace": { Optional: true, + ForceNew: true, Type: schema.TypeString, - Default: "default", Description: "Function namespace.", }, "trigger_desc": { Optional: true, - Computed: true, Type: schema.TypeString, - Description: "To update a COS trigger, this field is required. It stores the data {event:cos:ObjectCreated:*} in the JSON format. The data content of this field is in the same format as that of SetTrigger. This field is optional if a scheduled trigger or CMQ trigger is to be deleted.", + Description: "TriggerDesc parameter.", + }, + + "description": { + Optional: true, + Type: schema.TypeString, + Description: "Trigger description.", + }, + + "custom_argument": { + Optional: true, + Type: schema.TypeString, + Description: "User Additional Information.", }, }, } } +type TriggerDesc struct { + Cron string `json:"cron"` +} + func resourceTencentCloudScfTriggerConfigCreate(d *schema.ResourceData, meta interface{}) error { defer logElapsed("resource.tencentcloud_scf_trigger_config.create")() defer inconsistentCheck(d, meta)() + logId := getLogId(contextNil) + var ( + request = scf.NewUpdateTriggerRequest() functionName string triggerName string namespace string ) + if v, ok := d.GetOk("function_name"); ok { - functionName = v.(string) + request.FunctionName = helper.String(v.(string)) + functionName = *request.FunctionName + } + + if v, ok := d.GetOk("trigger_name"); ok { + request.TriggerName = helper.String(v.(string)) + triggerName = *request.TriggerName + } + + if v, ok := d.GetOk("type"); ok { + request.Type = helper.String(v.(string)) + } + + if v, ok := d.GetOk("enable"); ok { + request.Enable = helper.String(v.(string)) + } + + if v, ok := d.GetOk("qualifier"); ok { + request.Qualifier = helper.String(v.(string)) } if v, ok := d.GetOk("namespace"); ok { - namespace = v.(string) + request.Namespace = helper.String(v.(string)) + namespace = *request.Namespace } - if v, ok := d.GetOk("trigger_name"); ok { - triggerName = v.(string) + if v, ok := d.GetOk("trigger_desc"); ok { + request.TriggerDesc = helper.String(v.(string)) + } + + if v, ok := d.GetOk("description"); ok { + request.Description = helper.String(v.(string)) + } + + if v, ok := d.GetOk("custom_argument"); ok { + request.CustomArgument = helper.String(v.(string)) + } + + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { + result, e := meta.(*TencentCloudClient).apiV3Conn.UseScfClient().UpdateTrigger(request) + if e != nil { + return retryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s operate scf triggerConfig failed, reason:%+v", logId, err) + return err } d.SetId(functionName + FILED_SP + namespace + FILED_SP + triggerName) @@ -173,7 +241,20 @@ func resourceTencentCloudScfTriggerConfigRead(d *schema.ResourceData, meta inter } if triggerConfig.TriggerDesc != nil { - _ = d.Set("trigger_desc", triggerConfig.TriggerDesc) + var triggerDesc TriggerDesc + err := json.Unmarshal([]byte(*triggerConfig.TriggerDesc), &triggerDesc) + if err != nil { + return err + } + _ = d.Set("trigger_desc", triggerDesc.Cron) + } + + if triggerConfig.CustomArgument != nil { + _ = d.Set("custom_argument", triggerConfig.CustomArgument) + } + + if triggerConfig.CustomArgument != nil { + _ = d.Set("description", triggerConfig.Description) } return nil @@ -185,7 +266,7 @@ func resourceTencentCloudScfTriggerConfigUpdate(d *schema.ResourceData, meta int logId := getLogId(contextNil) - request := scf.NewUpdateTriggerStatusRequest() + request := scf.NewUpdateTriggerRequest() idSplit := strings.Split(d.Id(), FILED_SP) if len(idSplit) != 3 { @@ -199,14 +280,14 @@ func resourceTencentCloudScfTriggerConfigUpdate(d *schema.ResourceData, meta int request.Namespace = &namespace request.TriggerName = &triggerName - if v, ok := d.GetOk("enable"); ok { - request.Enable = helper.String(v.(string)) - } - if v, ok := d.GetOk("type"); ok { request.Type = helper.String(v.(string)) } + if v, ok := d.GetOk("enable"); ok { + request.Enable = helper.String(v.(string)) + } + if v, ok := d.GetOk("qualifier"); ok { request.Qualifier = helper.String(v.(string)) } @@ -215,8 +296,16 @@ func resourceTencentCloudScfTriggerConfigUpdate(d *schema.ResourceData, meta int request.TriggerDesc = helper.String(v.(string)) } + if v, ok := d.GetOk("description"); ok { + request.Description = helper.String(v.(string)) + } + + if v, ok := d.GetOk("custom_argument"); ok { + request.CustomArgument = helper.String(v.(string)) + } + err := resource.Retry(writeRetryTimeout, func() *resource.RetryError { - result, e := meta.(*TencentCloudClient).apiV3Conn.UseScfClient().UpdateTriggerStatus(request) + result, e := meta.(*TencentCloudClient).apiV3Conn.UseScfClient().UpdateTrigger(request) if e != nil { return retryError(e) } else { diff --git a/tencentcloud/resource_tc_scf_trigger_config_test.go b/tencentcloud/resource_tc_scf_trigger_config_test.go index 09d71b10a1..a1ededbe33 100644 --- a/tencentcloud/resource_tc_scf_trigger_config_test.go +++ b/tencentcloud/resource_tc_scf_trigger_config_test.go @@ -16,7 +16,16 @@ func TestAccTencentCloudScfTriggerConfigResource_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccScfTriggerConfig, - Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_scf_trigger_config.trigger_config", "id")), + Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_scf_trigger_config.trigger_config", "id"), + resource.ComposeTestCheckFunc(resource.TestCheckResourceAttr("tencentcloud_scf_trigger_config.trigger_config", "enable", "OPEN")), + resource.ComposeTestCheckFunc(resource.TestCheckResourceAttr("tencentcloud_scf_trigger_config.trigger_config", "function_name", "keep-1676351130")), + resource.ComposeTestCheckFunc(resource.TestCheckResourceAttr("tencentcloud_scf_trigger_config.trigger_config", "trigger_name", "SCF-timer-1685540160")), + resource.ComposeTestCheckFunc(resource.TestCheckResourceAttr("tencentcloud_scf_trigger_config.trigger_config", "type", "timer")), + resource.ComposeTestCheckFunc(resource.TestCheckResourceAttr("tencentcloud_scf_trigger_config.trigger_config", "qualifier", "$DEFAULT")), + resource.ComposeTestCheckFunc(resource.TestCheckResourceAttr("tencentcloud_scf_trigger_config.trigger_config", "namespace", "default")), + resource.ComposeTestCheckFunc(resource.TestCheckResourceAttr("tencentcloud_scf_trigger_config.trigger_config", "trigger_desc", "* 1 2 * * * *")), + resource.ComposeTestCheckFunc(resource.TestCheckResourceAttr("tencentcloud_scf_trigger_config.trigger_config", "description", "func")), + resource.ComposeTestCheckFunc(resource.TestCheckResourceAttr("tencentcloud_scf_trigger_config.trigger_config", "custom_argument", "Information"))), }, { ResourceName: "tencentcloud_scf_trigger_config.trigger_config", @@ -36,6 +45,9 @@ resource "tencentcloud_scf_trigger_config" "trigger_config" { type = "timer" qualifier = "$DEFAULT" namespace = "default" + trigger_desc = "* 1 2 * * * *" + description = "func" + custom_argument = "Information" } ` diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/client.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/client.go index f272bdc6ca..f74b52b73c 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/client.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/client.go @@ -100,6 +100,7 @@ func NewCopyFunctionResponse() (response *CopyFunctionResponse) { // RESOURCENOTFOUND_NAMESPACE = "ResourceNotFound.Namespace" // UNAUTHORIZEDOPERATION_CAM = "UnauthorizedOperation.CAM" // UNAUTHORIZEDOPERATION_REGION = "UnauthorizedOperation.Region" +// UNSUPPORTEDOPERATION_COPYFUNCTION = "UnsupportedOperation.CopyFunction" // UNSUPPORTEDOPERATION_REGION = "UnsupportedOperation.Region" func (c *Client) CopyFunction(request *CopyFunctionRequest) (response *CopyFunctionResponse, err error) { return c.CopyFunctionWithContext(context.Background(), request) @@ -142,6 +143,7 @@ func (c *Client) CopyFunction(request *CopyFunctionRequest) (response *CopyFunct // RESOURCENOTFOUND_NAMESPACE = "ResourceNotFound.Namespace" // UNAUTHORIZEDOPERATION_CAM = "UnauthorizedOperation.CAM" // UNAUTHORIZEDOPERATION_REGION = "UnauthorizedOperation.Region" +// UNSUPPORTEDOPERATION_COPYFUNCTION = "UnsupportedOperation.CopyFunction" // UNSUPPORTEDOPERATION_REGION = "UnsupportedOperation.Region" func (c *Client) CopyFunctionWithContext(ctx context.Context, request *CopyFunctionRequest) (response *CopyFunctionResponse, err error) { if request == nil { @@ -190,6 +192,7 @@ func NewCreateAliasResponse() (response *CreateAliasResponse) { // INVALIDPARAMETERVALUE_ADDITIONALVERSIONWEIGHTS = "InvalidParameterValue.AdditionalVersionWeights" // INVALIDPARAMETERVALUE_DESCRIPTION = "InvalidParameterValue.Description" // INVALIDPARAMETERVALUE_NAME = "InvalidParameterValue.Name" +// INVALIDPARAMETERVALUE_NAMESPACE = "InvalidParameterValue.Namespace" // INVALIDPARAMETERVALUE_ROUTINGCONFIG = "InvalidParameterValue.RoutingConfig" // LIMITEXCEEDED_ALIAS = "LimitExceeded.Alias" // RESOURCEINUSE = "ResourceInUse" @@ -215,6 +218,7 @@ func (c *Client) CreateAlias(request *CreateAliasRequest) (response *CreateAlias // INVALIDPARAMETERVALUE_ADDITIONALVERSIONWEIGHTS = "InvalidParameterValue.AdditionalVersionWeights" // INVALIDPARAMETERVALUE_DESCRIPTION = "InvalidParameterValue.Description" // INVALIDPARAMETERVALUE_NAME = "InvalidParameterValue.Name" +// INVALIDPARAMETERVALUE_NAMESPACE = "InvalidParameterValue.Namespace" // INVALIDPARAMETERVALUE_ROUTINGCONFIG = "InvalidParameterValue.RoutingConfig" // LIMITEXCEEDED_ALIAS = "LimitExceeded.Alias" // RESOURCEINUSE = "ResourceInUse" @@ -262,12 +266,14 @@ func NewCreateFunctionResponse() (response *CreateFunctionResponse) { // // 可能返回的错误码: // FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_ACCOUNTINSUFFICIENT = "FailedOperation.AccountInsufficient" // FAILEDOPERATION_APMCONFIGINSTANCEID = "FailedOperation.ApmConfigInstanceId" // FAILEDOPERATION_CALLNETDEPLOYFAILED = "FailedOperation.CallNetDeployFailed" // FAILEDOPERATION_CALLROLEFAILED = "FailedOperation.CallRoleFailed" // FAILEDOPERATION_CLSSERVICEUNREGISTERED = "FailedOperation.ClsServiceUnregistered" // FAILEDOPERATION_CREATEFUNCTION = "FailedOperation.CreateFunction" // FAILEDOPERATION_INSTANCENOTFOUND = "FailedOperation.InstanceNotFound" +// FAILEDOPERATION_INSUFFICIENTRESOURCES = "FailedOperation.InsufficientResources" // FAILEDOPERATION_NAMESPACE = "FailedOperation.Namespace" // FAILEDOPERATION_OPENSERVICE = "FailedOperation.OpenService" // FAILEDOPERATION_QCSROLENOTFOUND = "FailedOperation.QcsRoleNotFound" @@ -335,6 +341,7 @@ func NewCreateFunctionResponse() (response *CreateFunctionResponse) { // INVALIDPARAMETERVALUE_TEMPCOSOBJECTNAME = "InvalidParameterValue.TempCosObjectName" // INVALIDPARAMETERVALUE_TRACEENABLE = "InvalidParameterValue.TraceEnable" // INVALIDPARAMETERVALUE_TYPE = "InvalidParameterValue.Type" +// INVALIDPARAMETERVALUE_VPC = "InvalidParameterValue.Vpc" // INVALIDPARAMETERVALUE_VPCNOTSETWHENOPENCFS = "InvalidParameterValue.VpcNotSetWhenOpenCfs" // INVALIDPARAMETERVALUE_WEBSOCKETSPARAMS = "InvalidParameterValue.WebSocketsParams" // INVALIDPARAMETERVALUE_ZIPFILE = "InvalidParameterValue.ZipFile" @@ -384,12 +391,14 @@ func (c *Client) CreateFunction(request *CreateFunctionRequest) (response *Creat // // 可能返回的错误码: // FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_ACCOUNTINSUFFICIENT = "FailedOperation.AccountInsufficient" // FAILEDOPERATION_APMCONFIGINSTANCEID = "FailedOperation.ApmConfigInstanceId" // FAILEDOPERATION_CALLNETDEPLOYFAILED = "FailedOperation.CallNetDeployFailed" // FAILEDOPERATION_CALLROLEFAILED = "FailedOperation.CallRoleFailed" // FAILEDOPERATION_CLSSERVICEUNREGISTERED = "FailedOperation.ClsServiceUnregistered" // FAILEDOPERATION_CREATEFUNCTION = "FailedOperation.CreateFunction" // FAILEDOPERATION_INSTANCENOTFOUND = "FailedOperation.InstanceNotFound" +// FAILEDOPERATION_INSUFFICIENTRESOURCES = "FailedOperation.InsufficientResources" // FAILEDOPERATION_NAMESPACE = "FailedOperation.Namespace" // FAILEDOPERATION_OPENSERVICE = "FailedOperation.OpenService" // FAILEDOPERATION_QCSROLENOTFOUND = "FailedOperation.QcsRoleNotFound" @@ -457,6 +466,7 @@ func (c *Client) CreateFunction(request *CreateFunctionRequest) (response *Creat // INVALIDPARAMETERVALUE_TEMPCOSOBJECTNAME = "InvalidParameterValue.TempCosObjectName" // INVALIDPARAMETERVALUE_TRACEENABLE = "InvalidParameterValue.TraceEnable" // INVALIDPARAMETERVALUE_TYPE = "InvalidParameterValue.Type" +// INVALIDPARAMETERVALUE_VPC = "InvalidParameterValue.Vpc" // INVALIDPARAMETERVALUE_VPCNOTSETWHENOPENCFS = "InvalidParameterValue.VpcNotSetWhenOpenCfs" // INVALIDPARAMETERVALUE_WEBSOCKETSPARAMS = "InvalidParameterValue.WebSocketsParams" // INVALIDPARAMETERVALUE_ZIPFILE = "InvalidParameterValue.ZipFile" @@ -628,6 +638,7 @@ func NewCreateTriggerResponse() (response *CreateTriggerResponse) { // INVALIDPARAMETERVALUE_COS = "InvalidParameterValue.Cos" // INVALIDPARAMETERVALUE_COSNOTIFYRULECONFLICT = "InvalidParameterValue.CosNotifyRuleConflict" // INVALIDPARAMETERVALUE_CUSTOMARGUMENT = "InvalidParameterValue.CustomArgument" +// INVALIDPARAMETERVALUE_DESCRIPTION = "InvalidParameterValue.Description" // INVALIDPARAMETERVALUE_ENABLE = "InvalidParameterValue.Enable" // INVALIDPARAMETERVALUE_FUNCTIONNAME = "InvalidParameterValue.FunctionName" // INVALIDPARAMETERVALUE_SECRETINFO = "InvalidParameterValue.SecretInfo" @@ -689,6 +700,7 @@ func (c *Client) CreateTrigger(request *CreateTriggerRequest) (response *CreateT // INVALIDPARAMETERVALUE_COS = "InvalidParameterValue.Cos" // INVALIDPARAMETERVALUE_COSNOTIFYRULECONFLICT = "InvalidParameterValue.CosNotifyRuleConflict" // INVALIDPARAMETERVALUE_CUSTOMARGUMENT = "InvalidParameterValue.CustomArgument" +// INVALIDPARAMETERVALUE_DESCRIPTION = "InvalidParameterValue.Description" // INVALIDPARAMETERVALUE_ENABLE = "InvalidParameterValue.Enable" // INVALIDPARAMETERVALUE_FUNCTIONNAME = "InvalidParameterValue.FunctionName" // INVALIDPARAMETERVALUE_SECRETINFO = "InvalidParameterValue.SecretInfo" @@ -1677,6 +1689,7 @@ func NewGetFunctionLogsResponse() (response *GetFunctionLogsResponse) { // 可能返回的错误码: // FAILEDOPERATION = "FailedOperation" // FAILEDOPERATION_AUTHFAILURE = "FailedOperation.AuthFailure" +// FAILEDOPERATION_QUERYERROR = "FailedOperation.QueryError" // FAILEDOPERATION_TOPICNOTEXIST = "FailedOperation.TopicNotExist" // INTERNALERROR = "InternalError" // INTERNALERROR_ES = "InternalError.ES" @@ -1711,6 +1724,7 @@ func (c *Client) GetFunctionLogs(request *GetFunctionLogsRequest) (response *Get // 可能返回的错误码: // FAILEDOPERATION = "FailedOperation" // FAILEDOPERATION_AUTHFAILURE = "FailedOperation.AuthFailure" +// FAILEDOPERATION_QUERYERROR = "FailedOperation.QueryError" // FAILEDOPERATION_TOPICNOTEXIST = "FailedOperation.TopicNotExist" // INTERNALERROR = "InternalError" // INTERNALERROR_ES = "InternalError.ES" @@ -1909,6 +1923,7 @@ func NewGetRequestStatusResponse() (response *GetRequestStatusResponse) { // INVALIDPARAMETERVALUE_STARTTIME = "InvalidParameterValue.StartTime" // INVALIDPARAMETERVALUE_STARTTIMEORENDTIME = "InvalidParameterValue.StartTimeOrEndTime" // OPERATIONDENIED_ACCOUNTISOLATE = "OperationDenied.AccountIsolate" +// OPERATIONDENIED_ACCOUNTNOTEXISTS = "OperationDenied.AccountNotExists" // RESOURCENOTFOUND_FUNCTION = "ResourceNotFound.Function" // RESOURCENOTFOUND_FUNCTIONNAME = "ResourceNotFound.FunctionName" func (c *Client) GetRequestStatus(request *GetRequestStatusRequest) (response *GetRequestStatusResponse, err error) { @@ -1933,6 +1948,7 @@ func (c *Client) GetRequestStatus(request *GetRequestStatusRequest) (response *G // INVALIDPARAMETERVALUE_STARTTIME = "InvalidParameterValue.StartTime" // INVALIDPARAMETERVALUE_STARTTIMEORENDTIME = "InvalidParameterValue.StartTimeOrEndTime" // OPERATIONDENIED_ACCOUNTISOLATE = "OperationDenied.AccountIsolate" +// OPERATIONDENIED_ACCOUNTNOTEXISTS = "OperationDenied.AccountNotExists" // RESOURCENOTFOUND_FUNCTION = "ResourceNotFound.Function" // RESOURCENOTFOUND_FUNCTIONNAME = "ResourceNotFound.FunctionName" func (c *Client) GetRequestStatusWithContext(ctx context.Context, request *GetRequestStatusRequest) (response *GetRequestStatusResponse, err error) { @@ -2118,6 +2134,7 @@ func NewInvokeFunctionResponse() (response *InvokeFunctionResponse) { // RESOURCENOTFOUND_FUNCTIONNAME = "ResourceNotFound.FunctionName" // RESOURCENOTFOUND_QUALIFIER = "ResourceNotFound.Qualifier" // RESOURCEUNAVAILABLE_INSUFFICIENTBALANCE = "ResourceUnavailable.InsufficientBalance" +// RESOURCEUNAVAILABLE_SERVICESUSPENDED = "ResourceUnavailable.ServiceSuspended" // UNAUTHORIZEDOPERATION_CAM = "UnauthorizedOperation.CAM" func (c *Client) InvokeFunction(request *InvokeFunctionRequest) (response *InvokeFunctionResponse, err error) { return c.InvokeFunctionWithContext(context.Background(), request) @@ -2142,6 +2159,7 @@ func (c *Client) InvokeFunction(request *InvokeFunctionRequest) (response *Invok // RESOURCENOTFOUND_FUNCTIONNAME = "ResourceNotFound.FunctionName" // RESOURCENOTFOUND_QUALIFIER = "ResourceNotFound.Qualifier" // RESOURCEUNAVAILABLE_INSUFFICIENTBALANCE = "ResourceUnavailable.InsufficientBalance" +// RESOURCEUNAVAILABLE_SERVICESUSPENDED = "ResourceUnavailable.ServiceSuspended" // UNAUTHORIZEDOPERATION_CAM = "UnauthorizedOperation.CAM" func (c *Client) InvokeFunctionWithContext(ctx context.Context, request *InvokeFunctionRequest) (response *InvokeFunctionResponse, err error) { if request == nil { @@ -2772,6 +2790,7 @@ func NewPublishVersionResponse() (response *PublishVersionResponse) { // RESOURCENOTFOUND_NAMESPACE = "ResourceNotFound.Namespace" // UNAUTHORIZEDOPERATION_CAM = "UnauthorizedOperation.CAM" // UNSUPPORTEDOPERATION = "UnsupportedOperation" +// UNSUPPORTEDOPERATION_PUBLISHVERSION = "UnsupportedOperation.PublishVersion" func (c *Client) PublishVersion(request *PublishVersionRequest) (response *PublishVersionResponse, err error) { return c.PublishVersionWithContext(context.Background(), request) } @@ -2795,6 +2814,7 @@ func (c *Client) PublishVersion(request *PublishVersionRequest) (response *Publi // RESOURCENOTFOUND_NAMESPACE = "ResourceNotFound.Namespace" // UNAUTHORIZEDOPERATION_CAM = "UnauthorizedOperation.CAM" // UNSUPPORTEDOPERATION = "UnsupportedOperation" +// UNSUPPORTEDOPERATION_PUBLISHVERSION = "UnsupportedOperation.PublishVersion" func (c *Client) PublishVersionWithContext(ctx context.Context, request *PublishVersionRequest) (response *PublishVersionResponse, err error) { if request == nil { request = NewPublishVersionRequest() @@ -3102,6 +3122,7 @@ func NewTerminateAsyncEventResponse() (response *TerminateAsyncEventResponse) { // // 可能返回的错误码: // FAILEDOPERATION_ASYNCEVENTSTATUS = "FailedOperation.AsyncEventStatus" +// INVALIDPARAMETERVALUE_FUNCTIONNAME = "InvalidParameterValue.FunctionName" // RESOURCENOTFOUND_ASYNCEVENT = "ResourceNotFound.AsyncEvent" // RESOURCENOTFOUND_FUNCTION = "ResourceNotFound.Function" // RESOURCENOTFOUND_NAMESPACE = "ResourceNotFound.Namespace" @@ -3114,6 +3135,7 @@ func (c *Client) TerminateAsyncEvent(request *TerminateAsyncEventRequest) (respo // // 可能返回的错误码: // FAILEDOPERATION_ASYNCEVENTSTATUS = "FailedOperation.AsyncEventStatus" +// INVALIDPARAMETERVALUE_FUNCTIONNAME = "InvalidParameterValue.FunctionName" // RESOURCENOTFOUND_ASYNCEVENT = "ResourceNotFound.AsyncEvent" // RESOURCENOTFOUND_FUNCTION = "ResourceNotFound.Function" // RESOURCENOTFOUND_NAMESPACE = "ResourceNotFound.Namespace" @@ -3279,6 +3301,7 @@ func NewUpdateFunctionCodeResponse() (response *UpdateFunctionCodeResponse) { // UNAUTHORIZEDOPERATION_TEMPCOSAPPID = "UnauthorizedOperation.TempCosAppid" // UNAUTHORIZEDOPERATION_UPDATEFUNCTIONCODE = "UnauthorizedOperation.UpdateFunctionCode" // UNSUPPORTEDOPERATION = "UnsupportedOperation" +// UNSUPPORTEDOPERATION_UPDATEFUNCTIONCODE = "UnsupportedOperation.UpdateFunctionCode" func (c *Client) UpdateFunctionCode(request *UpdateFunctionCodeRequest) (response *UpdateFunctionCodeResponse, err error) { return c.UpdateFunctionCodeWithContext(context.Background(), request) } @@ -3331,6 +3354,7 @@ func (c *Client) UpdateFunctionCode(request *UpdateFunctionCodeRequest) (respons // UNAUTHORIZEDOPERATION_TEMPCOSAPPID = "UnauthorizedOperation.TempCosAppid" // UNAUTHORIZEDOPERATION_UPDATEFUNCTIONCODE = "UnauthorizedOperation.UpdateFunctionCode" // UNSUPPORTEDOPERATION = "UnsupportedOperation" +// UNSUPPORTEDOPERATION_UPDATEFUNCTIONCODE = "UnsupportedOperation.UpdateFunctionCode" func (c *Client) UpdateFunctionCodeWithContext(ctx context.Context, request *UpdateFunctionCodeRequest) (response *UpdateFunctionCodeResponse, err error) { if request == nil { request = NewUpdateFunctionCodeRequest() @@ -3370,11 +3394,13 @@ func NewUpdateFunctionConfigurationResponse() (response *UpdateFunctionConfigura // // 可能返回的错误码: // FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_ACCOUNTINSUFFICIENT = "FailedOperation.AccountInsufficient" // FAILEDOPERATION_APMCONFIGINSTANCEID = "FailedOperation.ApmConfigInstanceId" // FAILEDOPERATION_CLSSERVICEUNREGISTERED = "FailedOperation.ClsServiceUnregistered" // FAILEDOPERATION_DEBUGMODEUPDATETIMEOUTFAIL = "FailedOperation.DebugModeUpdateTimeOutFail" // FAILEDOPERATION_INSTANCENOTFOUND = "FailedOperation.InstanceNotFound" // FAILEDOPERATION_INSUFFICIENTBALANCE = "FailedOperation.InsufficientBalance" +// FAILEDOPERATION_INSUFFICIENTRESOURCES = "FailedOperation.InsufficientResources" // FAILEDOPERATION_OPENSERVICE = "FailedOperation.OpenService" // FAILEDOPERATION_QCSROLENOTFOUND = "FailedOperation.QcsRoleNotFound" // FAILEDOPERATION_RESERVEDINPROGRESS = "FailedOperation.ReservedInProgress" @@ -3406,6 +3432,7 @@ func NewUpdateFunctionConfigurationResponse() (response *UpdateFunctionConfigura // INVALIDPARAMETERVALUE_L5ENABLE = "InvalidParameterValue.L5Enable" // INVALIDPARAMETERVALUE_LAYERS = "InvalidParameterValue.Layers" // INVALIDPARAMETERVALUE_LIMITEXCEEDED = "InvalidParameterValue.LimitExceeded" +// INVALIDPARAMETERVALUE_LOGFORMAT = "InvalidParameterValue.LogFormat" // INVALIDPARAMETERVALUE_MAXCONCURRENCY = "InvalidParameterValue.MaxConcurrency" // INVALIDPARAMETERVALUE_MEMORY = "InvalidParameterValue.Memory" // INVALIDPARAMETERVALUE_MEMORYSIZE = "InvalidParameterValue.MemorySize" @@ -3416,6 +3443,7 @@ func NewUpdateFunctionConfigurationResponse() (response *UpdateFunctionConfigura // INVALIDPARAMETERVALUE_RUNTIME = "InvalidParameterValue.Runtime" // INVALIDPARAMETERVALUE_SYSTEMENVIRONMENT = "InvalidParameterValue.SystemEnvironment" // INVALIDPARAMETERVALUE_TRACEENABLE = "InvalidParameterValue.TraceEnable" +// INVALIDPARAMETERVALUE_VPC = "InvalidParameterValue.Vpc" // INVALIDPARAMETERVALUE_WEBSOCKETSPARAMS = "InvalidParameterValue.WebSocketsParams" // LIMITEXCEEDED_EIP = "LimitExceeded.Eip" // LIMITEXCEEDED_INITTIMEOUT = "LimitExceeded.InitTimeout" @@ -3423,6 +3451,7 @@ func NewUpdateFunctionConfigurationResponse() (response *UpdateFunctionConfigura // LIMITEXCEEDED_MEMORY = "LimitExceeded.Memory" // LIMITEXCEEDED_TIMEOUT = "LimitExceeded.Timeout" // RESOURCENOTFOUND_CFSPROTOCOLERROR = "ResourceNotFound.CfsProtocolError" +// RESOURCENOTFOUND_CFSSTATUSERROR = "ResourceNotFound.CfsStatusError" // RESOURCENOTFOUND_CFSVPCNOTMATCH = "ResourceNotFound.CfsVpcNotMatch" // RESOURCENOTFOUND_CMQ = "ResourceNotFound.Cmq" // RESOURCENOTFOUND_FUNCTION = "ResourceNotFound.Function" @@ -3447,11 +3476,13 @@ func (c *Client) UpdateFunctionConfiguration(request *UpdateFunctionConfiguratio // // 可能返回的错误码: // FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_ACCOUNTINSUFFICIENT = "FailedOperation.AccountInsufficient" // FAILEDOPERATION_APMCONFIGINSTANCEID = "FailedOperation.ApmConfigInstanceId" // FAILEDOPERATION_CLSSERVICEUNREGISTERED = "FailedOperation.ClsServiceUnregistered" // FAILEDOPERATION_DEBUGMODEUPDATETIMEOUTFAIL = "FailedOperation.DebugModeUpdateTimeOutFail" // FAILEDOPERATION_INSTANCENOTFOUND = "FailedOperation.InstanceNotFound" // FAILEDOPERATION_INSUFFICIENTBALANCE = "FailedOperation.InsufficientBalance" +// FAILEDOPERATION_INSUFFICIENTRESOURCES = "FailedOperation.InsufficientResources" // FAILEDOPERATION_OPENSERVICE = "FailedOperation.OpenService" // FAILEDOPERATION_QCSROLENOTFOUND = "FailedOperation.QcsRoleNotFound" // FAILEDOPERATION_RESERVEDINPROGRESS = "FailedOperation.ReservedInProgress" @@ -3483,6 +3514,7 @@ func (c *Client) UpdateFunctionConfiguration(request *UpdateFunctionConfiguratio // INVALIDPARAMETERVALUE_L5ENABLE = "InvalidParameterValue.L5Enable" // INVALIDPARAMETERVALUE_LAYERS = "InvalidParameterValue.Layers" // INVALIDPARAMETERVALUE_LIMITEXCEEDED = "InvalidParameterValue.LimitExceeded" +// INVALIDPARAMETERVALUE_LOGFORMAT = "InvalidParameterValue.LogFormat" // INVALIDPARAMETERVALUE_MAXCONCURRENCY = "InvalidParameterValue.MaxConcurrency" // INVALIDPARAMETERVALUE_MEMORY = "InvalidParameterValue.Memory" // INVALIDPARAMETERVALUE_MEMORYSIZE = "InvalidParameterValue.MemorySize" @@ -3493,6 +3525,7 @@ func (c *Client) UpdateFunctionConfiguration(request *UpdateFunctionConfiguratio // INVALIDPARAMETERVALUE_RUNTIME = "InvalidParameterValue.Runtime" // INVALIDPARAMETERVALUE_SYSTEMENVIRONMENT = "InvalidParameterValue.SystemEnvironment" // INVALIDPARAMETERVALUE_TRACEENABLE = "InvalidParameterValue.TraceEnable" +// INVALIDPARAMETERVALUE_VPC = "InvalidParameterValue.Vpc" // INVALIDPARAMETERVALUE_WEBSOCKETSPARAMS = "InvalidParameterValue.WebSocketsParams" // LIMITEXCEEDED_EIP = "LimitExceeded.Eip" // LIMITEXCEEDED_INITTIMEOUT = "LimitExceeded.InitTimeout" @@ -3500,6 +3533,7 @@ func (c *Client) UpdateFunctionConfiguration(request *UpdateFunctionConfiguratio // LIMITEXCEEDED_MEMORY = "LimitExceeded.Memory" // LIMITEXCEEDED_TIMEOUT = "LimitExceeded.Timeout" // RESOURCENOTFOUND_CFSPROTOCOLERROR = "ResourceNotFound.CfsProtocolError" +// RESOURCENOTFOUND_CFSSTATUSERROR = "ResourceNotFound.CfsStatusError" // RESOURCENOTFOUND_CFSVPCNOTMATCH = "ResourceNotFound.CfsVpcNotMatch" // RESOURCENOTFOUND_CMQ = "ResourceNotFound.Cmq" // RESOURCENOTFOUND_FUNCTION = "ResourceNotFound.Function" @@ -3667,6 +3701,148 @@ func (c *Client) UpdateNamespaceWithContext(ctx context.Context, request *Update return } +func NewUpdateTriggerRequest() (request *UpdateTriggerRequest) { + request = &UpdateTriggerRequest{ + BaseRequest: &tchttp.BaseRequest{}, + } + + request.Init().WithApiInfo("scf", APIVersion, "UpdateTrigger") + + + return +} + +func NewUpdateTriggerResponse() (response *UpdateTriggerResponse) { + response = &UpdateTriggerResponse{ + BaseResponse: &tchttp.BaseResponse{}, + } + return +} + +// UpdateTrigger +// 支持触发器配置更新。 +// +// 默认接口请求频率限制:20次/秒 +// +// +// +// 注意:目前只支持timer触发器和ckafka触发器更新! +// +// +// +// timer触发器和ckafka触发器支持更新字段有:Enable、TriggerDesc、Description、CustomArgument。 +// +// +// +// timer触发器TriggerDesc支持5段式和7段式的更新。 +// +// +// +// ckafka触发器TriggerDesc支持Retry、MaxMsgNum、TimeOut参数更新,不传值表示原值不变,传值不能为空。 +// +// +// +// Enable 触发器开启或关闭,传参为OPEN为开启,CLOSE为关闭。不传值表示原值不变,传值不能为空。 +// +// +// +// Description 触发器描述,不传值保持原值不变,传值为空则为空。 +// +// +// +// CustomArgument 触发器用户附加信息(注意:只有timer触发器展示),不传值保持原值不变,传值为空则为空。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_CREATETRIGGER = "FailedOperation.CreateTrigger" +// FAILEDOPERATION_UPDATETRIGGER = "FailedOperation.UpdateTrigger" +// INTERNALERROR_CMQ = "InternalError.Cmq" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// INVALIDPARAMETERVALUE_ACTION = "InvalidParameterValue.Action" +// INVALIDPARAMETERVALUE_ENABLE = "InvalidParameterValue.Enable" +// INVALIDPARAMETERVALUE_FUNCTIONNAME = "InvalidParameterValue.FunctionName" +// INVALIDPARAMETERVALUE_TRIGGERDESC = "InvalidParameterValue.TriggerDesc" +// INVALIDPARAMETERVALUE_TRIGGERNAME = "InvalidParameterValue.TriggerName" +// INVALIDPARAMETERVALUE_TYPE = "InvalidParameterValue.Type" +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCENOTFOUND_FUNCTION = "ResourceNotFound.Function" +// RESOURCENOTFOUND_FUNCTIONNAME = "ResourceNotFound.FunctionName" +// RESOURCENOTFOUND_NAMESPACE = "ResourceNotFound.Namespace" +// RESOURCENOTFOUND_QUALIFIER = "ResourceNotFound.Qualifier" +// RESOURCENOTFOUND_TRIGGER = "ResourceNotFound.Trigger" +// UNAUTHORIZEDOPERATION_CAM = "UnauthorizedOperation.CAM" +func (c *Client) UpdateTrigger(request *UpdateTriggerRequest) (response *UpdateTriggerResponse, err error) { + return c.UpdateTriggerWithContext(context.Background(), request) +} + +// UpdateTrigger +// 支持触发器配置更新。 +// +// 默认接口请求频率限制:20次/秒 +// +// +// +// 注意:目前只支持timer触发器和ckafka触发器更新! +// +// +// +// timer触发器和ckafka触发器支持更新字段有:Enable、TriggerDesc、Description、CustomArgument。 +// +// +// +// timer触发器TriggerDesc支持5段式和7段式的更新。 +// +// +// +// ckafka触发器TriggerDesc支持Retry、MaxMsgNum、TimeOut参数更新,不传值表示原值不变,传值不能为空。 +// +// +// +// Enable 触发器开启或关闭,传参为OPEN为开启,CLOSE为关闭。不传值表示原值不变,传值不能为空。 +// +// +// +// Description 触发器描述,不传值保持原值不变,传值为空则为空。 +// +// +// +// CustomArgument 触发器用户附加信息(注意:只有timer触发器展示),不传值保持原值不变,传值为空则为空。 +// +// 可能返回的错误码: +// FAILEDOPERATION = "FailedOperation" +// FAILEDOPERATION_CREATETRIGGER = "FailedOperation.CreateTrigger" +// FAILEDOPERATION_UPDATETRIGGER = "FailedOperation.UpdateTrigger" +// INTERNALERROR_CMQ = "InternalError.Cmq" +// INVALIDPARAMETERVALUE = "InvalidParameterValue" +// INVALIDPARAMETERVALUE_ACTION = "InvalidParameterValue.Action" +// INVALIDPARAMETERVALUE_ENABLE = "InvalidParameterValue.Enable" +// INVALIDPARAMETERVALUE_FUNCTIONNAME = "InvalidParameterValue.FunctionName" +// INVALIDPARAMETERVALUE_TRIGGERDESC = "InvalidParameterValue.TriggerDesc" +// INVALIDPARAMETERVALUE_TRIGGERNAME = "InvalidParameterValue.TriggerName" +// INVALIDPARAMETERVALUE_TYPE = "InvalidParameterValue.Type" +// RESOURCENOTFOUND = "ResourceNotFound" +// RESOURCENOTFOUND_FUNCTION = "ResourceNotFound.Function" +// RESOURCENOTFOUND_FUNCTIONNAME = "ResourceNotFound.FunctionName" +// RESOURCENOTFOUND_NAMESPACE = "ResourceNotFound.Namespace" +// RESOURCENOTFOUND_QUALIFIER = "ResourceNotFound.Qualifier" +// RESOURCENOTFOUND_TRIGGER = "ResourceNotFound.Trigger" +// UNAUTHORIZEDOPERATION_CAM = "UnauthorizedOperation.CAM" +func (c *Client) UpdateTriggerWithContext(ctx context.Context, request *UpdateTriggerRequest) (response *UpdateTriggerResponse, err error) { + if request == nil { + request = NewUpdateTriggerRequest() + } + + if c.GetCredential() == nil { + return nil, errors.New("UpdateTrigger require credential") + } + + request.SetContext(ctx) + + response = NewUpdateTriggerResponse() + err = c.Send(request, response) + return +} + func NewUpdateTriggerStatusRequest() (request *UpdateTriggerStatusRequest) { request = &UpdateTriggerStatusRequest{ BaseRequest: &tchttp.BaseRequest{}, diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/errors.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/errors.go index 9f9ce024f8..2d0d984e6a 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/errors.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/errors.go @@ -20,6 +20,9 @@ const ( // 操作失败。 FAILEDOPERATION = "FailedOperation" + // 账户余额不足。 + FAILEDOPERATION_ACCOUNTINSUFFICIENT = "FailedOperation.AccountInsufficient" + // API网关触发器创建失败。 FAILEDOPERATION_APIGATEWAY = "FailedOperation.ApiGateway" @@ -110,6 +113,9 @@ const ( // 当前账号或命名空间处于欠费状态,请在可用时重试。 FAILEDOPERATION_INSUFFICIENTBALANCE = "FailedOperation.InsufficientBalance" + // 本地域资源售罄。 + FAILEDOPERATION_INSUFFICIENTRESOURCES = "FailedOperation.InsufficientResources" + // 调用函数失败。 FAILEDOPERATION_INVOKEFUNCTION = "FailedOperation.InvokeFunction" @@ -146,6 +152,9 @@ const ( // 角色不存在。 FAILEDOPERATION_QCSROLENOTFOUND = "FailedOperation.QcsRoleNotFound" + // 查询失败。 + FAILEDOPERATION_QUERYERROR = "FailedOperation.QueryError" + // ReservedExceedTotal 总保留超限。 FAILEDOPERATION_RESERVEDEXCEEDTOTAL = "FailedOperation.ReservedExceedTotal" @@ -176,6 +185,9 @@ const ( // 更新状态操作失败。 FAILEDOPERATION_UPDATESTATUS = "FailedOperation.UpdateStatus" + // 更新触发器出错。 + FAILEDOPERATION_UPDATETRIGGER = "FailedOperation.UpdateTrigger" + // 与原状态一致,无需更改。 FAILEDOPERATION_UPDATETRIGGERSTATUS = "FailedOperation.UpdateTriggerStatus" @@ -443,6 +455,9 @@ const ( // 参数超出长度限制。 INVALIDPARAMETERVALUE_LIMITEXCEEDED = "InvalidParameterValue.LimitExceeded" + // 日志格式不正确。 + INVALIDPARAMETERVALUE_LOGFORMAT = "InvalidParameterValue.LogFormat" + // MaxConcurrency 参数传入错误。 INVALIDPARAMETERVALUE_MAXCONCURRENCY = "InvalidParameterValue.MaxConcurrency" @@ -569,6 +584,9 @@ const ( // Type传入错误。 INVALIDPARAMETERVALUE_TYPE = "InvalidParameterValue.Type" + // VPC不正确。 + INVALIDPARAMETERVALUE_VPC = "InvalidParameterValue.Vpc" + // 开启cfs配置的同时必须开启vpc。 INVALIDPARAMETERVALUE_VPCNOTSETWHENOPENCFS = "InvalidParameterValue.VpcNotSetWhenOpenCfs" @@ -677,6 +695,9 @@ const ( // 账号已被隔离。 OPERATIONDENIED_ACCOUNTISOLATE = "OperationDenied.AccountIsolate" + // 账号不存在。 + OPERATIONDENIED_ACCOUNTNOTEXISTS = "OperationDenied.AccountNotExists" + // 资源被占用。 RESOURCEINUSE = "ResourceInUse" @@ -809,6 +830,9 @@ const ( // Namespace不可用。 RESOURCEUNAVAILABLE_NAMESPACE = "ResourceUnavailable.Namespace" + // 服务已冻结。 + RESOURCEUNAVAILABLE_SERVICESUSPENDED = "ResourceUnavailable.ServiceSuspended" + // 未授权操作。 UNAUTHORIZEDOPERATION = "UnauthorizedOperation" @@ -857,6 +881,9 @@ const ( // Cdn不支持。 UNSUPPORTEDOPERATION_CDN = "UnsupportedOperation.Cdn" + // 该函数无法复制。 + UNSUPPORTEDOPERATION_COPYFUNCTION = "UnsupportedOperation.CopyFunction" + // Cos操作不支持。 UNSUPPORTEDOPERATION_COS = "UnsupportedOperation.Cos" @@ -866,12 +893,18 @@ const ( // 不支持的地域。 UNSUPPORTEDOPERATION_NOTSUPPORTREGION = "UnsupportedOperation.NotSupportRegion" + // 当前状态无法发布版本。 + UNSUPPORTEDOPERATION_PUBLISHVERSION = "UnsupportedOperation.PublishVersion" + // 不支持此地域。 UNSUPPORTEDOPERATION_REGION = "UnsupportedOperation.Region" // Trigger操作不支持。 UNSUPPORTEDOPERATION_TRIGGER = "UnsupportedOperation.Trigger" + // 更新函数代码失败。 + UNSUPPORTEDOPERATION_UPDATEFUNCTIONCODE = "UnsupportedOperation.UpdateFunctionCode" + // 指定的配置暂不支持,请修正后再试。 UNSUPPORTEDOPERATION_UPDATEFUNCTIONEVENTINVOKECONFIG = "UnsupportedOperation.UpdateFunctionEventInvokeConfig" diff --git a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/models.go b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/models.go index a558d9e4b6..9e0b0024cf 100644 --- a/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/models.go +++ b/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416/models.go @@ -403,7 +403,7 @@ type CreateFunctionRequestParams struct { // 函数的环境变量 Environment *Environment `json:"Environment,omitempty" name:"Environment"` - // 函数运行环境,目前仅支持 Python2.7,Python3.6,Nodejs6.10,Nodejs8.9,Nodejs10.15,Nodejs12.16, Php5, Php7,Go1,Java8 和 CustomRuntime,默认Python2.7 + // 函数运行环境,目前仅支持 Python2.7,Python3.6,Nodejs6.10,Nodejs8.9,Nodejs10.15,Nodejs12.16, Php5.2, Php7.4,Go1,Java8 和 CustomRuntime,默认Python2.7 Runtime *string `json:"Runtime,omitempty" name:"Runtime"` // 函数的私有网络配置 @@ -454,6 +454,12 @@ type CreateFunctionRequestParams struct { // 是否开启事件追踪,TRUE 为开启,FALSE为关闭 TraceEnable *string `json:"TraceEnable,omitempty" name:"TraceEnable"` + // 是否自动创建cls索引,TRUE 为开启,FALSE为关闭 + AutoDeployClsTopicIndex *string `json:"AutoDeployClsTopicIndex,omitempty" name:"AutoDeployClsTopicIndex"` + + // 是否自动创建cls主题,TRUE 为开启,FALSE为关闭 + AutoCreateClsTopic *string `json:"AutoCreateClsTopic,omitempty" name:"AutoCreateClsTopic"` + // HTTP函数支持的访问协议。当前支持WebSockets协议,值为WS ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` @@ -488,7 +494,7 @@ type CreateFunctionRequest struct { // 函数的环境变量 Environment *Environment `json:"Environment,omitempty" name:"Environment"` - // 函数运行环境,目前仅支持 Python2.7,Python3.6,Nodejs6.10,Nodejs8.9,Nodejs10.15,Nodejs12.16, Php5, Php7,Go1,Java8 和 CustomRuntime,默认Python2.7 + // 函数运行环境,目前仅支持 Python2.7,Python3.6,Nodejs6.10,Nodejs8.9,Nodejs10.15,Nodejs12.16, Php5.2, Php7.4,Go1,Java8 和 CustomRuntime,默认Python2.7 Runtime *string `json:"Runtime,omitempty" name:"Runtime"` // 函数的私有网络配置 @@ -539,6 +545,12 @@ type CreateFunctionRequest struct { // 是否开启事件追踪,TRUE 为开启,FALSE为关闭 TraceEnable *string `json:"TraceEnable,omitempty" name:"TraceEnable"` + // 是否自动创建cls索引,TRUE 为开启,FALSE为关闭 + AutoDeployClsTopicIndex *string `json:"AutoDeployClsTopicIndex,omitempty" name:"AutoDeployClsTopicIndex"` + + // 是否自动创建cls主题,TRUE 为开启,FALSE为关闭 + AutoCreateClsTopic *string `json:"AutoCreateClsTopic,omitempty" name:"AutoCreateClsTopic"` + // HTTP函数支持的访问协议。当前支持WebSockets协议,值为WS ProtocolType *string `json:"ProtocolType,omitempty" name:"ProtocolType"` @@ -585,6 +597,8 @@ func (r *CreateFunctionRequest) FromJsonString(s string) error { delete(f, "Tags") delete(f, "AsyncRunEnable") delete(f, "TraceEnable") + delete(f, "AutoDeployClsTopicIndex") + delete(f, "AutoCreateClsTopic") delete(f, "ProtocolType") delete(f, "ProtocolParams") delete(f, "InstanceConcurrencyConfig") @@ -623,6 +637,9 @@ type CreateNamespaceRequestParams struct { // 命名空间描述 Description *string `json:"Description,omitempty" name:"Description"` + + // 资源池配置 + ResourceEnv *NamespaceResourceEnv `json:"ResourceEnv,omitempty" name:"ResourceEnv"` } type CreateNamespaceRequest struct { @@ -633,6 +650,9 @@ type CreateNamespaceRequest struct { // 命名空间描述 Description *string `json:"Description,omitempty" name:"Description"` + + // 资源池配置 + ResourceEnv *NamespaceResourceEnv `json:"ResourceEnv,omitempty" name:"ResourceEnv"` } func (r *CreateNamespaceRequest) ToJsonString() string { @@ -649,6 +669,7 @@ func (r *CreateNamespaceRequest) FromJsonString(s string) error { } delete(f, "Namespace") delete(f, "Description") + delete(f, "ResourceEnv") if len(f) > 0 { return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "CreateNamespaceRequest has unknown keys!", "") } @@ -2690,6 +2711,35 @@ func (r *InvokeResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +type K8SLabel struct { + // label的名称 + Key *string `json:"Key,omitempty" name:"Key"` + + // label的值 + Value *string `json:"Value,omitempty" name:"Value"` +} + +type K8SToleration struct { + // 匹配的污点名 + Key *string `json:"Key,omitempty" name:"Key"` + + // 匹配方式,默认值为: Equal + // 注意:此字段可能返回 null,表示取不到有效值。 + Operator *string `json:"Operator,omitempty" name:"Operator"` + + // 执行策略 + // 注意:此字段可能返回 null,表示取不到有效值。 + Effect *string `json:"Effect,omitempty" name:"Effect"` + + // 匹配的污点值,当Operator为Equal时必填 + // 注意:此字段可能返回 null,表示取不到有效值。 + Value *string `json:"Value,omitempty" name:"Value"` + + // 当污点不被容忍时,Pod还能在节点上运行多久 + // 注意:此字段可能返回 null,表示取不到有效值。 + TolerationSeconds *uint64 `json:"TolerationSeconds,omitempty" name:"TolerationSeconds"` +} + type LayerVersionInfo struct { // 版本适用的运行时 // 注意:此字段可能返回 null,表示取不到有效值。 @@ -3591,6 +3641,46 @@ type NamespaceLimit struct { MaxMsgTTL *int64 `json:"MaxMsgTTL,omitempty" name:"MaxMsgTTL"` } +type NamespaceResourceEnv struct { + // 基于TKE集群的资源池 + // 注意:此字段可能返回 null,表示取不到有效值。 + TKE *NamespaceResourceEnvTKE `json:"TKE,omitempty" name:"TKE"` +} + +type NamespaceResourceEnvTKE struct { + // 集群ID + ClusterID *string `json:"ClusterID,omitempty" name:"ClusterID"` + + // 子网ID + SubnetID *string `json:"SubnetID,omitempty" name:"SubnetID"` + + // 命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // 数据存储地址 + // 注意:此字段可能返回 null,表示取不到有效值。 + DataPath *string `json:"DataPath,omitempty" name:"DataPath"` + + // node选择器 + // 注意:此字段可能返回 null,表示取不到有效值。 + NodeSelector []*K8SLabel `json:"NodeSelector,omitempty" name:"NodeSelector"` + + // 污点容忍 + // 注意:此字段可能返回 null,表示取不到有效值。 + Tolerations []*K8SToleration `json:"Tolerations,omitempty" name:"Tolerations"` + + // scf组件将占用的节点端口起始号 + // 注意:此字段可能返回 null,表示取不到有效值。 + Port *uint64 `json:"Port,omitempty" name:"Port"` + + // yaml格式的pod patch内容,例如 + // metadata: + // labels: + // key: value + // 注意:此字段可能返回 null,表示取不到有效值。 + PodTemplatePatch *string `json:"PodTemplatePatch,omitempty" name:"PodTemplatePatch"` +} + type NamespaceUsage struct { // 函数数组 Functions []*string `json:"Functions,omitempty" name:"Functions"` @@ -4261,12 +4351,18 @@ type Trigger struct { AvailableStatus *string `json:"AvailableStatus,omitempty" name:"AvailableStatus"` // 触发器最小资源ID + // + // Deprecated: ResourceId is deprecated. ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"` // 触发器和云函数绑定状态 + // + // Deprecated: BindStatus is deprecated. BindStatus *string `json:"BindStatus,omitempty" name:"BindStatus"` // 触发器类型,双向表示两侧控制台均可操作,单向表示SCF控制台单向创建 + // + // Deprecated: TriggerAttribute is deprecated. TriggerAttribute *string `json:"TriggerAttribute,omitempty" name:"TriggerAttribute"` // 触发器绑定的别名或版本 @@ -4363,12 +4459,18 @@ type TriggerInfo struct { ModTime *string `json:"ModTime,omitempty" name:"ModTime"` // 触发器最小资源ID + // + // Deprecated: ResourceId is deprecated. ResourceId *string `json:"ResourceId,omitempty" name:"ResourceId"` // 触发器和云函数绑定状态 + // + // Deprecated: BindStatus is deprecated. BindStatus *string `json:"BindStatus,omitempty" name:"BindStatus"` // 触发器类型,双向表示两侧控制台均可操作,单向表示SCF控制台单向创建 + // + // Deprecated: TriggerAttribute is deprecated. TriggerAttribute *string `json:"TriggerAttribute,omitempty" name:"TriggerAttribute"` // 客户自定义触发器描述 @@ -4921,6 +5023,116 @@ func (r *UpdateNamespaceResponse) FromJsonString(s string) error { return json.Unmarshal([]byte(s), &r) } +// Predefined struct for user +type UpdateTriggerRequestParams struct { + // 函数名称 + FunctionName *string `json:"FunctionName,omitempty" name:"FunctionName"` + + // 触发器名称 + TriggerName *string `json:"TriggerName,omitempty" name:"TriggerName"` + + // 触发器类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 触发器开启或关闭,传参为OPEN为开启,CLOSE为关闭 + Enable *string `json:"Enable,omitempty" name:"Enable"` + + // 函数的版本,默认为 $LATEST,建议填写 [$DEFAULT](https://cloud.tencent.com/document/product/583/36149#.E9.BB.98.E8.AE.A4.E5.88.AB.E5.90.8D)方便后续进行版本的灰度发布。 + Qualifier *string `json:"Qualifier,omitempty" name:"Qualifier"` + + // 函数的命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // TriggerDesc参数 + TriggerDesc *string `json:"TriggerDesc,omitempty" name:"TriggerDesc"` + + // 触发器描述 + Description *string `json:"Description,omitempty" name:"Description"` + + // 用户附加信息 + CustomArgument *string `json:"CustomArgument,omitempty" name:"CustomArgument"` +} + +type UpdateTriggerRequest struct { + *tchttp.BaseRequest + + // 函数名称 + FunctionName *string `json:"FunctionName,omitempty" name:"FunctionName"` + + // 触发器名称 + TriggerName *string `json:"TriggerName,omitempty" name:"TriggerName"` + + // 触发器类型 + Type *string `json:"Type,omitempty" name:"Type"` + + // 触发器开启或关闭,传参为OPEN为开启,CLOSE为关闭 + Enable *string `json:"Enable,omitempty" name:"Enable"` + + // 函数的版本,默认为 $LATEST,建议填写 [$DEFAULT](https://cloud.tencent.com/document/product/583/36149#.E9.BB.98.E8.AE.A4.E5.88.AB.E5.90.8D)方便后续进行版本的灰度发布。 + Qualifier *string `json:"Qualifier,omitempty" name:"Qualifier"` + + // 函数的命名空间 + Namespace *string `json:"Namespace,omitempty" name:"Namespace"` + + // TriggerDesc参数 + TriggerDesc *string `json:"TriggerDesc,omitempty" name:"TriggerDesc"` + + // 触发器描述 + Description *string `json:"Description,omitempty" name:"Description"` + + // 用户附加信息 + CustomArgument *string `json:"CustomArgument,omitempty" name:"CustomArgument"` +} + +func (r *UpdateTriggerRequest) 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 *UpdateTriggerRequest) FromJsonString(s string) error { + f := make(map[string]interface{}) + if err := json.Unmarshal([]byte(s), &f); err != nil { + return err + } + delete(f, "FunctionName") + delete(f, "TriggerName") + delete(f, "Type") + delete(f, "Enable") + delete(f, "Qualifier") + delete(f, "Namespace") + delete(f, "TriggerDesc") + delete(f, "Description") + delete(f, "CustomArgument") + if len(f) > 0 { + return tcerr.NewTencentCloudSDKError("ClientError.BuildRequestError", "UpdateTriggerRequest has unknown keys!", "") + } + return json.Unmarshal([]byte(s), &r) +} + +// Predefined struct for user +type UpdateTriggerResponseParams struct { + // 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 + RequestId *string `json:"RequestId,omitempty" name:"RequestId"` +} + +type UpdateTriggerResponse struct { + *tchttp.BaseResponse + Response *UpdateTriggerResponseParams `json:"Response"` +} + +func (r *UpdateTriggerResponse) 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 *UpdateTriggerResponse) FromJsonString(s string) error { + return json.Unmarshal([]byte(s), &r) +} + // Predefined struct for user type UpdateTriggerStatusRequestParams struct { // 触发器的初始是能状态OPEN表示开启 CLOSE表示关闭 diff --git a/vendor/modules.txt b/vendor/modules.txt index 29b59d41b1..a77521cd7b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1185,7 +1185,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum v1.0.542 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum/v20210622 -# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.664 +# github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.729 ## explicit; go 1.14 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416 # github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.529 diff --git a/website/docs/r/scf_trigger_config.html.markdown b/website/docs/r/scf_trigger_config.html.markdown index 7accff2dd6..4d164a8f6f 100644 --- a/website/docs/r/scf_trigger_config.html.markdown +++ b/website/docs/r/scf_trigger_config.html.markdown @@ -15,12 +15,15 @@ Provides a resource to create a scf trigger_config ```hcl resource "tencentcloud_scf_trigger_config" "trigger_config" { - enable = "OPEN" - function_name = "keep-1676351130" - trigger_name = "SCF-timer-1685540160" - type = "timer" - qualifier = "$DEFAULT" - namespace = "default" + enable = "OPEN" + function_name = "keep-1676351130" + trigger_name = "SCF-timer-1685540160" + type = "timer" + qualifier = "$DEFAULT" + namespace = "default" + trigger_desc = "* 1 2 * * * *" + description = "func" + custom_argument = "Information" } ``` @@ -28,13 +31,15 @@ resource "tencentcloud_scf_trigger_config" "trigger_config" { The following arguments are supported: -* `enable` - (Required, String) Initial status of the trigger. Values: `OPEN` (enabled); `CLOSE` disabled). -* `function_name` - (Required, String) Function name. -* `trigger_name` - (Required, String) Trigger name. -* `type` - (Required, String) Trigger Type. -* `namespace` - (Optional, String) Function namespace. +* `function_name` - (Required, String, ForceNew) Function name. +* `trigger_name` - (Required, String, ForceNew) Trigger Name. +* `type` - (Required, String) Trigger type. +* `custom_argument` - (Optional, String) User Additional Information. +* `description` - (Optional, String) Trigger description. +* `enable` - (Optional, String) Status of trigger. Values: OPEN (enabled); CLOSE disabled). +* `namespace` - (Optional, String, ForceNew) Function namespace. * `qualifier` - (Optional, String) Function version. It defaults to `$LATEST`. It's recommended to use `[$DEFAULT](https://intl.cloud.tencent.com/document/product/583/36149?from_cn_redirect=1#.E9.BB.98.E8.AE.A4.E5.88.AB.E5.90.8D)` for canary release. -* `trigger_desc` - (Optional, String) To update a COS trigger, this field is required. It stores the data {event:cos:ObjectCreated:*} in the JSON format. The data content of this field is in the same format as that of SetTrigger. This field is optional if a scheduled trigger or CMQ trigger is to be deleted. +* `trigger_desc` - (Optional, String) TriggerDesc parameter. ## Attributes Reference