Skip to content

Commit

Permalink
rename InstanceResourceModel into Instance
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-przybyl-wttech committed Mar 5, 2024
1 parent 81ca758 commit b125da3
Show file tree
Hide file tree
Showing 23 changed files with 447 additions and 447 deletions.
6 changes: 3 additions & 3 deletions examples/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
instanceResourceModel, err := compose.NewInstanceResourceModel(ctx, "instanceResourceModel", &compose.InstanceResourceModelArgs{
Client: &compose.ClientModelArgs{
aemInstance, err := compose.NewInstance(ctx, "aem_instance", &compose.InstanceArgs{
Client: &compose.ClientArgs{
Type: pulumi.String("ssh"),
Settings: pulumi.StringMap{
"host": pulumi.String("x.x.x.x"),
Expand All @@ -28,7 +28,7 @@ func main() {
return err
}
ctx.Export("output", pulumi.Map{
"aemInstances": instanceResourceModel.Instances,
"aemInstances": aemInstance.Instances,
})
return nil
})
Expand Down
10 changes: 5 additions & 5 deletions examples/go_aws_ssh/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ func main() {
return err
}

instanceResourceModel, err := compose.NewInstanceResourceModel(ctx, "aem_single", &compose.InstanceResourceModelArgs{
Client: compose.ClientModelArgs{
aemInstance, err := compose.NewInstance(ctx, "aem_instance", &compose.InstanceArgs{
Client: compose.ClientArgs{
Type: pulumi.String("ssh"),
Settings: pulumi.StringMap{
"host": instance.PublicIp,
Expand All @@ -124,7 +124,7 @@ func main() {
"private_key": pulumi.String(privateKey),
},
},
System: compose.SystemModelArgs{
System: compose.SystemArgs{
Data_dir: pulumi.String(composeDir),
Bootstrap: compose.InstanceScriptArgs{
Inline: pulumi.StringArray{
Expand All @@ -140,7 +140,7 @@ func main() {
},
},
},
Compose: compose.ComposeModelArgs{
Compose: compose.ComposeArgs{
Config: pulumi.String(configYML),
Create: compose.InstanceScriptArgs{
Inline: pulumi.StringArray{
Expand All @@ -165,7 +165,7 @@ func main() {

ctx.Export("output", pulumi.Map{
"instanceIp": instance.PublicIp,
"aemInstances": instanceResourceModel.Instances,
"aemInstances": aemInstance.Instances,
})
return nil
})
Expand Down
10 changes: 5 additions & 5 deletions examples/go_aws_ssm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ sudo dnf install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/late
return err
}

instanceResourceModel, err := compose.NewInstanceResourceModel(ctx, "aem_single", &compose.InstanceResourceModelArgs{
Client: compose.ClientModelArgs{
aemInstance, err := compose.NewInstance(ctx, "aem_instance", &compose.InstanceArgs{
Client: compose.ClientArgs{
Type: pulumi.String("aws-ssm"),
Settings: pulumi.StringMap{
"instance_id": instance.ID(),
},
},
System: compose.SystemModelArgs{
System: compose.SystemArgs{
Data_dir: pulumi.String(composeDir),
Bootstrap: compose.InstanceScriptArgs{
Inline: pulumi.StringArray{
Expand All @@ -121,7 +121,7 @@ sudo dnf install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/late
},
},
},
Compose: compose.ComposeModelArgs{
Compose: compose.ComposeArgs{
Create: compose.InstanceScriptArgs{
Inline: pulumi.StringArray{
pulumi.Sprintf("mkdir -p '%s/aem/home/lib'", composeDir),
Expand All @@ -145,7 +145,7 @@ sudo dnf install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/late

ctx.Export("output", pulumi.Map{
"instanceIp": instance.PublicIp,
"aemInstances": instanceResourceModel.Instances,
"aemInstances": aemInstance.Instances,
})
return nil
})
Expand Down
6 changes: 3 additions & 3 deletions examples/go_bare_metal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ var privateKey string

func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
instanceResourceModel, err := compose.NewInstanceResourceModel(ctx, "aem_single", &compose.InstanceResourceModelArgs{
Client: compose.ClientModelArgs{
aemInstance, err := compose.NewInstance(ctx, "aem_instance", &compose.InstanceArgs{
Client: compose.ClientArgs{
Type: pulumi.String("ssh"),
Settings: pulumi.StringMap{
"host": pulumi.String("x.x.x.x"),
Expand All @@ -33,7 +33,7 @@ func main() {
}

ctx.Export("output", pulumi.Map{
"aemInstances": instanceResourceModel.Instances,
"aemInstances": aemInstance.Instances,
})
return nil
})
Expand Down
6 changes: 3 additions & 3 deletions examples/nodejs/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as pulumi from "@pulumi/pulumi";
import * as aem from "@pulumi/aem";
import * as aem from "@wttech/aem";

const instanceResourceModel = new aem.compose.InstanceResourceModel("instanceResourceModel", {
const aemInstance = new aem.compose.Instance("aem_instance", {
client: {
type: "ssh",
settings: {
Expand All @@ -19,5 +19,5 @@ const instanceResourceModel = new aem.compose.InstanceResourceModel("instanceRes
},
});
export const output = {
aemInstances: instanceResourceModel.instances,
aemInstances: aemInstance.instances,
};
2 changes: 1 addition & 1 deletion examples/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"dependencies": {
"typescript": "^4.0.0",
"@pulumi/pulumi": "^3.0.0",
"@pulumi/aem": "0.0.1-alpha.1709303771+8ae75eae.dirty"
"@wttech/aem": "0.0.1-alpha.1699945013+97b0e04c"
}
}
4 changes: 2 additions & 2 deletions examples/nodejs_aws_ssh/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const volumeAttachment = new aws.ec2.VolumeAttachment("aem_single_data", {
instanceId: instance.id,
});

const instanceResourceModel = new aem.compose.InstanceResourceModel("aem_single", {
const aemInstance = new aem.compose.Instance("aem_instance", {
client: {
type: "ssh",
settings: {
Expand Down Expand Up @@ -126,5 +126,5 @@ const instanceResourceModel = new aem.compose.InstanceResourceModel("aem_single"

export const output = {
instanceIp: instance.publicIp,
aemInstances: instanceResourceModel.instances,
aemInstances: aemInstance.instances,
};
4 changes: 2 additions & 2 deletions examples/nodejs_aws_ssm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const volumeAttachment = new aws.ec2.VolumeAttachment("aem_single_data", {
instanceId: instance.id,
});

const instanceResourceModel = new aem.compose.InstanceResourceModel("aem_single", {
const aemInstance = new aem.compose.Instance("aem_instance", {
client: {
type: "aws-ssm",
settings: {
Expand Down Expand Up @@ -111,5 +111,5 @@ const instanceResourceModel = new aem.compose.InstanceResourceModel("aem_single"

export const output = {
instanceIp: instance.publicIp,
aemInstances: instanceResourceModel.instances,
aemInstances: aemInstance.instances,
};
4 changes: 2 additions & 2 deletions examples/nodejs_bare_metal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from "fs";

const privateKey = fs.readFileSync("ec2-key.cer", "utf8");

const instanceResourceModel = new aem.compose.InstanceResourceModel("aem_single", {
const aemInstance = new aem.compose.Instance("aem_instance", {
client: {
type: "ssh",
settings: {
Expand All @@ -22,5 +22,5 @@ const instanceResourceModel = new aem.compose.InstanceResourceModel("aem_single"
});

export const output = {
aemInstances: instanceResourceModel.instances,
aemInstances: aemInstance.instances,
};
6 changes: 3 additions & 3 deletions examples/yaml/Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ plugins:
path: ../../bin

resources:
instanceResourceModel:
type: aem:compose:InstanceResourceModel
aemInstance:
type: aem:compose:Instance
properties:
client:
type: "ssh"
Expand All @@ -23,4 +23,4 @@ resources:

outputs:
output:
aemInstances: ${instanceResourceModel.instances}
aemInstances: ${aemInstance.instances}
2 changes: 1 addition & 1 deletion provider/instance_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const (
ServiceName = "aem"
)

type InstanceClient ClientContext[InstanceResourceModelArgs]
type InstanceClient ClientContext[InstanceArgs]

func (ic *InstanceClient) Close() error {
return ic.cl.Disconnect()
Expand Down
12 changes: 6 additions & 6 deletions provider/instance_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ type InstanceResource struct {
clientManager *client.ClientManager
}

func (r *InstanceResource) Create(ctx p.Context, model InstanceResourceModelArgs) (*InstanceStatus, error) {
func (r *InstanceResource) Create(ctx p.Context, model InstanceArgs) (*InstanceStatus, error) {
return r.createOrUpdate(ctx, model, true)
}

func (r *InstanceResource) Update(ctx p.Context, model InstanceResourceModelArgs) (*InstanceStatus, error) {
func (r *InstanceResource) Update(ctx p.Context, model InstanceArgs) (*InstanceStatus, error) {
return r.createOrUpdate(ctx, model, false)
}

func (r *InstanceResource) createOrUpdate(ctx p.Context, model InstanceResourceModelArgs, create bool) (*InstanceStatus, error) {
func (r *InstanceResource) createOrUpdate(ctx p.Context, model InstanceArgs, create bool) (*InstanceStatus, error) {
ctx.Log(diag.Info, "Started setting up AEM instance resource")

ic, err := r.client(ctx, model, cast.ToDuration(model.Client.ActionTimeout))
Expand Down Expand Up @@ -90,7 +90,7 @@ func (r *InstanceResource) createOrUpdate(ctx p.Context, model InstanceResourceM
return &status, nil
}

func (r *InstanceResource) Delete(ctx p.Context, model InstanceResourceModelArgs) error {
func (r *InstanceResource) Delete(ctx p.Context, model InstanceArgs) error {
ctx.Log(diag.Info, "Started deleting AEM instance resource")

ic, err := r.client(ctx, model, cast.ToDuration(model.Client.StateTimeout))
Expand Down Expand Up @@ -119,7 +119,7 @@ func (r *InstanceResource) Delete(ctx p.Context, model InstanceResourceModelArgs
return nil
}

func (r *InstanceResource) client(ctx p.Context, model InstanceResourceModelArgs, timeout time.Duration) (*InstanceClient, error) {
func (r *InstanceResource) client(ctx p.Context, model InstanceArgs, timeout time.Duration) (*InstanceClient, error) {
typeName := model.Client.Type
ctx.Logf(diag.Info, "Connecting to AEM instance machine using %s", typeName)

Expand All @@ -144,7 +144,7 @@ func (r *InstanceResource) client(ctx p.Context, model InstanceResourceModelArgs
return &InstanceClient{cl, ctx, model}, nil
}

func (r *InstanceResource) clientSettings(model InstanceResourceModelArgs) map[string]string {
func (r *InstanceResource) clientSettings(model InstanceArgs) map[string]string {
settings := model.Client.Settings
credentials := model.Client.Credentials

Expand Down
Loading

0 comments on commit b125da3

Please sign in to comment.