mirror of
https://github.com/ysoftdevs/terraform-provider-bitbucketserver.git
synced 2026-03-24 10:21:10 +01:00
Rename bitbucketserver_project_groups to bitbucketserver_project_permissions_groups to better reflect use
This commit is contained in:
@@ -176,7 +176,7 @@ data "bitbucketserver_application_properties" "main" {}
|
|||||||
### Application Properties
|
### Application Properties
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
data "bitbucketserver_project_groups" "proj" {
|
data "bitbucketserver_project_permissions_groups" "proj" {
|
||||||
project = "TEST"
|
project = "TEST"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -6,25 +6,25 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ProjectGroup struct {
|
type ProjectPermissionsGroup struct {
|
||||||
Group struct {
|
Group struct {
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
} `json:"group,omitempty"`
|
} `json:"group,omitempty"`
|
||||||
Permission string `json:"permission,omitempty"`
|
Permission string `json:"permission,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PaginatedProjectGroups struct {
|
type PaginatedProjectPermissionsGroups struct {
|
||||||
Values []ProjectGroup `json:"values,omitempty"`
|
Values []ProjectPermissionsGroup `json:"values,omitempty"`
|
||||||
Size int `json:"size,omitempty"`
|
Size int `json:"size,omitempty"`
|
||||||
Limit int `json:"limit,omitempty"`
|
Limit int `json:"limit,omitempty"`
|
||||||
IsLastPage bool `json:"isLastPage,omitempty"`
|
IsLastPage bool `json:"isLastPage,omitempty"`
|
||||||
Start int `json:"start,omitempty"`
|
Start int `json:"start,omitempty"`
|
||||||
NextPageStart int `json:"nextPageStart,omitempty"`
|
NextPageStart int `json:"nextPageStart,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func dataSourceProjectGroups() *schema.Resource {
|
func dataSourceProjectPermissionsGroups() *schema.Resource {
|
||||||
return &schema.Resource{
|
return &schema.Resource{
|
||||||
Read: dataSourceProjectGroupsRead,
|
Read: dataSourceProjectPermissionsGroupsRead,
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"project": {
|
"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)
|
client := m.(*BitbucketClient)
|
||||||
|
|
||||||
resourceURL := fmt.Sprintf("/rest/api/1.0/projects/%s/permissions/groups",
|
resourceURL := fmt.Sprintf("/rest/api/1.0/projects/%s/permissions/groups",
|
||||||
d.Get("project").(string),
|
d.Get("project").(string),
|
||||||
)
|
)
|
||||||
|
|
||||||
var projectGroups PaginatedProjectGroups
|
var projectGroups PaginatedProjectPermissionsGroups
|
||||||
var terraformGroups []interface{}
|
var terraformGroups []interface{}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@@ -85,7 +85,7 @@ func dataSourceProjectGroupsRead(d *schema.ResourceData, m interface{}) error {
|
|||||||
d.Get("project").(string),
|
d.Get("project").(string),
|
||||||
projectGroups.NextPageStart,
|
projectGroups.NextPageStart,
|
||||||
)
|
)
|
||||||
projectGroups = PaginatedProjectGroups{}
|
projectGroups = PaginatedProjectPermissionsGroups{}
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -9,14 +9,14 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccBitbucketDatProjectGroups_check_empty(t *testing.T) {
|
func TestAccBitbucketDataProjectPermissionsGroups_check_empty(t *testing.T) {
|
||||||
config := fmt.Sprintf(`
|
config := fmt.Sprintf(`
|
||||||
resource "bitbucketserver_project" "test" {
|
resource "bitbucketserver_project" "test" {
|
||||||
key = "TEST%v"
|
key = "TEST%v"
|
||||||
name = "test-repo-for-repository-test"
|
name = "test-repo-for-repository-test"
|
||||||
}
|
}
|
||||||
|
|
||||||
data "bitbucketserver_project_groups" "test" {
|
data "bitbucketserver_project_permissions_groups" "test" {
|
||||||
project = bitbucketserver_project.test.key
|
project = bitbucketserver_project.test.key
|
||||||
}
|
}
|
||||||
`, rand.New(rand.NewSource(time.Now().UnixNano())).Int())
|
`, rand.New(rand.NewSource(time.Now().UnixNano())).Int())
|
||||||
@@ -28,7 +28,7 @@ func TestAccBitbucketDatProjectGroups_check_empty(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Config: config,
|
Config: config,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
resource.TestCheckResourceAttr("data.bitbucketserver_project_groups.test", "groups.#", "0"),
|
resource.TestCheckResourceAttr("data.bitbucketserver_project_permissions_groups.test", "groups.#", "0"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -29,8 +29,8 @@ func Provider() terraform.ResourceProvider {
|
|||||||
},
|
},
|
||||||
ConfigureFunc: providerConfigure,
|
ConfigureFunc: providerConfigure,
|
||||||
DataSourcesMap: map[string]*schema.Resource{
|
DataSourcesMap: map[string]*schema.Resource{
|
||||||
"bitbucketserver_application_properties": dataSourceApplicationProperties(),
|
"bitbucketserver_application_properties": dataSourceApplicationProperties(),
|
||||||
"bitbucketserver_project_groups": dataSourceProjectGroups(),
|
"bitbucketserver_project_permissions_groups": dataSourceProjectPermissionsGroups(),
|
||||||
},
|
},
|
||||||
ResourcesMap: map[string]*schema.Resource{
|
ResourcesMap: map[string]*schema.Resource{
|
||||||
"bitbucketserver_admin_license": resourceAdminLicense(),
|
"bitbucketserver_admin_license": resourceAdminLicense(),
|
||||||
|
|||||||
Reference in New Issue
Block a user