How to use create_open_id_connect_provider method in localstack

Best Python code snippet using localstack_python

test_oidc_provider.py

Source:test_oidc_provider.py Github

copy

Full Screen

...16 client = session.client("iam")17 oidc_url = "https://oidc.eks.us-east-1.amazonaws.com/id/EXAMPLED539D4633E53DE1B716D3041E"18 oidc_client_ids = ["sts.amazonaws.com"]19 oidc_thumbprints = ["9999999999999999999999999999999999999999"]20 _ = client.create_open_id_connect_provider(21 Url=oidc_url, ClientIDList=oidc_client_ids, ThumbprintList=oidc_thumbprints,22 )23 scan_accessor = AWSAccessor(session=session, account_id=account_id, region_name=region_name)24 resources = IAMOIDCProviderResourceSpec.scan(scan_accessor=scan_accessor)25 expected_resources = [26 Resource(27 resource_id="arn:aws:iam::123456789012:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/EXAMPLED539D4633E53DE1B716D3041E",28 type="aws:iam:oidc-provider",29 link_collection=LinkCollection(30 simple_links=(31 SimpleLink(32 pred="url",33 obj="oidc.eks.us-east-1.amazonaws.com/id/EXAMPLED539D4633E53DE1B716D3041E",34 ),35 SimpleLink(36 pred="create_date",37 obj=resources[0].link_collection.simple_links[1].obj,38 ),39 SimpleLink(pred="client_id", obj="sts.amazonaws.com"),40 SimpleLink(41 pred="thumbprint", obj="9999999999999999999999999999999999999999"42 ),43 ),44 multi_links=None,45 tag_links=None,46 resource_links=(47 ResourceLink(pred="account", obj="arn:aws::::account/123456789012"),48 ),49 transient_resource_links=None,50 ),51 )52 ]53 self.assertEqual(resources, expected_resources)54 @mock_iam55 def test_disappearing_oidc_provider_race_condition(self):56 account_id = "123456789012"57 region_name = "us-east-1"58 oidc_url = "https://oidc.eks.us-east-1.amazonaws.com/id/EXAMPLED539D4633E53DE1B716D3041E"59 oidc_client_ids = ["sts.amazonaws.com"]60 oidc_thumbprints = ["9999999999999999999999999999999999999999"]61 session = boto3.Session()62 client = session.client("iam")63 oidc_provider_resp = client.create_open_id_connect_provider(64 Url=oidc_url, ClientIDList=oidc_client_ids, ThumbprintList=oidc_thumbprints,65 )66 oidc_provider_arn = oidc_provider_resp["OpenIDConnectProviderArn"]67 scan_accessor = AWSAccessor(session=session, account_id=account_id, region_name=region_name)68 with patch(69 "altimeter.aws.resource.iam.iam_oidc_provider.IAMOIDCProviderResourceSpec"70 ".get_oidc_provider_details"71 ) as mock_get_oidc_provider_details:72 mock_get_oidc_provider_details.side_effect = ClientError(73 operation_name="GetOIDCProvider",74 error_response={75 "Error": {76 "Code": "NoSuchEntity",77 "Message": f"OpenIDConnect Provider not found for arn {oidc_provider_arn}",...

Full Screen

Full Screen

app.py

Source:app.py Github

copy

Full Screen

...23 response = iam.get_open_id_connect_provider(24 OpenIDConnectProviderArn=arn)25 except ClientError as e:26 if e.response['Error']['Code'] == "NoSuchEntity":27 response_create = iam.create_open_id_connect_provider(28 Url=url,29 ClientIDList=client_id_list,30 ThumbprintList=thumbprint_list)31 return response_create['OpenIDConnectProviderArn']32 else:33 raise34 deleted_client_ids = set(response['ClientIDList']) - set(35 client_id_list)36 added_client_ids = set(client_id_list) - set(37 response['ClientIDList'])38 if set(thumbprint_list) ^ set(response['ThumbprintList']):39 iam.update_open_id_connect_provider_thumbprint(40 OpenIDConnectProviderArn=arn,41 ThumbprintList=thumbprint_list)42 for client_id in added_client_ids:43 iam.add_client_id_to_open_id_connect_provider(44 OpenIDConnectProviderArn=arn, ClientID=client_id)45 for client_id in deleted_client_ids:46 iam.remove_client_id_from_open_id_connect_provider(47 OpenIDConnectProviderArn=arn, ClientID=client_id)48 return arn49def create_provider(aws_account_id, url, client_id_list, thumbprint_list):50 try:51 response = iam.create_open_id_connect_provider(52 Url=url,53 ClientIDList=client_id_list,54 ThumbprintList=thumbprint_list)55 return response['OpenIDConnectProviderArn']56 except ClientError as e:57 if e.response['Error']['Code'] == "EntityAlreadyExists":58 arn = ARN_FORMAT.format(aws_account_id, url[8:])59 return update_provider(url, aws_account_id, client_id_list, thumbprint_list)60@helper.create61def create(event, context):62 return create_provider(*get_parameters(event))63@helper.update64def update(event, context):65 aws_account_id, url, client_id_list, thumbprint_list = get_parameters(...

Full Screen

Full Screen

create_open_id_connect_provider.py

Source:create_open_id_connect_provider.py Github

copy

Full Screen

1import boto32client = boto3.client('iam')3response = client.create_open_id_connect_provider(4 Url='https://token.actions.githubusercontent.com',5 ClientIDList=[6 'sts.amazonaws.com',7 ],8 ThumbprintList=[9 '3768084dfb3d2b68b7897bf5f565da8efEXAMPLE',10 ],11)...

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