Skip to content

Commit

Permalink
Merge pull request #86 from DrFaust92/update-deps
Browse files Browse the repository at this point in the history
Update-deps
  • Loading branch information
DrFaust92 authored Aug 22, 2022
2 parents e3d132d + 13d3b55 commit 91987d6
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 452 deletions.
20 changes: 0 additions & 20 deletions bitbucket/data_current_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,6 @@ func dataCurrentUser() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"nickname": {
Type: schema.TypeString,
Computed: true,
},
"account_id": {
Type: schema.TypeString,
Computed: true,
},
"account_status": {
Type: schema.TypeString,
Computed: true,
},
"is_staff": {
Type: schema.TypeBool,
Computed: true,
},
"email": {
Type: schema.TypeSet,
Computed: true,
Expand Down Expand Up @@ -124,11 +108,7 @@ func dataReadCurrentUser(d *schema.ResourceData, m interface{}) error {
d.SetId(curUser.Uuid)
d.Set("uuid", curUser.Uuid)
d.Set("username", curUser.Username)
d.Set("nickname", curUser.Nickname)
d.Set("display_name", curUser.DisplayName)
d.Set("account_id", curUser.AccountId)
d.Set("account_status", curUser.AccountStatus)
d.Set("is_staff", curUser.IsStaff)
d.Set("email", flattenUserEmails(emails.Values))

return nil
Expand Down
4 changes: 0 additions & 4 deletions bitbucket/data_current_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ func TestAccCurrentUser_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(dataSourceName, "uuid"),
resource.TestCheckResourceAttrSet(dataSourceName, "username"),
resource.TestCheckResourceAttrSet(dataSourceName, "nickname"),
resource.TestCheckResourceAttrSet(dataSourceName, "display_name"),
resource.TestCheckResourceAttrSet(dataSourceName, "account_id"),
resource.TestCheckResourceAttrSet(dataSourceName, "account_status"),
resource.TestCheckResourceAttr(dataSourceName, "is_staff", "false"),
resource.TestCheckTypeSetElemNestedAttrs(dataSourceName, "email.*", map[string]string{
"is_primary": "true",
}),
Expand Down
25 changes: 0 additions & 25 deletions bitbucket/data_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@ func dataUser() *schema.Resource {
Optional: true,
ValidateFunc: validation.StringIsNotEmpty,
},
"nickname": {
Type: schema.TypeString,
Optional: true,
},
"account_id": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringIsNotEmpty,
},
"account_status": {
Type: schema.TypeString,
Computed: true,
},
"is_staff": {
Type: schema.TypeBool,
Computed: true,
},
},
}
}
Expand All @@ -53,10 +36,6 @@ func dataReadUser(d *schema.ResourceData, m interface{}) error {
usersApi := c.ApiClient.UsersApi
var selectedUser string

if v, ok := d.GetOk("account_id"); ok && v.(string) != "" {
selectedUser = v.(string)
}

if v, ok := d.GetOk("uuid"); ok && v.(string) != "" {
selectedUser = v.(string)
}
Expand All @@ -78,12 +57,8 @@ func dataReadUser(d *schema.ResourceData, m interface{}) error {

d.SetId(user.Uuid)
d.Set("uuid", user.Uuid)
d.Set("nickname", user.Nickname)
d.Set("username", user.Username)
d.Set("display_name", user.DisplayName)
d.Set("account_id", user.AccountId)
d.Set("account_status", user.AccountStatus)
d.Set("is_staff", user.IsStaff)

return nil
}
39 changes: 0 additions & 39 deletions bitbucket/data_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,52 +18,13 @@ func TestAccUser_uuid(t *testing.T) {
Config: testAccBitbucketUserUUIDConfig(),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrPair(dataSourceName, "uuid", currUserDataSource, "uuid"),
resource.TestCheckResourceAttrPair(dataSourceName, "nickname", currUserDataSource, "nickname"),
resource.TestCheckResourceAttrPair(dataSourceName, "display_name", currUserDataSource, "display_name"),
resource.TestCheckResourceAttrPair(dataSourceName, "account_id", currUserDataSource, "account_id"),
resource.TestCheckResourceAttrPair(dataSourceName, "account_status", currUserDataSource, "account_status"),
resource.TestCheckResourceAttrPair(dataSourceName, "is_staff", currUserDataSource, "is_staff"),
// resource.TestCheckResourceAttrPair(dataSourceName, "username", currUserDataSource, "username"),
),
},
},
})
}

func TestAccUser_accountId(t *testing.T) {
dataSourceName := "data.bitbucket_user.test"
currUserDataSource := "data.bitbucket_current_user.test"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccBitbucketUserConfig(),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrPair(dataSourceName, "uuid", currUserDataSource, "uuid"),
resource.TestCheckResourceAttrPair(dataSourceName, "nickname", currUserDataSource, "nickname"),
resource.TestCheckResourceAttrPair(dataSourceName, "display_name", currUserDataSource, "display_name"),
resource.TestCheckResourceAttrPair(dataSourceName, "account_id", currUserDataSource, "account_id"),
resource.TestCheckResourceAttrPair(dataSourceName, "account_status", currUserDataSource, "account_status"),
resource.TestCheckResourceAttrPair(dataSourceName, "is_staff", currUserDataSource, "is_staff"),
// resource.TestCheckResourceAttrPair(dataSourceName, "username", currUserDataSource, "username"),
),
},
},
})
}

func testAccBitbucketUserConfig() string {
return `
data "bitbucket_current_user" "test" {}
data "bitbucket_user" "test" {
account_id = data.bitbucket_current_user.test.account_id
}
`
}

func testAccBitbucketUserUUIDConfig() string {
return `
data "bitbucket_current_user" "test" {}
Expand Down
4 changes: 2 additions & 2 deletions bitbucket/resource_default_reviewers.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func resourceDefaultReviewersCreate(d *schema.ResourceData, m interface{}) error
workspace := d.Get("owner").(string)
for _, user := range d.Get("reviewers").(*schema.Set).List() {
userName := user.(string)
reviewerResp, err := prApi.RepositoriesWorkspaceRepoSlugDefaultReviewersTargetUsernamePut(c.AuthContext, repo, userName, workspace)
_, reviewerResp, err := prApi.RepositoriesWorkspaceRepoSlugDefaultReviewersTargetUsernamePut(c.AuthContext, repo, userName, workspace)

if err != nil {
return err
Expand Down Expand Up @@ -148,7 +148,7 @@ func resourceDefaultReviewersUpdate(d *schema.ResourceData, m interface{}) error

for _, user := range add.List() {
userName := user.(string)
reviewerResp, err := prApi.RepositoriesWorkspaceRepoSlugDefaultReviewersTargetUsernamePut(c.AuthContext, repo, userName, workspace)
_, reviewerResp, err := prApi.RepositoriesWorkspaceRepoSlugDefaultReviewersTargetUsernamePut(c.AuthContext, repo, userName, workspace)

if err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion bitbucket/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import (
// RandSSHKeyPair generates a public and private SSH key pair. The public key is
// returned in OpenSSH format, and the private key is PEM encoded.
// Copied from github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest,
// with the addition of the key size
//
// with the addition of the key size
func RandSSHKeyPairSize(keySize int, comment string) (string, string, error) {
privateKey, privateKeyPEM, err := genPrivateKey(keySize)
if err != nil {
Expand Down
4 changes: 0 additions & 4 deletions docs/data-sources/current_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ There are no arguments available for this data source.
* `username` - The Username.
* `uuid` - the uuid that bitbucket users to connect a user to various objects
* `display_name` - the display name that the user wants to use for GDPR
* `nickname` - Account name defined by the owner. Note that "nickname" cannot be used in place of "username" in URLs and queries, as "nickname" is not guaranteed to be unique.
* `account_status` - The status of the account.
* `account_id` - The user's Atlassian account ID.
* `is_staff` - is staff user.
* `email` - A Set of emails associated to current user. See [Email](#email) below.

### Email
Expand Down
5 changes: 0 additions & 5 deletions docs/data-sources/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ data "bitbucket_user" "reviewer" {
The following arguments are supported (At least of of is required):

* `uuid` - (Optional) The UUID that bitbucket users to connect a user to various objects
* `account_id` - (Optional) The user's Atlassian account ID.

## Attributes Reference

* `uuid` - the uuid that bitbucket users to connect a user to various objects
* `display_name` - the display name that the user wants to use for GDPR
* `nickname` - Account name defined by the owner. Note that "nickname" cannot be used in place of "username" in URLs and queries, as "nickname" is not guaranteed to be unique.
* `account_status` - The status of the account.
* `account_id` - The user's Atlassian account ID.
* `is_staff` - is staff user.
58 changes: 29 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
module github.com/terraform-providers/terraform-provider-bitbucket

require (
github.com/DrFaust92/bitbucket-go-client v0.0.10
github.com/DrFaust92/bitbucket-go-client v0.1.0
github.com/antihax/optional v1.0.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.17.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.21.0
github.com/satori/go.uuid v1.2.0
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70
golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8
)

require (
github.com/agext/levenshtein v1.2.2 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.2.0 // indirect
github.com/hashicorp/go-hclog v1.2.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.4 // indirect
github.com/hashicorp/go-plugin v1.4.5 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.5.0 // indirect
github.com/hashicorp/hc-install v0.3.2 // indirect
github.com/hashicorp/hcl/v2 v2.12.0 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hc-install v0.4.0 // indirect
github.com/hashicorp/hcl/v2 v2.13.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.16.1 // indirect
github.com/hashicorp/terraform-exec v0.17.2 // indirect
github.com/hashicorp/terraform-json v0.14.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.9.1 // indirect
github.com/hashicorp/terraform-plugin-log v0.4.0 // indirect
github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 // indirect
github.com/hashicorp/terraform-plugin-go v0.14.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
github.com/zclconf/go-cty v1.10.0 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
github.com/vmihailenco/tagparser v0.1.2 // indirect
github.com/zclconf/go-cty v1.11.0 // indirect
golang.org/x/net v0.0.0-20220812174116-3211cb980234 // indirect
golang.org/x/oauth2 v0.0.0-20220808172628-8227340efae7 // indirect
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect
google.golang.org/grpc v1.46.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect
google.golang.org/grpc v1.48.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)

go 1.18
Loading

0 comments on commit 91987d6

Please sign in to comment.