How to use s3_bucket_arn method in localstack

Best Python code snippet using localstack_python

s3_location.py

Source:s3_location.py Github

copy

Full Screen

...38 if tags is not None:39 pulumi.set(__self__, "tags", tags)40 @property41 @pulumi.getter(name="s3BucketArn")42 def s3_bucket_arn(self) -> pulumi.Input[str]:43 """44 Amazon Resource Name (ARN) of the S3 Bucket.45 """46 return pulumi.get(self, "s3_bucket_arn")47 @s3_bucket_arn.setter48 def s3_bucket_arn(self, value: pulumi.Input[str]):49 pulumi.set(self, "s3_bucket_arn", value)50 @property51 @pulumi.getter(name="s3Config")52 def s3_config(self) -> pulumi.Input['S3LocationS3ConfigArgs']:53 """54 Configuration block containing information for connecting to S3.55 """56 return pulumi.get(self, "s3_config")57 @s3_config.setter58 def s3_config(self, value: pulumi.Input['S3LocationS3ConfigArgs']):59 pulumi.set(self, "s3_config", value)60 @property61 @pulumi.getter62 def subdirectory(self) -> pulumi.Input[str]:63 """64 Prefix to perform actions as source or destination.65 """66 return pulumi.get(self, "subdirectory")67 @subdirectory.setter68 def subdirectory(self, value: pulumi.Input[str]):69 pulumi.set(self, "subdirectory", value)70 @property71 @pulumi.getter(name="agentArns")72 def agent_arns(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:73 """74 A list of DataSync Agent ARNs with which this location will be associated.75 """76 return pulumi.get(self, "agent_arns")77 @agent_arns.setter78 def agent_arns(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):79 pulumi.set(self, "agent_arns", value)80 @property81 @pulumi.getter(name="s3StorageClass")82 def s3_storage_class(self) -> Optional[pulumi.Input[str]]:83 """84 The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes)85 """86 return pulumi.get(self, "s3_storage_class")87 @s3_storage_class.setter88 def s3_storage_class(self, value: Optional[pulumi.Input[str]]):89 pulumi.set(self, "s3_storage_class", value)90 @property91 @pulumi.getter92 def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:93 """94 Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.95 """96 return pulumi.get(self, "tags")97 @tags.setter98 def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):99 pulumi.set(self, "tags", value)100@pulumi.input_type101class _S3LocationState:102 def __init__(__self__, *,103 agent_arns: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,104 arn: Optional[pulumi.Input[str]] = None,105 s3_bucket_arn: Optional[pulumi.Input[str]] = None,106 s3_config: Optional[pulumi.Input['S3LocationS3ConfigArgs']] = None,107 s3_storage_class: Optional[pulumi.Input[str]] = None,108 subdirectory: Optional[pulumi.Input[str]] = None,109 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,110 tags_all: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,111 uri: Optional[pulumi.Input[str]] = None):112 """113 Input properties used for looking up and filtering S3Location resources.114 :param pulumi.Input[Sequence[pulumi.Input[str]]] agent_arns: A list of DataSync Agent ARNs with which this location will be associated.115 :param pulumi.Input[str] arn: Amazon Resource Name (ARN) of the DataSync Location.116 :param pulumi.Input[str] s3_bucket_arn: Amazon Resource Name (ARN) of the S3 Bucket.117 :param pulumi.Input['S3LocationS3ConfigArgs'] s3_config: Configuration block containing information for connecting to S3.118 :param pulumi.Input[str] s3_storage_class: The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes)119 :param pulumi.Input[str] subdirectory: Prefix to perform actions as source or destination.120 :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.121 :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags_all: A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.122 """123 if agent_arns is not None:124 pulumi.set(__self__, "agent_arns", agent_arns)125 if arn is not None:126 pulumi.set(__self__, "arn", arn)127 if s3_bucket_arn is not None:128 pulumi.set(__self__, "s3_bucket_arn", s3_bucket_arn)129 if s3_config is not None:130 pulumi.set(__self__, "s3_config", s3_config)131 if s3_storage_class is not None:132 pulumi.set(__self__, "s3_storage_class", s3_storage_class)133 if subdirectory is not None:134 pulumi.set(__self__, "subdirectory", subdirectory)135 if tags is not None:136 pulumi.set(__self__, "tags", tags)137 if tags_all is not None:138 pulumi.set(__self__, "tags_all", tags_all)139 if uri is not None:140 pulumi.set(__self__, "uri", uri)141 @property142 @pulumi.getter(name="agentArns")143 def agent_arns(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:144 """145 A list of DataSync Agent ARNs with which this location will be associated.146 """147 return pulumi.get(self, "agent_arns")148 @agent_arns.setter149 def agent_arns(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):150 pulumi.set(self, "agent_arns", value)151 @property152 @pulumi.getter153 def arn(self) -> Optional[pulumi.Input[str]]:154 """155 Amazon Resource Name (ARN) of the DataSync Location.156 """157 return pulumi.get(self, "arn")158 @arn.setter159 def arn(self, value: Optional[pulumi.Input[str]]):160 pulumi.set(self, "arn", value)161 @property162 @pulumi.getter(name="s3BucketArn")163 def s3_bucket_arn(self) -> Optional[pulumi.Input[str]]:164 """165 Amazon Resource Name (ARN) of the S3 Bucket.166 """167 return pulumi.get(self, "s3_bucket_arn")168 @s3_bucket_arn.setter169 def s3_bucket_arn(self, value: Optional[pulumi.Input[str]]):170 pulumi.set(self, "s3_bucket_arn", value)171 @property172 @pulumi.getter(name="s3Config")173 def s3_config(self) -> Optional[pulumi.Input['S3LocationS3ConfigArgs']]:174 """175 Configuration block containing information for connecting to S3.176 """177 return pulumi.get(self, "s3_config")178 @s3_config.setter179 def s3_config(self, value: Optional[pulumi.Input['S3LocationS3ConfigArgs']]):180 pulumi.set(self, "s3_config", value)181 @property182 @pulumi.getter(name="s3StorageClass")183 def s3_storage_class(self) -> Optional[pulumi.Input[str]]:184 """185 The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes)186 """187 return pulumi.get(self, "s3_storage_class")188 @s3_storage_class.setter189 def s3_storage_class(self, value: Optional[pulumi.Input[str]]):190 pulumi.set(self, "s3_storage_class", value)191 @property192 @pulumi.getter193 def subdirectory(self) -> Optional[pulumi.Input[str]]:194 """195 Prefix to perform actions as source or destination.196 """197 return pulumi.get(self, "subdirectory")198 @subdirectory.setter199 def subdirectory(self, value: Optional[pulumi.Input[str]]):200 pulumi.set(self, "subdirectory", value)201 @property202 @pulumi.getter203 def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:204 """205 Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.206 """207 return pulumi.get(self, "tags")208 @tags.setter209 def tags(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):210 pulumi.set(self, "tags", value)211 @property212 @pulumi.getter(name="tagsAll")213 def tags_all(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:214 """215 A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.216 """217 return pulumi.get(self, "tags_all")218 @tags_all.setter219 def tags_all(self, value: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]):220 pulumi.set(self, "tags_all", value)221 @property222 @pulumi.getter223 def uri(self) -> Optional[pulumi.Input[str]]:224 return pulumi.get(self, "uri")225 @uri.setter226 def uri(self, value: Optional[pulumi.Input[str]]):227 pulumi.set(self, "uri", value)228class S3Location(pulumi.CustomResource):229 @overload230 def __init__(__self__,231 resource_name: str,232 opts: Optional[pulumi.ResourceOptions] = None,233 agent_arns: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,234 s3_bucket_arn: Optional[pulumi.Input[str]] = None,235 s3_config: Optional[pulumi.Input[pulumi.InputType['S3LocationS3ConfigArgs']]] = None,236 s3_storage_class: Optional[pulumi.Input[str]] = None,237 subdirectory: Optional[pulumi.Input[str]] = None,238 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,239 __props__=None):240 """241 Manages an S3 Location within AWS DataSync.242 ## Example Usage243 ```python244 import pulumi245 import pulumi_aws as aws246 example = aws.datasync.S3Location("example",247 s3_bucket_arn=aws_s3_bucket["example"]["arn"],248 subdirectory="/example/prefix",249 s3_config=aws.datasync.S3LocationS3ConfigArgs(250 bucket_access_role_arn=aws_iam_role["example"]["arn"],251 ))252 ```253 ## Import254 `aws_datasync_location_s3` can be imported by using the DataSync Task Amazon Resource Name (ARN), e.g.,255 ```sh256 $ pulumi import aws:datasync/s3Location:S3Location example arn:aws:datasync:us-east-1:123456789012:location/loc-12345678901234567257 ```258 :param str resource_name: The name of the resource.259 :param pulumi.ResourceOptions opts: Options for the resource.260 :param pulumi.Input[Sequence[pulumi.Input[str]]] agent_arns: A list of DataSync Agent ARNs with which this location will be associated.261 :param pulumi.Input[str] s3_bucket_arn: Amazon Resource Name (ARN) of the S3 Bucket.262 :param pulumi.Input[pulumi.InputType['S3LocationS3ConfigArgs']] s3_config: Configuration block containing information for connecting to S3.263 :param pulumi.Input[str] s3_storage_class: The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes)264 :param pulumi.Input[str] subdirectory: Prefix to perform actions as source or destination.265 :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.266 """267 ...268 @overload269 def __init__(__self__,270 resource_name: str,271 args: S3LocationArgs,272 opts: Optional[pulumi.ResourceOptions] = None):273 """274 Manages an S3 Location within AWS DataSync.275 ## Example Usage276 ```python277 import pulumi278 import pulumi_aws as aws279 example = aws.datasync.S3Location("example",280 s3_bucket_arn=aws_s3_bucket["example"]["arn"],281 subdirectory="/example/prefix",282 s3_config=aws.datasync.S3LocationS3ConfigArgs(283 bucket_access_role_arn=aws_iam_role["example"]["arn"],284 ))285 ```286 ## Import287 `aws_datasync_location_s3` can be imported by using the DataSync Task Amazon Resource Name (ARN), e.g.,288 ```sh289 $ pulumi import aws:datasync/s3Location:S3Location example arn:aws:datasync:us-east-1:123456789012:location/loc-12345678901234567290 ```291 :param str resource_name: The name of the resource.292 :param S3LocationArgs args: The arguments to use to populate this resource's properties.293 :param pulumi.ResourceOptions opts: Options for the resource.294 """295 ...296 def __init__(__self__, resource_name: str, *args, **kwargs):297 resource_args, opts = _utilities.get_resource_args_opts(S3LocationArgs, pulumi.ResourceOptions, *args, **kwargs)298 if resource_args is not None:299 __self__._internal_init(resource_name, opts, **resource_args.__dict__)300 else:301 __self__._internal_init(resource_name, *args, **kwargs)302 def _internal_init(__self__,303 resource_name: str,304 opts: Optional[pulumi.ResourceOptions] = None,305 agent_arns: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,306 s3_bucket_arn: Optional[pulumi.Input[str]] = None,307 s3_config: Optional[pulumi.Input[pulumi.InputType['S3LocationS3ConfigArgs']]] = None,308 s3_storage_class: Optional[pulumi.Input[str]] = None,309 subdirectory: Optional[pulumi.Input[str]] = None,310 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,311 __props__=None):312 opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)313 if not isinstance(opts, pulumi.ResourceOptions):314 raise TypeError('Expected resource options to be a ResourceOptions instance')315 if opts.id is None:316 if __props__ is not None:317 raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')318 __props__ = S3LocationArgs.__new__(S3LocationArgs)319 __props__.__dict__["agent_arns"] = agent_arns320 if s3_bucket_arn is None and not opts.urn:321 raise TypeError("Missing required property 's3_bucket_arn'")322 __props__.__dict__["s3_bucket_arn"] = s3_bucket_arn323 if s3_config is None and not opts.urn:324 raise TypeError("Missing required property 's3_config'")325 __props__.__dict__["s3_config"] = s3_config326 __props__.__dict__["s3_storage_class"] = s3_storage_class327 if subdirectory is None and not opts.urn:328 raise TypeError("Missing required property 'subdirectory'")329 __props__.__dict__["subdirectory"] = subdirectory330 __props__.__dict__["tags"] = tags331 __props__.__dict__["arn"] = None332 __props__.__dict__["tags_all"] = None333 __props__.__dict__["uri"] = None334 super(S3Location, __self__).__init__(335 'aws:datasync/s3Location:S3Location',336 resource_name,337 __props__,338 opts)339 @staticmethod340 def get(resource_name: str,341 id: pulumi.Input[str],342 opts: Optional[pulumi.ResourceOptions] = None,343 agent_arns: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,344 arn: Optional[pulumi.Input[str]] = None,345 s3_bucket_arn: Optional[pulumi.Input[str]] = None,346 s3_config: Optional[pulumi.Input[pulumi.InputType['S3LocationS3ConfigArgs']]] = None,347 s3_storage_class: Optional[pulumi.Input[str]] = None,348 subdirectory: Optional[pulumi.Input[str]] = None,349 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,350 tags_all: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,351 uri: Optional[pulumi.Input[str]] = None) -> 'S3Location':352 """353 Get an existing S3Location resource's state with the given name, id, and optional extra354 properties used to qualify the lookup.355 :param str resource_name: The unique name of the resulting resource.356 :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.357 :param pulumi.ResourceOptions opts: Options for the resource.358 :param pulumi.Input[Sequence[pulumi.Input[str]]] agent_arns: A list of DataSync Agent ARNs with which this location will be associated.359 :param pulumi.Input[str] arn: Amazon Resource Name (ARN) of the DataSync Location.360 :param pulumi.Input[str] s3_bucket_arn: Amazon Resource Name (ARN) of the S3 Bucket.361 :param pulumi.Input[pulumi.InputType['S3LocationS3ConfigArgs']] s3_config: Configuration block containing information for connecting to S3.362 :param pulumi.Input[str] s3_storage_class: The Amazon S3 storage class that you want to store your files in when this location is used as a task destination. [Valid values](https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#using-storage-classes)363 :param pulumi.Input[str] subdirectory: Prefix to perform actions as source or destination.364 :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: Key-value pairs of resource tags to assign to the DataSync Location. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.365 :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags_all: A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.366 """367 opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))368 __props__ = _S3LocationState.__new__(_S3LocationState)369 __props__.__dict__["agent_arns"] = agent_arns370 __props__.__dict__["arn"] = arn371 __props__.__dict__["s3_bucket_arn"] = s3_bucket_arn372 __props__.__dict__["s3_config"] = s3_config373 __props__.__dict__["s3_storage_class"] = s3_storage_class374 __props__.__dict__["subdirectory"] = subdirectory375 __props__.__dict__["tags"] = tags376 __props__.__dict__["tags_all"] = tags_all377 __props__.__dict__["uri"] = uri378 return S3Location(resource_name, opts=opts, __props__=__props__)379 @property380 @pulumi.getter(name="agentArns")381 def agent_arns(self) -> pulumi.Output[Optional[Sequence[str]]]:382 """383 A list of DataSync Agent ARNs with which this location will be associated.384 """385 return pulumi.get(self, "agent_arns")386 @property387 @pulumi.getter388 def arn(self) -> pulumi.Output[str]:389 """390 Amazon Resource Name (ARN) of the DataSync Location.391 """392 return pulumi.get(self, "arn")393 @property394 @pulumi.getter(name="s3BucketArn")395 def s3_bucket_arn(self) -> pulumi.Output[str]:396 """397 Amazon Resource Name (ARN) of the S3 Bucket.398 """399 return pulumi.get(self, "s3_bucket_arn")400 @property401 @pulumi.getter(name="s3Config")402 def s3_config(self) -> pulumi.Output['outputs.S3LocationS3Config']:403 """404 Configuration block containing information for connecting to S3.405 """406 return pulumi.get(self, "s3_config")407 @property408 @pulumi.getter(name="s3StorageClass")409 def s3_storage_class(self) -> pulumi.Output[str]:...

Full Screen

Full Screen

Listing_10_05.py

Source:Listing_10_05.py Github

copy

Full Screen

1import boto32s3_client = boto3.client('s3')3def handler(event):4 s3_bucket_arn = event['context']['resources'][0]5 tag_set = s3_client.get_bucket_tagging(bucket=s3_bucket_arn)['TagSet']6 is_pci = 'PCI' in tag_set and tag_set['PCI'] === 'True'7 if is_pci:8 s3_client.put_bucket_encryption(9 Bucket=s3_bucket_arn,10 ServerSideEncryptionConfiguration={11 'Rules': [12 {13 'ApplyServerSideEncryptionByDefault': {14 'SSEAlgorithm': 'AES256',15 'KMSMasterKeyID': 'string'16 },17 },18 ]19 }20 )21objects = s3_client.list_objects_v2(22 Bucket=s3_bucket_arn,23 )24 for obj in objects['Contents']:25 s3_client.copy_object(26 Bucket=s3_bucket_arn,27 Key=obj['Key'],28 SSECustomerAlgorithm='AES256'...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful