Skip to content

Commit

Permalink
chore(credential-provider-imds): arrow fn in ImdsCredentials (#1317)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Jul 2, 2020
1 parent 85866ff commit 8b1afc6
Showing 1 changed file with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@ export interface ImdsCredentials {
Expiration: string;
}

export function isImdsCredentials(arg: any): arg is ImdsCredentials {
return (
Boolean(arg) &&
typeof arg === "object" &&
typeof arg.AccessKeyId === "string" &&
typeof arg.SecretAccessKey === "string" &&
typeof arg.Token === "string" &&
typeof arg.Expiration === "string"
);
}
export const isImdsCredentials = (arg: any): arg is ImdsCredentials =>
Boolean(arg) &&
typeof arg === "object" &&
typeof arg.AccessKeyId === "string" &&
typeof arg.SecretAccessKey === "string" &&
typeof arg.Token === "string" &&
typeof arg.Expiration === "string";

export function fromImdsCredentials(creds: ImdsCredentials): Credentials {
return {
accessKeyId: creds.AccessKeyId,
secretAccessKey: creds.SecretAccessKey,
sessionToken: creds.Token,
expiration: new Date(creds.Expiration)
};
}
export const fromImdsCredentials = (creds: ImdsCredentials): Credentials => ({
accessKeyId: creds.AccessKeyId,
secretAccessKey: creds.SecretAccessKey,
sessionToken: creds.Token,
expiration: new Date(creds.Expiration)
});

0 comments on commit 8b1afc6

Please sign in to comment.