From a9ff0d3299b123737ed590df3bc0502ab0c70e80 Mon Sep 17 00:00:00 2001 From: Harshil Jain Date: Fri, 8 Mar 2024 13:05:33 -0500 Subject: [PATCH] Change default region to us-east-1 --- src/main/java/gyro/aws/AwsResource.java | 2 +- .../java/gyro/aws/iam/InstanceProfileResource.java | 6 +++--- .../gyro/aws/iam/OpenIdConnectProviderResource.java | 8 ++++---- src/main/java/gyro/aws/iam/PolicyResource.java | 10 +++++----- .../java/gyro/aws/iam/RoleInlinePolicyResource.java | 6 +++--- src/main/java/gyro/aws/iam/RoleResource.java | 12 ++++++------ 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/main/java/gyro/aws/AwsResource.java b/src/main/java/gyro/aws/AwsResource.java index 59a37e8f9..b9c0a028c 100644 --- a/src/main/java/gyro/aws/AwsResource.java +++ b/src/main/java/gyro/aws/AwsResource.java @@ -84,7 +84,7 @@ public static synchronized T createClient(Class clientC } if (clientClass.getSimpleName().equals("IamClient")) { - region = "aws-global"; + region = "us-east-1"; endpoint = "https://iam.amazonaws.com"; } else if (clientClass.getSimpleName().equals("GlobalAcceleratorClient")) { diff --git a/src/main/java/gyro/aws/iam/InstanceProfileResource.java b/src/main/java/gyro/aws/iam/InstanceProfileResource.java index 64f40688e..58b465d50 100644 --- a/src/main/java/gyro/aws/iam/InstanceProfileResource.java +++ b/src/main/java/gyro/aws/iam/InstanceProfileResource.java @@ -118,7 +118,7 @@ public void copyFrom(InstanceProfile instanceProfile) { @Override public boolean refresh() { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); GetInstanceProfileResponse response = client.getInstanceProfile(r -> r.instanceProfileName(getName())); @@ -133,7 +133,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); CreateInstanceProfileResponse response = client.createInstanceProfile(r -> r.instanceProfileName(getName()).path(getPath())); @@ -150,7 +150,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); if (getRole() != null) { client.removeRoleFromInstanceProfile(r -> r.roleName(getRole().getName()).instanceProfileName(getName())); diff --git a/src/main/java/gyro/aws/iam/OpenIdConnectProviderResource.java b/src/main/java/gyro/aws/iam/OpenIdConnectProviderResource.java index 09a2495bf..51320252d 100644 --- a/src/main/java/gyro/aws/iam/OpenIdConnectProviderResource.java +++ b/src/main/java/gyro/aws/iam/OpenIdConnectProviderResource.java @@ -209,7 +209,7 @@ public void setTags(Map tags) { @Override public boolean refresh() { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); try { GetOpenIdConnectProviderResponse response = client.getOpenIDConnectProvider(r -> r.openIDConnectProviderArn( @@ -231,7 +231,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); List thumbPrints = new ArrayList<>(getThumbPrints()); if (getAutogenThumbprint()) { @@ -257,7 +257,7 @@ public void create(GyroUI ui, State state) throws Exception { public void update( GyroUI ui, State state, Resource current, Set changedFieldNames) throws Exception { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); if (changedFieldNames.contains("thumb-prints")) { List thumbPrints = new ArrayList<>(getThumbPrints()); @@ -303,7 +303,7 @@ public void update( @Override public void delete(GyroUI ui, State state) throws Exception { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); client.deleteOpenIDConnectProvider(r -> r.openIDConnectProviderArn(getArn())); } diff --git a/src/main/java/gyro/aws/iam/PolicyResource.java b/src/main/java/gyro/aws/iam/PolicyResource.java index dc7169075..338ba50b6 100644 --- a/src/main/java/gyro/aws/iam/PolicyResource.java +++ b/src/main/java/gyro/aws/iam/PolicyResource.java @@ -152,7 +152,7 @@ public void setPolicyDocument(String policyDocument) { @Override public void copyFrom(Policy policy) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); setName(policy.policyName()); setDescription(policy.description()); @@ -173,7 +173,7 @@ public void copyFrom(Policy policy) { @Override public boolean refresh() { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); Policy policy = getPolicy(client); @@ -188,7 +188,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); CreatePolicyResponse response = client.createPolicy( r -> r.policyName(getName()) @@ -202,7 +202,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); List policyVersions = client.listPolicyVersions(r -> r.policyArn(getArn())).versions(); @@ -236,7 +236,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); List policyVersions = client.listPolicyVersions(r -> r.policyArn(getArn())).versions(); diff --git a/src/main/java/gyro/aws/iam/RoleInlinePolicyResource.java b/src/main/java/gyro/aws/iam/RoleInlinePolicyResource.java index cac0592bf..c0268031d 100644 --- a/src/main/java/gyro/aws/iam/RoleInlinePolicyResource.java +++ b/src/main/java/gyro/aws/iam/RoleInlinePolicyResource.java @@ -78,7 +78,7 @@ public boolean refresh() { @Override public void create(GyroUI ui, State state) throws Exception { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); RoleResource roleResource = (RoleResource) parent(); @@ -87,7 +87,7 @@ public void create(GyroUI ui, State state) throws Exception { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) throws Exception { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); RoleResource roleResource = (RoleResource) parent(); @@ -96,7 +96,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) throws Exception { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); RoleResource roleResource = (RoleResource) parent(); diff --git a/src/main/java/gyro/aws/iam/RoleResource.java b/src/main/java/gyro/aws/iam/RoleResource.java index f22c60735..a3a05e978 100644 --- a/src/main/java/gyro/aws/iam/RoleResource.java +++ b/src/main/java/gyro/aws/iam/RoleResource.java @@ -235,7 +235,7 @@ public void setInlinePolicy(Set inlinePolicy) { @Override public void copyFrom(Role role) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); setArn(role.arn()); setName(role.roleName()); @@ -265,7 +265,7 @@ public void copyFrom(Role role) { @Override public boolean refresh() { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); Role role = getRole(client); @@ -280,7 +280,7 @@ public boolean refresh() { @Override public Map batchRefresh(List resources) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); Map refreshStatus = new HashMap<>(); List roles = getRoles(client); @@ -303,7 +303,7 @@ public Map batchRefresh(List re @Override public void create(GyroUI ui, State state) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); CreateRoleResponse response = client.createRole(r -> r.assumeRolePolicyDocument(getAssumeRolePolicy()) .description(getDescription()) @@ -327,7 +327,7 @@ public void create(GyroUI ui, State state) { @Override public void update(GyroUI ui, State state, Resource current, Set changedFieldNames) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); client.updateAssumeRolePolicy(r -> r.policyDocument(PolicyResource.formatPolicy(getAssumeRolePolicy())) .roleName(getName())); @@ -369,7 +369,7 @@ public void update(GyroUI ui, State state, Resource current, Set changed @Override public void delete(GyroUI ui, State state) { - IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com"); + IamClient client = createClient(IamClient.class); ListAttachedRolePoliciesResponse response = client.listAttachedRolePolicies(r -> r.roleName(getName())); for (AttachedPolicy policies : response.attachedPolicies()) {