Rename bitbucketserver_project_groups to bitbucketserver_project_permissions_groups to better reflect use

This commit is contained in:
Gavin Bunney
2019-10-09 14:42:29 -07:00
parent 69092ae19a
commit 4ee9fb67c6
4 changed files with 19 additions and 19 deletions

View File

@@ -176,7 +176,7 @@ data "bitbucketserver_application_properties" "main" {}
### Application Properties
```hcl
data "bitbucketserver_project_groups" "proj" {
data "bitbucketserver_project_permissions_groups" "proj" {
project = "TEST"
}
```

View File

@@ -6,25 +6,25 @@ import (
"github.com/hashicorp/terraform/helper/schema"
)
type ProjectGroup struct {
type ProjectPermissionsGroup struct {
Group struct {
Name string `json:"name,omitempty"`
} `json:"group,omitempty"`
Permission string `json:"permission,omitempty"`
}
type PaginatedProjectGroups struct {
Values []ProjectGroup `json:"values,omitempty"`
Size int `json:"size,omitempty"`
Limit int `json:"limit,omitempty"`
IsLastPage bool `json:"isLastPage,omitempty"`
Start int `json:"start,omitempty"`
NextPageStart int `json:"nextPageStart,omitempty"`
type PaginatedProjectPermissionsGroups struct {
Values []ProjectPermissionsGroup `json:"values,omitempty"`
Size int `json:"size,omitempty"`
Limit int `json:"limit,omitempty"`
IsLastPage bool `json:"isLastPage,omitempty"`
Start int `json:"start,omitempty"`
NextPageStart int `json:"nextPageStart,omitempty"`
}
func dataSourceProjectGroups() *schema.Resource {
func dataSourceProjectPermissionsGroups() *schema.Resource {
return &schema.Resource{
Read: dataSourceProjectGroupsRead,
Read: dataSourceProjectPermissionsGroupsRead,
Schema: map[string]*schema.Schema{
"project": {
@@ -51,14 +51,14 @@ func dataSourceProjectGroups() *schema.Resource {
}
}
func dataSourceProjectGroupsRead(d *schema.ResourceData, m interface{}) error {
func dataSourceProjectPermissionsGroupsRead(d *schema.ResourceData, m interface{}) error {
client := m.(*BitbucketClient)
resourceURL := fmt.Sprintf("/rest/api/1.0/projects/%s/permissions/groups",
d.Get("project").(string),
)
var projectGroups PaginatedProjectGroups
var projectGroups PaginatedProjectPermissionsGroups
var terraformGroups []interface{}
for {
@@ -85,7 +85,7 @@ func dataSourceProjectGroupsRead(d *schema.ResourceData, m interface{}) error {
d.Get("project").(string),
projectGroups.NextPageStart,
)
projectGroups = PaginatedProjectGroups{}
projectGroups = PaginatedProjectPermissionsGroups{}
} else {
break
}

View File

@@ -9,14 +9,14 @@ import (
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccBitbucketDatProjectGroups_check_empty(t *testing.T) {
func TestAccBitbucketDataProjectPermissionsGroups_check_empty(t *testing.T) {
config := fmt.Sprintf(`
resource "bitbucketserver_project" "test" {
key = "TEST%v"
name = "test-repo-for-repository-test"
}
data "bitbucketserver_project_groups" "test" {
data "bitbucketserver_project_permissions_groups" "test" {
project = bitbucketserver_project.test.key
}
`, rand.New(rand.NewSource(time.Now().UnixNano())).Int())
@@ -28,7 +28,7 @@ func TestAccBitbucketDatProjectGroups_check_empty(t *testing.T) {
{
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.bitbucketserver_project_groups.test", "groups.#", "0"),
resource.TestCheckResourceAttr("data.bitbucketserver_project_permissions_groups.test", "groups.#", "0"),
),
},
},

View File

@@ -29,8 +29,8 @@ func Provider() terraform.ResourceProvider {
},
ConfigureFunc: providerConfigure,
DataSourcesMap: map[string]*schema.Resource{
"bitbucketserver_application_properties": dataSourceApplicationProperties(),
"bitbucketserver_project_groups": dataSourceProjectGroups(),
"bitbucketserver_application_properties": dataSourceApplicationProperties(),
"bitbucketserver_project_permissions_groups": dataSourceProjectPermissionsGroups(),
},
ResourcesMap: map[string]*schema.Resource{
"bitbucketserver_admin_license": resourceAdminLicense(),