Skip to content

Commit

Permalink
fix(containers): modernize (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
eladb authored Nov 14, 2023
1 parent 953410e commit ba7269c
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 22 deletions.
2 changes: 1 addition & 1 deletion containers/aws.w
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub class Aws {
accountData: aws.dataAwsCallerIdentity.DataAwsCallerIdentity;


init() {
new() {
this.regionData = new aws.dataAwsRegion.DataAwsRegion();
this.accountData = new aws.dataAwsCallerIdentity.DataAwsCallerIdentity();
}
Expand Down
2 changes: 1 addition & 1 deletion containers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/containers",
"version": "0.0.10",
"version": "0.0.11",
"description": "Container support for Wing",
"repository": {
"type": "git",
Expand Down
4 changes: 1 addition & 3 deletions containers/test/containers.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ let echo = new containers.Workload(

let httpGet = inflight (url: str?): str => {
if let url = url {
if let body = http.get(url).body {
return body;
}
return http.get(url).body;
}

throw "no body";
Expand Down
6 changes: 1 addition & 5 deletions containers/test/local-build.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@ let app = new containers.Workload(

test "can access container" {
let response = http.get("${app.publicUrl}");
if let body = response.body {
log(body);
}

assert((response.body ?? "") == "Hello, Wingnuts!");
assert(response.body == "Hello, Wingnuts!");
}
5 changes: 1 addition & 4 deletions containers/test/simple.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ new cloud.Function(inflight () => {
test "http get" {
if let url = app.publicUrl {
let response = http.get(url);
log(response.body ?? "");
if let body = response.body {
assert(body.contains("bang_bang"));
}
assert(response.body.contains("bang_bang"));
}
}
2 changes: 1 addition & 1 deletion containers/tfaws-ecr.w
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub class Repository {
pub image: str;
pub deps: Array<cdktf.ITerraformDependable>;

init(props: RepositoryProps) {
new(props: RepositoryProps) {
let deps = MutArray<cdktf.ITerraformDependable>[];

let count = 5;
Expand Down
4 changes: 2 additions & 2 deletions containers/tfaws-eks.w
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub class ClusterBase impl ICluster {
class ClusterRef extends ClusterBase impl ICluster {
_attributes: ClusterAttributes;

init(attributes: ClusterAttributes) {
new(attributes: ClusterAttributes) {
this._attributes = attributes;
}

Expand Down Expand Up @@ -115,7 +115,7 @@ pub class Cluster extends ClusterBase impl ICluster {

vpc: vpc.Vpc;

init(clusterName: str) {
new(clusterName: str) {
let privateSubnetTags = MutMap<str>{};
privateSubnetTags.set("kubernetes.io/role/internal-elb", "1");
privateSubnetTags.set("kubernetes.io/cluster/${clusterName}", "shared");
Expand Down
2 changes: 1 addition & 1 deletion containers/tfaws-vpc.w
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub class Vpc {
pub privateSubnets: Array<str>;
pub publicSubnets: Array<str>;

init(props: VpcProps?) {
new(props: VpcProps?) {
let available = new aws.dataAwsAvailabilityZones.DataAwsAvailabilityZones(filter: {
name: "opt-in-status",
values: ["opt-in-not-required"]
Expand Down
2 changes: 1 addition & 1 deletion containers/workload.sim.w
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub class Workload_sim impl api.IWorkload {
public: bool;
state: sim.State;

init(props: api.WorkloadProps) {
new(props: api.WorkloadProps) {
this.appDir = utils.entrypointDir(this);
this.props = props;
this.state = new sim.State();
Expand Down
4 changes: 2 additions & 2 deletions containers/workload.tfaws.w
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub class Workload_tfaws impl api.IWorkload {
internalUrl: str?;
publicUrl: str?;

init(props: api.WorkloadProps) {
new(props: api.WorkloadProps) {
let cluster = eks.Cluster.getOrCreate(this);

let var image = props.image;
Expand All @@ -36,7 +36,7 @@ pub class Workload_tfaws impl api.IWorkload {
class _Chart extends cdk8s.Chart {
name: str;

init(props: api.WorkloadProps) {
new(props: api.WorkloadProps) {
let env = props.env ?? {};
let envVariables = MutMap<plus.EnvValue>{};

Expand Down
2 changes: 1 addition & 1 deletion containers/workload.w
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub class Workload impl api.IWorkload {
pub internalUrl: str?;
pub publicUrl: str?;

init(props: api.WorkloadProps) {
new(props: api.WorkloadProps) {
let target = util.env("WING_TARGET");

if target == "sim" {
Expand Down

0 comments on commit ba7269c

Please sign in to comment.