1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package iot 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/iot/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12 "time" 13) 14 15// Updates a Device Defender security profile. 16func (c *Client) UpdateSecurityProfile(ctx context.Context, params *UpdateSecurityProfileInput, optFns ...func(*Options)) (*UpdateSecurityProfileOutput, error) { 17 if params == nil { 18 params = &UpdateSecurityProfileInput{} 19 } 20 21 result, metadata, err := c.invokeOperation(ctx, "UpdateSecurityProfile", params, optFns, addOperationUpdateSecurityProfileMiddlewares) 22 if err != nil { 23 return nil, err 24 } 25 26 out := result.(*UpdateSecurityProfileOutput) 27 out.ResultMetadata = metadata 28 return out, nil 29} 30 31type UpdateSecurityProfileInput struct { 32 33 // The name of the security profile you want to update. 34 // 35 // This member is required. 36 SecurityProfileName *string 37 38 // Please use UpdateSecurityProfileRequest$additionalMetricsToRetainV2 instead. A 39 // list of metrics whose data is retained (stored). By default, data is retained 40 // for any metric used in the profile's behaviors, but it is also retained for any 41 // metric specified here. Can be used with custom metrics; cannot be used with 42 // dimensions. 43 // 44 // Deprecated: Use additionalMetricsToRetainV2. 45 AdditionalMetricsToRetain []string 46 47 // A list of metrics whose data is retained (stored). By default, data is retained 48 // for any metric used in the profile's behaviors, but it is also retained for any 49 // metric specified here. Can be used with custom metrics; cannot be used with 50 // dimensions. 51 AdditionalMetricsToRetainV2 []types.MetricToRetain 52 53 // Where the alerts are sent. (Alerts are always sent to the console.) 54 AlertTargets map[string]types.AlertTarget 55 56 // Specifies the behaviors that, when violated by a device (thing), cause an alert. 57 Behaviors []types.Behavior 58 59 // If true, delete all additionalMetricsToRetain defined for this security profile. 60 // If any additionalMetricsToRetain are defined in the current invocation, an 61 // exception occurs. 62 DeleteAdditionalMetricsToRetain bool 63 64 // If true, delete all alertTargets defined for this security profile. If any 65 // alertTargets are defined in the current invocation, an exception occurs. 66 DeleteAlertTargets bool 67 68 // If true, delete all behaviors defined for this security profile. If any 69 // behaviors are defined in the current invocation, an exception occurs. 70 DeleteBehaviors bool 71 72 // The expected version of the security profile. A new version is generated 73 // whenever the security profile is updated. If you specify a value that is 74 // different from the actual version, a VersionConflictException is thrown. 75 ExpectedVersion *int64 76 77 // A description of the security profile. 78 SecurityProfileDescription *string 79} 80 81type UpdateSecurityProfileOutput struct { 82 83 // Please use UpdateSecurityProfileResponse$additionalMetricsToRetainV2 instead. A 84 // list of metrics whose data is retained (stored). By default, data is retained 85 // for any metric used in the security profile's behaviors, but it is also retained 86 // for any metric specified here. 87 // 88 // Deprecated: Use additionalMetricsToRetainV2. 89 AdditionalMetricsToRetain []string 90 91 // A list of metrics whose data is retained (stored). By default, data is retained 92 // for any metric used in the profile's behaviors, but it is also retained for any 93 // metric specified here. Can be used with custom metrics; cannot be used with 94 // dimensions. 95 AdditionalMetricsToRetainV2 []types.MetricToRetain 96 97 // Where the alerts are sent. (Alerts are always sent to the console.) 98 AlertTargets map[string]types.AlertTarget 99 100 // Specifies the behaviors that, when violated by a device (thing), cause an alert. 101 Behaviors []types.Behavior 102 103 // The time the security profile was created. 104 CreationDate *time.Time 105 106 // The time the security profile was last modified. 107 LastModifiedDate *time.Time 108 109 // The ARN of the security profile that was updated. 110 SecurityProfileArn *string 111 112 // The description of the security profile. 113 SecurityProfileDescription *string 114 115 // The name of the security profile that was updated. 116 SecurityProfileName *string 117 118 // The updated version of the security profile. 119 Version int64 120 121 // Metadata pertaining to the operation's result. 122 ResultMetadata middleware.Metadata 123} 124 125func addOperationUpdateSecurityProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { 126 err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateSecurityProfile{}, middleware.After) 127 if err != nil { 128 return err 129 } 130 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateSecurityProfile{}, middleware.After) 131 if err != nil { 132 return err 133 } 134 if err = addSetLoggerMiddleware(stack, options); err != nil { 135 return err 136 } 137 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 138 return err 139 } 140 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 141 return err 142 } 143 if err = addResolveEndpointMiddleware(stack, options); err != nil { 144 return err 145 } 146 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 147 return err 148 } 149 if err = addRetryMiddlewares(stack, options); err != nil { 150 return err 151 } 152 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 153 return err 154 } 155 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 156 return err 157 } 158 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 159 return err 160 } 161 if err = addClientUserAgent(stack); err != nil { 162 return err 163 } 164 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 165 return err 166 } 167 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 168 return err 169 } 170 if err = addOpUpdateSecurityProfileValidationMiddleware(stack); err != nil { 171 return err 172 } 173 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateSecurityProfile(options.Region), middleware.Before); err != nil { 174 return err 175 } 176 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 177 return err 178 } 179 if err = addResponseErrorMiddleware(stack); err != nil { 180 return err 181 } 182 if err = addRequestResponseLogging(stack, options); err != nil { 183 return err 184 } 185 return nil 186} 187 188func newServiceMetadataMiddleware_opUpdateSecurityProfile(region string) *awsmiddleware.RegisterServiceMetadata { 189 return &awsmiddleware.RegisterServiceMetadata{ 190 Region: region, 191 ServiceID: ServiceID, 192 SigningName: "execute-api", 193 OperationName: "UpdateSecurityProfile", 194 } 195} 196