prefer interfaces over types for object-like specs

This commit is contained in:
evanboyle 2020-10-07 18:31:55 -07:00 committed by Evan Boyle
parent 9f4461db37
commit 73a5516958
4 changed files with 39 additions and 39 deletions

View file

@ -16,10 +16,10 @@
* ConfigValue is the input/output of a `pulumi config` command.
* It has a plaintext value, and an option boolean indicating secretness.
*/
export type ConfigValue = {
export interface ConfigValue {
value: string;
secret?: boolean;
};
}
/**
* ConfigMap is a map of string to ConfigValue

View file

@ -522,38 +522,38 @@ export interface LocalProgramArgs {
* Extensibility options to configure a LocalWorkspace; e.g: settings to seed
* and environment variables to pass through to every command.
*/
export type LocalWorkspaceOptions = {
export interface LocalWorkspaceOptions {
/**
* The directory to run Pulumi commands and read settings (Pulumi.yaml and Pulumi.<stack>.yaml)l.
*/
workDir?: string,
workDir?: string;
/**
* The directory to override for CLI metadata
*/
pulumiHome?: string,
pulumiHome?: string;
/**
* The inline program `PulumiFn` to be used for Preview/Update operations if any.
* If none is specified, the stack will refer to ProjectSettings for this information.
*/
program?: PulumiFn,
program?: PulumiFn;
/**
* Environment values scoped to the current workspace. These will be supplied to every Pulumi command.
*/
envVars?: { [key: string]: string },
envVars?: { [key: string]: string };
/**
* The secrets provider to use for encryption and decryption of stack secrets.
* See: https://www.pulumi.com/docs/intro/concepts/config/#available-encryption-providers
*/
secretsProvider?: string,
secretsProvider?: string;
/**
* The settings object for the current project.
*/
projectSettings?: ProjectSettings,
projectSettings?: ProjectSettings;
/**
* A map of Stack names and corresponding settings objects.
*/
stackSettings?: { [key: string]: StackSettings },
};
stackSettings?: { [key: string]: StackSettings };
}
/**
* Returns true if the provided `args` object satisfies the `LocalProgramArgs` interface.

View file

@ -458,14 +458,14 @@ export function fullyQualifiedStackName(org: string, project: string, stack: str
return `${org}/${project}/${stack}`;
}
export type OutputValue = {
export interface OutputValue {
value: any;
secret: boolean;
};
}
export type OutputMap = { [key: string]: OutputValue };
export type UpdateSummary = {
export interface UpdateSummary {
// pre-update info
kind: UpdateKind;
startTime: Date;
@ -479,7 +479,7 @@ export type UpdateSummary = {
version: number;
Deployment?: RawJSON;
resourceChanges?: OpMap;
};
}
/**
* The kind of update that was performed on the stack.
@ -511,44 +511,44 @@ export type RawJSON = string;
/**
* The deployment output from running a Pulumi program update.
*/
export type UpResult = {
export interface UpResult {
stdout: string;
stderr: string;
outputs: OutputMap;
summary: UpdateSummary;
};
}
/**
* Output from running a Pulumi program preview.
*/
export type PreviewResult = {
export interface PreviewResult {
stdout: string;
stderr: string;
summary: UpdateSummary;
};
}
/**
* Output from refreshing the resources in a given Stack.
*/
export type RefreshResult = {
export interface RefreshResult {
stdout: string;
stderr: string;
summary: UpdateSummary;
};
}
/**
* Output from destroying all resources in a Stack.
*/
export type DestroyResult = {
export interface DestroyResult {
stdout: string;
stderr: string;
summary: UpdateSummary;
};
}
/**
* Options controlling the behavior of a Stack.up() operation.
*/
export type UpOptions = {
export interface UpOptions {
parallel?: number;
message?: string;
expectNoChanges?: boolean;
@ -557,12 +557,12 @@ export type UpOptions = {
targetDependents?: boolean;
onOutput?: (out: string) => void;
program?: PulumiFn;
};
}
/**
* Options controlling the behavior of a Stack.preview() operation.
*/
export type PreviewOptions = {
export interface PreviewOptions {
parallel?: number;
message?: string;
expectNoChanges?: boolean;
@ -570,29 +570,29 @@ export type PreviewOptions = {
target?: string[];
targetDependents?: boolean;
program?: PulumiFn;
};
}
/**
* Options controlling the behavior of a Stack.refresh() operation.
*/
export type RefreshOptions = {
export interface RefreshOptions {
parallel?: number;
message?: string;
expectNoChanges?: boolean;
target?: string[];
onOutput?: (out: string) => void;
};
}
/**
* Options controlling the behavior of a Stack.destroy() operation.
*/
export type DestroyOptions = {
export interface DestroyOptions {
parallel?: number;
message?: string;
target?: string[];
targetDependents?: boolean;
onOutput?: (out: string) => void;
};
}
const execKind = {
local: "auto.local",

View file

@ -172,14 +172,14 @@ export interface Workspace {
/**
* A summary of the status of a given stack.
*/
export type StackSummary = {
name: string,
current: boolean,
lastUpdate?: string,
updateInProgress: boolean,
resourceCount?: number,
url?: string,
};
export interface StackSummary {
name: string;
current: boolean;
lastUpdate?: string;
updateInProgress: boolean;
resourceCount?: number;
url?: string;
}
/**
* A Pulumi program as an inline function (in process).