How to use modify_document_permission method in localstack

Best Python code snippet using localstack_python

pdf_security_options.py

Source:pdf_security_options.py Github

copy

Full Screen

...209 :type: bool210 """211 self.container['full_quality_print_permission'] = full_quality_print_permission212 @property213 def modify_document_permission(self):214 """215 Gets the modify_document_permission of this PdfSecurityOptions.216 If true and the directory does not exist, the directory will be automatically created before saving the file. 217 :return: The modify_document_permission of this PdfSecurityOptions.218 :rtype: bool219 """220 return self.container['modify_document_permission']221 @modify_document_permission.setter222 def modify_document_permission(self, modify_document_permission):223 """224 Sets the modify_document_permission of this PdfSecurityOptions.225 If true and the directory does not exist, the directory will be automatically created before saving the file. 226 :param modify_document_permission: The modify_document_permission of this PdfSecurityOptions.227 :type: bool228 """229 self.container['modify_document_permission'] = modify_document_permission230 @property231 def owner_password(self):232 """233 Gets the owner_password of this PdfSecurityOptions.234 :return: The owner_password of this PdfSecurityOptions.235 :rtype: str236 """...

Full Screen

Full Screen

test_ssm_doc_permissions.py

Source:test_ssm_doc_permissions.py Github

copy

Full Screen

...41)42@mock_ssm43def test_modify_document_permission_add_account_id(ids):44 client = get_client()45 client.modify_document_permission(46 Name="TestDocument", PermissionType="Share", AccountIdsToAdd=ids47 )48 res = client.describe_document_permission(49 Name="TestDocument", PermissionType="Share"50 )51 res.should.have.key("AccountIds")52 set(res["AccountIds"]).should.equal(set(ids))53 res.should.have.key("AccountSharingInfoList").length_of(len(ids))54 expected_account_sharing = [55 {"AccountId": _id, "SharedDocumentVersion": "$DEFAULT"} for _id in ids56 ]57 res.should.have.key("AccountSharingInfoList").equal(expected_account_sharing)58@pytest.mark.parametrize(59 "initial,to_remove",60 [61 (["all"], ["all"]),62 (["111111111111"], ["111111111111"]),63 (["111111111111", "222222222222"], ["222222222222"]),64 (65 ["111111111111", "222222222222", "333333333333"],66 ["111111111111", "333333333333"],67 ),68 ],69 ids=["all", "one_value", "multiple_initials", "multiple_to_remove"],70)71@mock_ssm72def test_modify_document_permission_remove_account_id(initial, to_remove):73 client = get_client()74 client.modify_document_permission(75 Name="TestDocument", PermissionType="Share", AccountIdsToAdd=initial76 )77 client.modify_document_permission(78 Name="TestDocument", PermissionType="Share", AccountIdsToRemove=to_remove79 )80 res = client.describe_document_permission(81 Name="TestDocument", PermissionType="Share"82 )83 res.should.have.key("AccountIds")84 expected_new_list = set([x for x in initial if x not in to_remove])85 set(res["AccountIds"]).should.equal(expected_new_list)86 expected_account_sharing = [87 {"AccountId": _id, "SharedDocumentVersion": "$DEFAULT"}88 for _id in expected_new_list89 ]90 res.should.have.key("AccountSharingInfoList").equal(expected_account_sharing)91@mock_ssm92def test_fail_modify_document_permission_wrong_permission_type():93 client = get_client()94 with pytest.raises(ClientError) as ex:95 client.modify_document_permission(96 Name="TestDocument", PermissionType="WrongValue", AccountIdsToAdd=[]97 )98 err = ex.value.response["Error"]99 err["Code"].should.equal("InvalidPermissionType")100 err["Message"].should.match(r"Member must satisfy enum value set: \[Share\]")101@mock_ssm102def test_fail_modify_document_permission_wrong_document_version():103 client = get_client()104 with pytest.raises(ClientError) as ex:105 client.modify_document_permission(106 Name="TestDocument",107 PermissionType="Share",108 SharedDocumentVersion="unknown",109 AccountIdsToAdd=[],110 )111 err = ex.value.response["Error"]112 err["Code"].should.equal("ValidationException")113 err["Message"].should.match(r"Member must satisfy regular expression pattern")114@pytest.mark.parametrize(115 "value",116 [["alll"], ["1234"], ["1234123412341234"], ["account_id"]],117 ids=["all?", "too_short", "too_long", "no-digits"],118)119@mock_ssm120def test_fail_modify_document_permission_add_invalid_account_ids(value):121 client = get_client()122 with pytest.raises(ClientError) as ex:123 client.modify_document_permission(124 Name="TestDocument", PermissionType="Share", AccountIdsToAdd=value125 )126 err = ex.value.response["Error"]127 err["Code"].should.equal("ValidationException")128 err["Message"].should.match(r"Member must satisfy regular expression pattern:")129@pytest.mark.parametrize(130 "value",131 [["alll"], ["1234"], ["1234123412341234"], ["account_id"]],132 ids=["all?", "too_short", "too_long", "no-digits"],133)134@mock_ssm135def test_fail_modify_document_permission_remove_invalid_account_ids(value):136 client = get_client()137 with pytest.raises(ClientError) as ex:138 client.modify_document_permission(139 Name="TestDocument", PermissionType="Share", AccountIdsToRemove=value140 )141 err = ex.value.response["Error"]142 err["Code"].should.equal("ValidationException")143 err["Message"].should.match(r"Member must satisfy regular expression pattern:")144@mock_ssm145def test_fail_modify_document_permission_add_all_and_specific():146 client = get_client()147 with pytest.raises(ClientError) as ex:148 client.modify_document_permission(149 Name="TestDocument",150 PermissionType="Share",151 AccountIdsToAdd=["all", "123412341234"],152 )153 err = ex.value.response["Error"]154 err["Code"].should.equal("DocumentPermissionLimit")155 err["Message"].should.equal("Accounts can either be all or a group of AWS accounts")156@mock_ssm157def test_fail_modify_document_permission_remove_all_and_specific():158 client = get_client()159 with pytest.raises(ClientError) as ex:160 client.modify_document_permission(161 Name="TestDocument",162 PermissionType="Share",163 AccountIdsToRemove=["all", "123412341234"],164 )165 err = ex.value.response["Error"]166 err["Code"].should.equal("DocumentPermissionLimit")...

Full Screen

Full Screen

ssm_document_set_private.py

Source:ssm_document_set_private.py Github

copy

Full Screen

...15 # If there is no account id then return empty list.16 account_to_add = params[PARAM_NAME].split(',') if PARAM_NAME in params.keys() else []17 text_output = ''18 try:19 response = client.modify_document_permission(20 Name=document_name,21 PermissionType='Share',22 AccountIdsToAdd=account_to_add, # add the account that passes as a param.23 AccountIdsToRemove=['All'] # removes all account id (sets the document to private).24 )25 text_output = f'Removed all account id access except from: {account_to_add}' \26 if response['ResponseMetadata']['HTTPStatusCode'] == 200 else 'Unexpected error'27 except ClientError as error:28 text_output = f'Unexpected error: {error}'...

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