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