@atomist/cortex
Version:
Atomist Cortex model TypeScript typings
142 lines (126 loc) • 3.83 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 dockerImageApi from "../DockerImage";
import { K8Pod } from "./K8Pod";
import { K8Spec } from "./K8Spec";
import { Tag } from "./Tag";
export { DockerImage };
/**
* Type DockerImage
* Generated class exposing Atomist Cortex.
* Fluent builder style class for use in testing and query by example.
*/
class DockerImage implements dockerImageApi.DockerImage {
private _image: string;
private _pods: K8Pod[];
private _spec: K8Spec;
private _tag: Tag;
private _nodeName = "DockerImage";
private _nodeTags = [ "DockerImage", "-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;
}
/**
* image
*
* @property {string} image
*/
get image(): string {
if (this._image === undefined) {
throw new Error(`Please use the relevant builder method to set property [image] on stub ` +
`[DockerImage] before accessing it. It's probably called [withImage]`);
}
return this._image;
}
/**
* Fluent builder method to set the image property
*/
public withImage(image_: string) {
this._image = image_;
return this;
}
/**
* pods - DockerImage -> K8Pod
*
* @property {K8Pod[]} pods
*/
get pods(): K8Pod[] {
if (this._pods === undefined) {
throw new Error(`Please use the relevant builder method to set property [pods] on stub ` +
`[DockerImage] before accessing it. It's probably called [withPods]`);
}
return this._pods;
}
/**
* Fluent builder method to add an element to the pods array
*/
public addPods(...pods_: K8Pod[]) {
if (this._pods === undefined) {
this._pods = [];
}
this._pods = this._pods.concat(pods_);
return this;
}
/**
* spec - DockerImage -> K8Spec
*
* @property {K8Spec} spec
*/
get spec(): K8Spec {
if (this._spec === undefined) {
throw new Error(`Please use the relevant builder method to set property [spec] on stub ` +
`[DockerImage] before accessing it. It's probably called [withSpec]`);
}
return this._spec;
}
/**
* Fluent builder method to set the spec property
*/
public withSpec(spec_: K8Spec) {
this._spec = spec_;
return this;
}
/**
* tag - DockerImage -> Tag
*
* @property {Tag} tag
*/
get tag(): Tag {
if (this._tag === undefined) {
throw new Error(`Please use the relevant builder method to set property [tag] on stub ` +
`[DockerImage] before accessing it. It's probably called [withTag]`);
}
return this._tag;
}
/**
* Fluent builder method to set the tag property
*/
public withTag(tag_: Tag) {
this._tag = tag_;
return this;
}
}