Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(clients): use signing name from auth sigv4 trait #1835

Merged
merged 2 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clients/client-apigatewaymanagementapi/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ export const defaultRegionInfoProvider: RegionInfoProvider = (region: string, op
};
}
}
return Promise.resolve({ signingService: "apigateway", ...regionInfo });
return Promise.resolve({ signingService: "execute-api", ...regionInfo });
};
2 changes: 1 addition & 1 deletion clients/client-codeguruprofiler/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ export const defaultRegionInfoProvider: RegionInfoProvider = (region: string, op
};
}
}
return Promise.resolve({ signingService: "codeguru-profiler", ...regionInfo });
return Promise.resolve({ signingService: "codeguruprofiler", ...regionInfo });
};
2 changes: 1 addition & 1 deletion clients/client-connectparticipant/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ export const defaultRegionInfoProvider: RegionInfoProvider = (region: string, op
};
}
}
return Promise.resolve({ signingService: "connect", ...regionInfo });
return Promise.resolve({ signingService: "execute-api", ...regionInfo });
};
2 changes: 1 addition & 1 deletion clients/client-iot/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,5 +237,5 @@ export const defaultRegionInfoProvider: RegionInfoProvider = (region: string, op
};
}
}
return Promise.resolve({ signingService: "iot", ...regionInfo });
return Promise.resolve({ signingService: "execute-api", ...regionInfo });
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.Set;
import java.util.TreeMap;
import software.amazon.smithy.aws.traits.ServiceTrait;
import software.amazon.smithy.aws.traits.auth.SigV4Trait;
import software.amazon.smithy.codegen.core.CodegenException;
import software.amazon.smithy.model.node.Node;
import software.amazon.smithy.model.node.ObjectNode;
Expand All @@ -45,6 +46,7 @@ final class EndpointGenerator implements Runnable {
private final ObjectNode endpointData;
private final ServiceTrait serviceTrait;
private final String endpointPrefix;
private final String baseSigningSerivce;
private final Map<String, Partition> partitions = new TreeMap<>();
private final Map<String, ObjectNode> endpoints = new TreeMap<>();
private final Map<String, Partition> regionPartitionsMap = new TreeMap<>();
Expand All @@ -54,6 +56,8 @@ final class EndpointGenerator implements Runnable {
serviceTrait = service.getTrait(ServiceTrait.class)
.orElseThrow(() -> new CodegenException("No service trait found on " + service.getId()));
endpointPrefix = serviceTrait.getEndpointPrefix();
baseSigningSerivce = service.getTrait(SigV4Trait.class).map(SigV4Trait::getName)
.orElse(serviceTrait.getArnNamespace());
endpointData = Node.parse(IoUtils.readUtf8Resource(getClass(), "endpoints.json")).expectObjectNode();
validateVersion();
loadPartitions();
Expand Down Expand Up @@ -154,8 +158,7 @@ private void writeEndpointProviderFunction() {
writePartitionEndpointResolver(partitions.get("aws")); });
writer.dedent();
});
writer.write("return Promise.resolve({ signingService: $S, ...regionInfo });",
serviceTrait.getArnNamespace());
writer.write("return Promise.resolve({ signingService: $S, ...regionInfo });", baseSigningSerivce);
});
}

Expand Down
2 changes: 1 addition & 1 deletion protocol_tests/aws-json/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ export const defaultRegionInfoProvider: RegionInfoProvider = (region: string, op
};
}
}
return Promise.resolve({ signingService: "jsonprotocol", ...regionInfo });
return Promise.resolve({ signingService: "foo", ...regionInfo });
};