chore: Update dist

This commit is contained in:
GitHub Actions
2025-09-11 19:36:07 +00:00
committed by kellertk
parent 569add8750
commit 215dbfc2e0
2 changed files with 45 additions and 18 deletions
Generated Vendored
+8 -1
View File
@@ -49741,7 +49741,14 @@ async function getCallerIdentity(client) {
if (!identity.Account || !identity.Arn) { if (!identity.Account || !identity.Arn) {
throw new Error('Could not get Account ID or ARN from STS. Did you set credentials?'); throw new Error('Could not get Account ID or ARN from STS. Did you set credentials?');
} }
return { Account: identity.Account, Arn: identity.Arn, UserId: identity.UserId }; const result = {
Account: identity.Account,
Arn: identity.Arn,
};
if (identity.UserId !== undefined) {
result.UserId = identity.UserId;
}
return result;
} }
// Obtains account ID from STS Client and sets it as output // Obtains account ID from STS Client and sets it as output
async function exportAccountId(credentialsClient, maskAccountId) { async function exportAccountId(credentialsClient, maskAccountId) {
Generated Vendored
+37 -17
View File
@@ -17,14 +17,19 @@ const ProxyResolver_1 = __nccwpck_require__(3265);
const USER_AGENT = 'configure-aws-credentials-for-github-actions'; const USER_AGENT = 'configure-aws-credentials-for-github-actions';
class CredentialsClient { class CredentialsClient {
constructor(props) { constructor(props) {
this.region = props.region; if (props.region !== undefined) {
this.region = props.region;
}
if (props.proxyServer) { if (props.proxyServer) {
(0, core_1.info)('Configuring proxy handler for STS client'); (0, core_1.info)('Configuring proxy handler for STS client');
const getProxyForUrl = new ProxyResolver_1.ProxyResolver({ const proxyOptions = {
httpProxy: props.proxyServer, httpProxy: props.proxyServer,
httpsProxy: props.proxyServer, httpsProxy: props.proxyServer,
noProxy: props.noProxy, };
}).getProxyForUrl; if (props.noProxy !== undefined) {
proxyOptions.noProxy = props.noProxy;
}
const getProxyForUrl = new ProxyResolver_1.ProxyResolver(proxyOptions).getProxyForUrl;
const handler = new proxy_agent_1.ProxyAgent({ getProxyForUrl }); const handler = new proxy_agent_1.ProxyAgent({ getProxyForUrl });
this.requestHandler = new node_http_handler_1.NodeHttpHandler({ this.requestHandler = new node_http_handler_1.NodeHttpHandler({
httpsAgent: handler, httpsAgent: handler,
@@ -34,11 +39,12 @@ class CredentialsClient {
} }
get stsClient() { get stsClient() {
if (!this._stsClient) { if (!this._stsClient) {
this._stsClient = new client_sts_1.STSClient({ const config = { customUserAgent: USER_AGENT };
region: this.region, if (this.region !== undefined)
customUserAgent: USER_AGENT, config.region = this.region;
requestHandler: this.requestHandler ? this.requestHandler : undefined, if (this.requestHandler !== undefined)
}); config.requestHandler = this.requestHandler;
this._stsClient = new client_sts_1.STSClient(config);
} }
return this._stsClient; return this._stsClient;
} }
@@ -73,9 +79,10 @@ class CredentialsClient {
} }
} }
async loadCredentials() { async loadCredentials() {
const client = new client_sts_1.STSClient({ const config = {};
requestHandler: this.requestHandler ? this.requestHandler : undefined, if (this.requestHandler !== undefined)
}); config.requestHandler = this.requestHandler;
const client = new client_sts_1.STSClient(config);
return client.config.credentials(); return client.config.credentials();
} }
} }
@@ -97,11 +104,12 @@ const DEFAULT_PORTS = {
}; };
class ProxyResolver { class ProxyResolver {
constructor(options) { constructor(options) {
// This method matches the interface expected by 'proxy-agent'. It is an arrow function to bind 'this'.
this.getProxyForUrl = (url, _req) => {
return this.getProxyForUrlOptions(url, this.options);
};
this.options = options; this.options = options;
} }
getProxyForUrl(url, _req) {
return this.getProxyForUrlOptions(url, this.options);
}
getProxyForUrlOptions(url, options) { getProxyForUrlOptions(url, options) {
let parsedUrl; let parsedUrl;
try { try {
@@ -471,7 +479,14 @@ async function getCallerIdentity(client) {
if (!identity.Account || !identity.Arn) { if (!identity.Account || !identity.Arn) {
throw new Error('Could not get Account ID or ARN from STS. Did you set credentials?'); throw new Error('Could not get Account ID or ARN from STS. Did you set credentials?');
} }
return { Account: identity.Account, Arn: identity.Arn, UserId: identity.UserId }; const result = {
Account: identity.Account,
Arn: identity.Arn,
};
if (identity.UserId !== undefined) {
result.UserId = identity.UserId;
}
return result;
} }
// Obtains account ID from STS Client and sets it as output // Obtains account ID from STS Client and sets it as output
async function exportAccountId(credentialsClient, maskAccountId) { async function exportAccountId(credentialsClient, maskAccountId) {
@@ -724,7 +739,12 @@ async function run() {
} }
(0, helpers_1.exportRegion)(region, outputEnvCredentials); (0, helpers_1.exportRegion)(region, outputEnvCredentials);
// Instantiate credentials client // Instantiate credentials client
const credentialsClient = new CredentialsClient_1.CredentialsClient({ region, proxyServer, noProxy }); const clientProps = { region };
if (proxyServer)
clientProps.proxyServer = proxyServer;
if (noProxy)
clientProps.noProxy = noProxy;
const credentialsClient = new CredentialsClient_1.CredentialsClient(clientProps);
let sourceAccountId; let sourceAccountId;
let webIdentityToken; let webIdentityToken;
//if the user wants to attempt to use existing credentials, check if we have some already //if the user wants to attempt to use existing credentials, check if we have some already