Skip to content

Commit

Permalink
feat(cf/serverGroup): Use discriminator 'type' field to improve type …
Browse files Browse the repository at this point in the history
…checking (#6449)
  • Loading branch information
christopherthielen committed Jan 31, 2019
1 parent 201d445 commit 6bdd9b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ export class CloudFoundryServerGroupCommandBuilder {
routes: serverGroup.loadBalancers,
environment: CloudFoundryServerGroupCommandBuilder.envVarsFromObject(serverGroup.env),
services: (serverGroup.serviceInstances || []).map(serviceInstance => serviceInstance.name),
reference: '',
account: '',
pattern: '',
healthCheckType: '',
healthCheckHttpEndpoint: '',
};
command.region = serverGroup.region;
command.stack = serverGroup.stack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,32 @@ export interface ICloudFoundryCreateServerGroupCommand extends IServerGroupComma
}

export interface ICloudFoundryArtifactSource {
type: 'artifact';
reference: string;
account: string;
}

export interface ICloudFoundryPackageSource {
type: 'package';
clusterName: string;
serverGroupName: string;
account: string;
region: string;
}

export interface ICloudFoundryTriggerSource {
type: 'trigger';
pattern: string;
account: string; // optional: used in the event that retrieving an artifact from a trigger source requires auth
}

export type ICloudFoundryBinarySource = { type: string } & (
export type ICloudFoundryBinarySource =
| ICloudFoundryArtifactSource
| ICloudFoundryPackageSource
| ICloudFoundryTriggerSource);
| ICloudFoundryTriggerSource;

export interface ICloudFoundryManifestDirectSource {
type: 'direct';
memory: string;
diskQuota: string;
instances: number;
Expand All @@ -46,19 +50,21 @@ export interface ICloudFoundryManifestDirectSource {
}

export interface ICloudFoundryManifestArtifactSource {
type: 'artifact';
reference: string;
account: string;
}

export interface ICloudFoundryManifestTriggerSource {
type: 'trigger';
pattern: string;
account: string; // optional: used in the event that retrieving a manifest from a trigger source requires auth
}

export type ICloudFoundryManifestSource = { type: string } & (
export type ICloudFoundryManifestSource =
| ICloudFoundryManifestDirectSource
| ICloudFoundryManifestTriggerSource
| ICloudFoundryManifestArtifactSource);
| ICloudFoundryManifestArtifactSource;

export interface ICloudFoundryDeployConfiguration {
account: string;
Expand Down

0 comments on commit 6bdd9b0

Please sign in to comment.