Skip to content

Commit 8ebdd42

Browse files
authored
Merge pull request #28 from fnaoto/2022-12-01
2022 12 01
2 parents 3b398d9 + 6206d61 commit 8ebdd42

32 files changed

+643
-564
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,39 @@
1-
# This GitHub action can publish assets for release when a tag is created.
2-
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
3-
#
4-
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
5-
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
6-
# secret. If you would rather own your own GPG handling, please fork this action
7-
# or use an alternative one for key handling.
8-
#
9-
# You will need to pass the `--batch` flag to `gpg` in your signing step
10-
# in `goreleaser` to indicate this is being used in a non-interactive mode.
11-
#
121
name: release
2+
133
on:
144
push:
155
tags:
166
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
1711
jobs:
1812
goreleaser:
1913
runs-on: ubuntu-latest
2014
steps:
2115
-
2216
name: Checkout
23-
uses: actions/checkout@v2
17+
uses: actions/checkout@v3
2418
-
2519
name: Unshallow
2620
run: git fetch --prune --unshallow
2721
-
2822
name: Set up Go
29-
uses: actions/setup-go@v2
23+
uses: actions/setup-go@v3
3024
with:
31-
go-version: 1.14
25+
go-version-file: 'go.mod'
26+
cache: true
3227
-
3328
name: Import GPG key
29+
uses: crazy-max/ghaction-import-gpg@v5
3430
id: import_gpg
35-
uses: hashicorp/[email protected]
36-
env:
37-
# These secrets will need to be configured for the repository:
38-
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
39-
PASSPHRASE: ${{ secrets.PASSPHRASE }}
31+
with:
32+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
33+
passphrase: ${{ secrets.PASSPHRASE }}
4034
-
4135
name: Run GoReleaser
42-
uses: goreleaser/goreleaser-action@v2
36+
uses: goreleaser/goreleaser-action@v3.2.0
4337
with:
4438
version: latest
4539
args: release --rm-dist

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ TEST?=$$(go list ./... | grep -v 'vendor')
22
NAME=deploygate
33
BINARY=terraform-provider-${NAME}
44
VERSION=0.1
5-
OS_ARCH=darwin_amd64
5+
OS_ARCH?=darwin_amd64
66
EXAMPLES=examples
77

88
default: install
@@ -41,3 +41,8 @@ examples: install
4141
terraform plan $(EXAMPLES)
4242
terraform apply $(EXAMPLES)
4343
terraform destroy $(EXAMPLES)
44+
45+
docs:
46+
go generate ./...
47+
48+
.PHONY: docs examples testacc test install build release

deploygate/config.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,19 @@ func (cfg *Config) initClient() error {
1919
}
2020
return nil
2121
}
22+
23+
func converEnterpriseMemberToMember(members []go_deploygate.EnterpriseMember) []go_deploygate.Member {
24+
var users []go_deploygate.Member
25+
26+
for _, member := range members {
27+
user := go_deploygate.Member{
28+
Type: member.Type,
29+
Name: member.Name,
30+
IconUrl: member.IconUrl,
31+
Url: member.Url,
32+
}
33+
users = append(users, user)
34+
}
35+
36+
return users
37+
}

deploygate/data_source_enterprise_member.go

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,39 @@ import (
1010

1111
func dataSourceEnterpriseMember() *schema.Resource {
1212
return &schema.Resource{
13-
Read: dataSourceEnterpriseMemberRead,
13+
Description: "Retrieves informantion about a existing enterprise member.",
14+
Read: dataSourceEnterpriseMemberRead,
1415
Schema: map[string]*schema.Schema{
1516
"enterprise": {
16-
Type: schema.TypeString,
17-
Required: true,
17+
Description: "Name of the enterprise. [Check your enterprises](https://deploygate.com/enterprises)",
18+
Type: schema.TypeString,
19+
Required: true,
1820
},
1921
"users": {
20-
Type: schema.TypeSet,
21-
Computed: true,
22+
Description: "Data of the enterprise users.",
23+
Type: schema.TypeSet,
24+
Computed: true,
2225
Elem: &schema.Resource{
2326
Schema: map[string]*schema.Schema{
2427
"type": {
25-
Type: schema.TypeString,
26-
Optional: true,
28+
Description: "Type of the user that is user or tester.",
29+
Type: schema.TypeString,
30+
Optional: true,
2731
},
2832
"name": {
29-
Type: schema.TypeString,
30-
Optional: true,
33+
Description: "Name of the user",
34+
Type: schema.TypeString,
35+
Optional: true,
3136
},
3237
"icon_url": {
33-
Type: schema.TypeString,
34-
Optional: true,
38+
Description: "Icon URL for user profile.",
39+
Type: schema.TypeString,
40+
Optional: true,
3541
},
3642
"url": {
37-
Type: schema.TypeString,
38-
Optional: true,
39-
},
40-
"full_name": {
41-
Type: schema.TypeString,
42-
Optional: true,
43-
},
44-
"email": {
45-
Type: schema.TypeString,
46-
Optional: true,
47-
},
48-
"role": {
49-
Type: schema.TypeString,
50-
Optional: true,
51-
},
52-
"created_at": {
53-
Type: schema.TypeString,
54-
Optional: true,
55-
},
56-
"last_access_at": {
57-
Type: schema.TypeString,
58-
Optional: true,
43+
Description: "URL of the user account.",
44+
Type: schema.TypeString,
45+
Optional: true,
5946
},
6047
},
6148
},
@@ -71,18 +58,20 @@ func dataSourceEnterpriseMemberRead(d *schema.ResourceData, meta interface{}) er
7158

7259
log.Printf("[DEBUG] dataSourceEnterpriseMemberRead: %s", enterprise)
7360

74-
e := &go_deploygate.ListEnterpriseMembersRequest{
61+
req := &go_deploygate.ListEnterpriseMembersRequest{
7562
Enterprise: enterprise,
7663
}
7764

78-
rs, err := client.ListEnterpriseMembers(e)
65+
resp, err := client.ListEnterpriseMembers(req)
7966

8067
if err != nil {
8168
return err
8269
}
8370

71+
users := converEnterpriseMemberToMember(resp.Users)
72+
8473
d.SetId(fmt.Sprintf("%s", enterprise))
85-
d.Set("users", rs.Users)
74+
d.Set("users", users)
8675

8776
return nil
8877
}

deploygate/data_source_organization_member.go

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,40 @@ import (
1010

1111
func dataSourceOrganizationMember() *schema.Resource {
1212
return &schema.Resource{
13-
Read: dataSourceOrganizationMemberRead,
13+
Description: "Retrieves informantion about a existing organization member.",
14+
Read: dataSourceOrganizationMemberRead,
1415

1516
Schema: map[string]*schema.Schema{
1617
"organization": {
17-
Type: schema.TypeString,
18-
Required: true,
18+
Description: "Name of the organization. [Check your organizations](https://deploygate.com/organizations)",
19+
Type: schema.TypeString,
20+
Required: true,
1921
},
2022
"members": {
21-
Type: schema.TypeSet,
22-
Computed: true,
23+
Description: "Data of the organization users.",
24+
Type: schema.TypeSet,
25+
Computed: true,
2326
Elem: &schema.Resource{
2427
Schema: map[string]*schema.Schema{
2528
"type": {
26-
Type: schema.TypeString,
27-
Optional: true,
29+
Description: "Type of the user that is user or tester.",
30+
Type: schema.TypeString,
31+
Optional: true,
2832
},
2933
"name": {
30-
Type: schema.TypeString,
31-
Optional: true,
32-
},
33-
"url": {
34-
Type: schema.TypeString,
35-
Optional: true,
34+
Description: "Name of the user",
35+
Type: schema.TypeString,
36+
Optional: true,
3637
},
3738
"icon_url": {
38-
Type: schema.TypeString,
39-
Optional: true,
39+
Description: "Icon URL for user profile.",
40+
Type: schema.TypeString,
41+
Optional: true,
42+
},
43+
"url": {
44+
Description: "URL of the user account.",
45+
Type: schema.TypeString,
46+
Optional: true,
4047
},
4148
},
4249
},

deploygate/data_source_organization_team_member.go

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,45 @@ import (
1010

1111
func dataSourceOrganizationTeamMember() *schema.Resource {
1212
return &schema.Resource{
13-
Read: dataSourceOrganizationTeamMemberRead,
13+
Description: "Retrieves informantion about a existing organization member.",
14+
Read: dataSourceOrganizationTeamMemberRead,
1415

1516
Schema: map[string]*schema.Schema{
1617
"organization": {
17-
Type: schema.TypeString,
18-
Required: true,
18+
Description: "Name of the organization. [Check your organizations](https://deploygate.com/organizations)",
19+
Type: schema.TypeString,
20+
Required: true,
1921
},
2022
"team": {
21-
Type: schema.TypeString,
22-
Required: true,
23+
Description: "Name of the team in organization.",
24+
Type: schema.TypeString,
25+
Required: true,
2326
},
2427
"users": {
25-
Type: schema.TypeSet,
26-
Computed: true,
28+
Description: "Data of the organization users.",
29+
Type: schema.TypeSet,
30+
Computed: true,
2731
Elem: &schema.Resource{
2832
Schema: map[string]*schema.Schema{
2933
"type": {
30-
Type: schema.TypeString,
31-
Optional: true,
34+
Description: "Type of the user that is user or tester.",
35+
Type: schema.TypeString,
36+
Optional: true,
3237
},
3338
"name": {
34-
Type: schema.TypeString,
35-
Optional: true,
39+
Description: "Name of the user",
40+
Type: schema.TypeString,
41+
Optional: true,
3642
},
3743
"url": {
38-
Type: schema.TypeString,
39-
Optional: true,
44+
Description: "Icon URL for user profile.",
45+
Type: schema.TypeString,
46+
Optional: true,
4047
},
4148
"icon_url": {
42-
Type: schema.TypeString,
43-
Optional: true,
49+
Description: "URL of the user account.",
50+
Type: schema.TypeString,
51+
Optional: true,
4452
},
4553
},
4654
},

0 commit comments

Comments
 (0)