Skip to content

Commit

Permalink
cli changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealAmazonKendra committed Oct 7, 2024
1 parent a47c5c3 commit 4d941aa
Show file tree
Hide file tree
Showing 97 changed files with 13,161 additions and 11,890 deletions.
17 changes: 0 additions & 17 deletions packages/aws-cdk/lib/api/aws-auth/_env.ts

This file was deleted.

19 changes: 13 additions & 6 deletions packages/aws-cdk/lib/api/aws-auth/account-cache.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as path from 'path';
import * as fs from 'fs-extra';
import { accountCacheDir, debug } from './_env';
import { Account } from './sdk-provider';
import { debug } from '../../logging';
import { cdkCacheDir } from '../../util/directories';

/**
* Disk cache which maps access key IDs to account IDs.
Expand All @@ -21,7 +22,7 @@ export class AccountAccessKeyCache {
* @param filePath Path to the cache file
*/
constructor(filePath?: string) {
this.cacheFile = filePath || path.join(accountCacheDir(), 'accounts_partitions.json');
this.cacheFile = filePath || path.join(cdkCacheDir(), 'accounts_partitions.json');
}

/**
Expand Down Expand Up @@ -67,7 +68,7 @@ export class AccountAccessKeyCache {

// nuke cache if it's too big.
if (Object.keys(map).length >= AccountAccessKeyCache.MAX_ENTRIES) {
map = { };
map = {};
}

map[accessKeyId] = account;
Expand All @@ -80,10 +81,14 @@ export class AccountAccessKeyCache {
} catch (e: any) {
// File doesn't exist or is not readable. This is a cache,
// pretend we successfully loaded an empty map.
if (e.code === 'ENOENT' || e.code === 'EACCES') { return {}; }
if (e.name === 'ENOENT' || e.name === 'EACCES') {
return {};
}
// File is not JSON, could be corrupted because of concurrent writes.
// Again, an empty cache is fine.
if (e instanceof SyntaxError) { return {}; }
if (e instanceof SyntaxError) {
return {};
}
throw e;
}
}
Expand All @@ -95,7 +100,9 @@ export class AccountAccessKeyCache {
} catch (e: any) {
// File doesn't exist or file/dir isn't writable. This is a cache,
// if we can't write it then too bad.
if (e.code === 'ENOENT' || e.code === 'EACCES' || e.code === 'EROFS') { return; }
if (e.name === 'ENOENT' || e.name === 'EACCES' || e.name === 'EROFS') {
return;
}
throw e;
}
}
Expand Down
175 changes: 0 additions & 175 deletions packages/aws-cdk/lib/api/aws-auth/aws-sdk-inifile.ts

This file was deleted.

Loading

0 comments on commit 4d941aa

Please sign in to comment.