Skip to content

Commit

Permalink
Change default region to us-east-1
Browse files Browse the repository at this point in the history
  • Loading branch information
harjain99 committed Mar 8, 2024
1 parent c8d3cc7 commit a9ff0d3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gyro/aws/AwsResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static synchronized <T extends SdkClient> T createClient(Class<T> clientC
}

if (clientClass.getSimpleName().equals("IamClient")) {
region = "aws-global";
region = "us-east-1";
endpoint = "https://iam.amazonaws.com";

} else if (clientClass.getSimpleName().equals("GlobalAcceleratorClient")) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gyro/aws/iam/InstanceProfileResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand All @@ -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()));
Expand All @@ -150,7 +150,7 @@ public void update(GyroUI ui, State state, Resource current, Set<String> 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()));
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/gyro/aws/iam/OpenIdConnectProviderResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void setTags(Map<String, String> 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(
Expand All @@ -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<String> thumbPrints = new ArrayList<>(getThumbPrints());
if (getAutogenThumbprint()) {
Expand All @@ -257,7 +257,7 @@ public void create(GyroUI ui, State state) throws Exception {
public void update(
GyroUI ui, State state, Resource current, Set<String> 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<String> thumbPrints = new ArrayList<>(getThumbPrints());
Expand Down Expand Up @@ -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()));
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/gyro/aws/iam/PolicyResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);

Expand All @@ -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())
Expand All @@ -202,7 +202,7 @@ public void create(GyroUI ui, State state) {

@Override
public void update(GyroUI ui, State state, Resource current, Set<String> changedFieldNames) {
IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com");
IamClient client = createClient(IamClient.class);

List<PolicyVersion> policyVersions = client.listPolicyVersions(r -> r.policyArn(getArn())).versions();

Expand Down Expand Up @@ -236,7 +236,7 @@ public void update(GyroUI ui, State state, Resource current, Set<String> 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<PolicyVersion> policyVersions = client.listPolicyVersions(r -> r.policyArn(getArn())).versions();

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gyro/aws/iam/RoleInlinePolicyResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -87,7 +87,7 @@ public void create(GyroUI ui, State state) throws Exception {

@Override
public void update(GyroUI ui, State state, Resource current, Set<String> changedFieldNames) throws Exception {
IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com");
IamClient client = createClient(IamClient.class);

RoleResource roleResource = (RoleResource) parent();

Expand All @@ -96,7 +96,7 @@ public void update(GyroUI ui, State state, Resource current, Set<String> 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();

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/gyro/aws/iam/RoleResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public void setInlinePolicy(Set<RoleInlinePolicyResource> 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());
Expand Down Expand Up @@ -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);

Expand All @@ -280,7 +280,7 @@ public boolean refresh() {

@Override
public Map<? extends Resource, Boolean> batchRefresh(List<? extends Resource> resources) {
IamClient client = createClient(IamClient.class, "aws-global", "https://iam.amazonaws.com");
IamClient client = createClient(IamClient.class);
Map<RoleResource, Boolean> refreshStatus = new HashMap<>();

List<Role> roles = getRoles(client);
Expand All @@ -303,7 +303,7 @@ public Map<? extends Resource, Boolean> batchRefresh(List<? extends Resource> 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())
Expand All @@ -327,7 +327,7 @@ public void create(GyroUI ui, State state) {

@Override
public void update(GyroUI ui, State state, Resource current, Set<String> 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()));
Expand Down Expand Up @@ -369,7 +369,7 @@ public void update(GyroUI ui, State state, Resource current, Set<String> 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()) {
Expand Down

0 comments on commit a9ff0d3

Please sign in to comment.