Skip to content

Commit 6de2296

Browse files
authored
Scripts (#4)
* script data source * script resource, tests, docs, client update * added IDs for script tests * Fixed error handilng in device resource * Typos corrections * docs fixes
1 parent 17b44ff commit 6de2296

File tree

19 files changed

+586
-47
lines changed

19 files changed

+586
-47
lines changed

IDs_for_test.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ Device Group:
2121

2222
Device:
2323
1601809 - Test device
24-
1601810 - Test device2
24+
1601810 - Test device2
25+
26+
Scripts:
27+
5727 - Test script
28+
5728 - Test script 2

docs/data-sources/script.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "simplemdm_script Data Source - simplemdm"
4+
subcategory: ""
5+
description: |-
6+
Script data source can be used together with Script Jobs(s).
7+
---
8+
9+
# simplemdm_script (Data Source)
10+
11+
Script data source can be used together with Script Jobs(s).
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "simplemdm_script" "script" {
17+
id = "123456"
18+
}
19+
```
20+
21+
<!-- schema generated by tfplugindocs -->
22+
## Schema
23+
24+
### Required
25+
26+
- `id` (String) The ID of the Script.
27+
28+
### Read-Only
29+
30+
- `name` (String) The name of the Script.

docs/resources/script.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "simplemdm_script Resource - simplemdm"
4+
subcategory: ""
5+
description: |-
6+
Script resource can be used to manage Scripts.
7+
---
8+
9+
# simplemdm_script (Resource)
10+
11+
Script resource can be used to manage Scripts.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "simplemdm_script" "test" {
17+
name = "This is test script"
18+
scriptfile = "./testfiles/testscript.sh"
19+
filesha = filesha256("./testfiles/testscript.sh")
20+
variablesupport = true
21+
}
22+
```
23+
24+
<!-- schema generated by tfplugindocs -->
25+
## Schema
26+
27+
### Required
28+
29+
- `filesha` (String) Required. The script file. Example: ${filesha256("./scripts/myscript.sh")}
30+
- `name` (String) Required. A name for the Script. Example "My First Script managed by terraform"
31+
- `scriptfile` (String) Required. The script file. Example: "./scripts/myscript.sh"
32+
33+
### Optional
34+
35+
- `variablesupport` (Boolean) Optional. A boolean true or false. Whether or not to enable variable support in this script. Defaults to false
36+
37+
### Read-Only
38+
39+
- `content` (String) Content of a Script in SimpleMDM
40+
- `created_at` (String) Date when script was created in SimpleMDM
41+
- `id` (String) ID of a Script in SimpleMDM
42+
- `updated_at` (String) Date when script was updated in SimpleMDM
43+
44+
## Import
45+
46+
Import is supported using the following syntax:
47+
48+
```shell
49+
# devicegroup can be imported by specifying the numeric identifier.
50+
terraform import simplemdm_script.example 123456
51+
```
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data "simplemdm_script" "script" {
2+
id = "123456"
3+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# devicegroup can be imported by specifying the numeric identifier.
2+
terraform import simplemdm_script.example 123456
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
resource "simplemdm_script" "test" {
2+
name = "This is test script"
3+
scriptfile = "./testfiles/testscript.sh"
4+
filesha = filesha256("./testfiles/testscript.sh")
5+
variablesupport = true
6+
}

go.mod

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/DavidKrau/terraform-provider-simplemdm
33
go 1.22.2
44

55
require (
6-
github.com/DavidKrau/simplemdm-go-client v0.1.0
6+
github.com/DavidKrau/simplemdm-go-client v0.1.2
77
github.com/hashicorp/terraform-plugin-framework v1.8.0
88
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
99
github.com/hashicorp/terraform-plugin-go v0.23.0
@@ -24,7 +24,7 @@ require (
2424
github.com/bgentry/speakeasy v0.1.0 // indirect
2525
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
2626
github.com/cloudflare/circl v1.3.7 // indirect
27-
github.com/fatih/color v1.16.0 // indirect
27+
github.com/fatih/color v1.17.0 // indirect
2828
github.com/golang/protobuf v1.5.4 // indirect
2929
github.com/google/go-cmp v0.6.0 // indirect
3030
github.com/google/uuid v1.6.0 // indirect
@@ -37,13 +37,13 @@ require (
3737
github.com/hashicorp/go-multierror v1.1.1 // indirect
3838
github.com/hashicorp/go-plugin v1.6.1 // indirect
3939
github.com/hashicorp/go-uuid v1.0.3 // indirect
40-
github.com/hashicorp/go-version v1.6.0 // indirect
41-
github.com/hashicorp/hc-install v0.6.4 // indirect
40+
github.com/hashicorp/go-version v1.7.0 // indirect
41+
github.com/hashicorp/hc-install v0.7.0 // indirect
4242
github.com/hashicorp/hcl/v2 v2.20.0 // indirect
4343
github.com/hashicorp/logutils v1.0.0 // indirect
44-
github.com/hashicorp/terraform-exec v0.20.0 // indirect
45-
github.com/hashicorp/terraform-json v0.21.0 // indirect
46-
github.com/hashicorp/terraform-plugin-docs v0.19.2 // indirect
44+
github.com/hashicorp/terraform-exec v0.21.0 // indirect
45+
github.com/hashicorp/terraform-json v0.22.1 // indirect
46+
github.com/hashicorp/terraform-plugin-docs v0.19.3 // indirect
4747
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 // indirect
4848
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
4949
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
@@ -74,14 +74,14 @@ require (
7474
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
7575
golang.org/x/crypto v0.23.0 // indirect
7676
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
77-
golang.org/x/mod v0.16.0 // indirect
77+
golang.org/x/mod v0.17.0 // indirect
7878
golang.org/x/net v0.25.0 // indirect
7979
golang.org/x/sys v0.20.0 // indirect
8080
golang.org/x/text v0.15.0 // indirect
8181
golang.org/x/tools v0.13.0 // indirect
8282
google.golang.org/appengine v1.6.8 // indirect
83-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434 // indirect
84-
google.golang.org/grpc v1.63.2 // indirect
83+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 // indirect
84+
google.golang.org/grpc v1.64.0 // indirect
8585
google.golang.org/protobuf v1.34.1 // indirect
8686
gopkg.in/yaml.v2 v2.3.0 // indirect
8787
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
22
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
33
github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
44
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
5-
github.com/DavidKrau/simplemdm-go-client v0.1.0 h1:Lns8FH2dm32HYJ+pmZw8oT8hwQN4N8uOewvyAudG/GI=
6-
github.com/DavidKrau/simplemdm-go-client v0.1.0/go.mod h1:tIrL/8ckUf4o2nmW9KCK91uDO3477WV+MEP77QYD0R0=
5+
github.com/DavidKrau/simplemdm-go-client v0.1.2 h1:N8QDhTiCS+Ou/Y/bI0paEqkF3lWF1nEGgH3OJTY9ViA=
6+
github.com/DavidKrau/simplemdm-go-client v0.1.2/go.mod h1:tIrL/8ckUf4o2nmW9KCK91uDO3477WV+MEP77QYD0R0=
77
github.com/Kunde21/markdownfmt/v3 v3.1.0 h1:KiZu9LKs+wFFBQKhrZJrFZwtLnCCWJahL+S+E/3VnM0=
88
github.com/Kunde21/markdownfmt/v3 v3.1.0/go.mod h1:tPXN1RTyOzJwhfHoon9wUr4HGYmWgVxSQN6VBJDkrVc=
99
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
@@ -40,8 +40,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
4040
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
4141
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
4242
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
43-
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
44-
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
43+
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
44+
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
4545
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
4646
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
4747
github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
@@ -88,18 +88,26 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C
8888
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
8989
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
9090
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
91+
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
92+
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
9193
github.com/hashicorp/hc-install v0.6.4 h1:QLqlM56/+SIIGvGcfFiwMY3z5WGXT066suo/v9Km8e0=
9294
github.com/hashicorp/hc-install v0.6.4/go.mod h1:05LWLy8TD842OtgcfBbOT0WMoInBMUSHjmDx10zuBIA=
95+
github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC1659aBk=
96+
github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA=
9397
github.com/hashicorp/hcl/v2 v2.20.0 h1:l++cRs/5jQOiKVvqXZm/P1ZEfVXJmvLS9WSVxkaeTb4=
9498
github.com/hashicorp/hcl/v2 v2.20.0/go.mod h1:WmcD/Ym72MDOOx5F62Ly+leloeu6H7m0pG7VBiU6pQk=
9599
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
96100
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
97101
github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8JyYF3vpnuEo=
98102
github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw=
103+
github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ=
104+
github.com/hashicorp/terraform-exec v0.21.0/go.mod h1:1PPeMYou+KDUSSeRE9szMZ/oHf4fYUmB923Wzbq1ICg=
99105
github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U=
100106
github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk=
101-
github.com/hashicorp/terraform-plugin-docs v0.19.2 h1:YjdKa1vuqt9EnPYkkrv9HnGZz175HhSJ7Vsn8yZeWus=
102-
github.com/hashicorp/terraform-plugin-docs v0.19.2/go.mod h1:gad2aP6uObFKhgNE8DR9nsEuEQnibp7il0jZYYOunWY=
107+
github.com/hashicorp/terraform-json v0.22.1 h1:xft84GZR0QzjPVWs4lRUwvTcPnegqlyS7orfb5Ltvec=
108+
github.com/hashicorp/terraform-json v0.22.1/go.mod h1:JbWSQCLFSXFFhg42T7l9iJwdGXBYV8fmmD6o/ML4p3A=
109+
github.com/hashicorp/terraform-plugin-docs v0.19.3 h1:xoxpeIuBfnoGxXY0dTajdj4GjEv6TihZdj0lHNXbKew=
110+
github.com/hashicorp/terraform-plugin-docs v0.19.3/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA=
103111
github.com/hashicorp/terraform-plugin-framework v1.8.0 h1:P07qy8RKLcoBkCrY2RHJer5AEvJnDuXomBgou6fD8kI=
104112
github.com/hashicorp/terraform-plugin-framework v1.8.0/go.mod h1:/CpTukO88PcL/62noU7cuyaSJ4Rsim+A/pa+3rUVufY=
105113
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc=
@@ -217,6 +225,8 @@ golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N0
217225
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
218226
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
219227
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
228+
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
229+
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
220230
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
221231
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
222232
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
@@ -265,10 +275,10 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
265275
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
266276
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
267277
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
268-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434 h1:umK/Ey0QEzurTNlsV3R+MfxHAb78HCEX/IkuR+zH4WQ=
269-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434/go.mod h1:I7Y+G38R2bu5j1aLzfFmQfTcU/WnFuqDwLZAbvKTKpM=
270-
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
271-
google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
278+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5 h1:Q2RxlXqh1cgzzUgV261vBO2jI5R/3DD1J2pM0nI4NhU=
279+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240520151616-dc85e6b867a5/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
280+
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
281+
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
272282
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
273283
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
274284
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=

provider/attribute_resourse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (r *attributeResource) Delete(ctx context.Context, req resource.DeleteReque
186186
return
187187
}
188188

189-
// Delete existing order
189+
// Delete existing attribute
190190
err := r.client.AttributeDelete(state.Name.ValueString())
191191
if err != nil {
192192
resp.Diagnostics.AddError(

provider/customProfile_resourse.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import (
1616

1717
// Ensure the implementation satisfies the expected interfaces.
1818
var (
19-
_ resource.Resource = &profileResource{}
20-
_ resource.ResourceWithConfigure = &profileResource{}
21-
_ resource.ResourceWithImportState = &profileResource{}
19+
_ resource.Resource = &customProfileResource{}
20+
_ resource.ResourceWithConfigure = &customProfileResource{}
21+
_ resource.ResourceWithImportState = &customProfileResource{}
2222
)
2323

2424
// profileResourceModel maps the resource schema data.
25-
type profileResourceModel struct {
25+
type customProfileResourceModel struct {
2626
Name types.String `tfsdk:"name"`
2727
MobileConfig types.String `tfsdk:"mobileconfig"`
2828
FileSHA types.String `tfsdk:"filesha"`
@@ -35,16 +35,16 @@ type profileResourceModel struct {
3535

3636
// ProfileResource is a helper function to simplify the provider implementation.
3737
func CustomProfileResource() resource.Resource {
38-
return &profileResource{}
38+
return &customProfileResource{}
3939
}
4040

4141
// profileResource is the resource implementation.
42-
type profileResource struct {
42+
type customProfileResource struct {
4343
client *simplemdm.Client
4444
}
4545

4646
// Configure adds the provider configured client to the resource.
47-
func (r *profileResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
47+
func (r *customProfileResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
4848
if req.ProviderData == nil {
4949
return
5050
}
@@ -53,12 +53,12 @@ func (r *profileResource) Configure(_ context.Context, req resource.ConfigureReq
5353
}
5454

5555
// Metadata returns the resource type name.
56-
func (r *profileResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
56+
func (r *customProfileResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
5757
resp.TypeName = req.ProviderTypeName + "_customprofile"
5858
}
5959

6060
// Schema defines the schema for the resource.
61-
func (r *profileResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
61+
func (r *customProfileResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
6262
resp.Schema = schema.Schema{
6363
Description: "Custom Profile resource can be used to manage Custom Profile. Can be used together with Device(s), Assignment Group(s) or Device Group(s) and set addition details regarding Custom Profile.",
6464
Attributes: map[string]schema.Attribute{
@@ -112,15 +112,15 @@ func (r *profileResource) Schema(_ context.Context, _ resource.SchemaRequest, re
112112
}
113113
}
114114

115-
func (r *profileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
115+
func (r *customProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
116116
// Retrieve import ID and save to id attribute
117117
resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
118118
}
119119

120120
// Create a new resource
121-
func (r *profileResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
121+
func (r *customProfileResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
122122
//Retrieve values from plan
123-
var plan profileResourceModel
123+
var plan customProfileResourceModel
124124
diags := req.Plan.Get(ctx, &plan)
125125
resp.Diagnostics.Append(diags...)
126126
if resp.Diagnostics.HasError() {
@@ -148,9 +148,9 @@ func (r *profileResource) Create(ctx context.Context, req resource.CreateRequest
148148
}
149149
}
150150

151-
func (r *profileResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
151+
func (r *customProfileResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
152152
// Get current state
153-
var state profileResourceModel
153+
var state customProfileResourceModel
154154
diags := req.State.Get(ctx, &state)
155155
resp.Diagnostics.Append(diags...)
156156
if resp.Diagnostics.HasError() {
@@ -215,9 +215,9 @@ func (r *profileResource) Read(ctx context.Context, req resource.ReadRequest, re
215215
}
216216
}
217217

218-
func (r *profileResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
218+
func (r *customProfileResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
219219
//Retrieve values from plan
220-
var plan profileResourceModel
220+
var plan customProfileResourceModel
221221
diags := req.Plan.Get(ctx, &plan)
222222
resp.Diagnostics.Append(diags...)
223223
if resp.Diagnostics.HasError() {
@@ -241,15 +241,15 @@ func (r *profileResource) Update(ctx context.Context, req resource.UpdateRequest
241241
}
242242
}
243243

244-
func (r *profileResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
245-
var state profileResourceModel
244+
func (r *customProfileResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
245+
var state customProfileResourceModel
246246
diags := req.State.Get(ctx, &state)
247247
resp.Diagnostics.Append(diags...)
248248
if resp.Diagnostics.HasError() {
249249
return
250250
}
251251

252-
// Delete existing order
252+
// Delete existing custom profile
253253
err := r.client.CustomProfileDelete(state.ID.ValueString())
254254
if err != nil {
255255
resp.Diagnostics.AddError(

0 commit comments

Comments
 (0)