@atomist/cortex
Version:
Atomist Cortex model TypeScript typings
118 lines (104 loc) • 3.24 kB
text/typescript
/*
* Copyright 2015-2017 Atomist Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as environmentApi from "../Environment";
import { K8Spec } from "./K8Spec";
export { Environment };
/**
* Type Environment
* Generated class exposing Atomist Cortex.
* Fluent builder style class for use in testing and query by example.
*/
class Environment implements environmentApi.Environment {
private _name: string;
private _specs: K8Spec[];
private _vpcName: string;
private _nodeName = "Environment";
private _nodeTags = [ "Environment", "-dynamic" ];
/**
* Implementation of GraphNode interface method.
* For infrastructure, not user use
*/
public nodeName(): string {
return this._nodeName;
}
/**
* Implementation of GraphNode interface method.
* For infrastructure, not user use
*/
public nodeTags(): string[] {
return this._nodeTags;
}
/**
* name
*
* @property {string} name
*/
get name(): string {
if (this._name === undefined) {
throw new Error(`Please use the relevant builder method to set property [name] on stub ` +
`[Environment] before accessing it. It's probably called [withName]`);
}
return this._name;
}
/**
* Fluent builder method to set the name property
*/
public withName(name_: string) {
this._name = name_;
return this;
}
/**
* specs - Environment -> K8Spec
*
* @property {K8Spec[]} specs
*/
get specs(): K8Spec[] {
if (this._specs === undefined) {
throw new Error(`Please use the relevant builder method to set property [specs] on stub ` +
`[Environment] before accessing it. It's probably called [withSpecs]`);
}
return this._specs;
}
/**
* Fluent builder method to add an element to the specs array
*/
public addSpecs(...specs_: K8Spec[]) {
if (this._specs === undefined) {
this._specs = [];
}
this._specs = this._specs.concat(specs_);
return this;
}
/**
* vpcName
*
* @property {string} vpcName
*/
get vpcName(): string {
if (this._vpcName === undefined) {
throw new Error(`Please use the relevant builder method to set property [vpcName] on stub ` +
`[Environment] before accessing it. It's probably called [withVpcName]`);
}
return this._vpcName;
}
/**
* Fluent builder method to set the vpcName property
*/
public withVpcName(vpcName_: string) {
this._vpcName = vpcName_;
return this;
}
}