Skip to content

Commit

Permalink
[ROOT-1030] Remove immutable fields from docs and payload, and add de…
Browse files Browse the repository at this point in the history
…precation warning to Resource.
  • Loading branch information
azanar committed Oct 24, 2024
1 parent 995a180 commit 7604bc5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
2 changes: 0 additions & 2 deletions client/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ type Role struct {
Name string `jsonapi:"attr,name,omitempty"`
Slug string `jsonapi:"attr,slug,omitempty"`
IncidentPermissionSetId string `jsonapi:"attr,incident_permission_set_id,omitempty"`
IsDeletable *bool `jsonapi:"attr,is_deletable,omitempty"`
IsEditable *bool `jsonapi:"attr,is_editable,omitempty"`
AlertsPermissions []interface{} `jsonapi:"attr,alerts_permissions,omitempty"`
PulsesPermissions []interface{} `jsonapi:"attr,pulses_permissions,omitempty"`
ApiKeysPermissions []interface{} `jsonapi:"attr,api_keys_permissions,omitempty"`
Expand Down
2 changes: 0 additions & 2 deletions docs/resources/role.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ description: |-
- `incident_types_permissions` (List of String) Value must be one of `create`, `read`, `update`, `delete`.
- `incidents_permissions` (List of String) Value must be one of `create`, `read`, `update`, `delete`.
- `invitations_permissions` (List of String) Value must be one of `create`, `read`, `update`, `delete`.
- `is_deletable` (Boolean) Whether the role can be deleted.. Value must be one of true or false
- `is_editable` (Boolean) Whether the role can be edited.. Value must be one of true or false
- `playbooks_permissions` (List of String) Value must be one of `create`, `read`, `update`, `delete`.
- `private_incidents_permissions` (List of String) Value must be one of `create`, `read`, `update`, `delete`.
- `pulses_permissions` (List of String) Value must be one of `create`, `update`, `read`.
Expand Down
16 changes: 2 additions & 14 deletions provider/resource_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func resourceRole() *schema.Resource {
Required: false,
Optional: true,
Description: "Whether the role can be deleted.. Value must be one of true or false",
Deprecated: "This resource is now ignored by the API, and will be removed in the next release.",
},

"is_editable": &schema.Schema{
Expand All @@ -63,6 +64,7 @@ func resourceRole() *schema.Resource {
Required: false,
Optional: true,
Description: "Whether the role can be edited.. Value must be one of true or false",
Deprecated: "This resource is now ignored by the API, and will be removed in the next release.",
},

"alerts_permissions": &schema.Schema{
Expand Down Expand Up @@ -384,12 +386,6 @@ func resourceRoleCreate(ctx context.Context, d *schema.ResourceData, meta interf
if value, ok := d.GetOkExists("incident_permission_set_id"); ok {
s.IncidentPermissionSetId = value.(string)
}
if value, ok := d.GetOkExists("is_deletable"); ok {
s.IsDeletable = tools.Bool(value.(bool))
}
if value, ok := d.GetOkExists("is_editable"); ok {
s.IsEditable = tools.Bool(value.(bool))
}
if value, ok := d.GetOkExists("alerts_permissions"); ok {
s.AlertsPermissions = value.([]interface{})
}
Expand Down Expand Up @@ -497,8 +493,6 @@ func resourceRoleRead(ctx context.Context, d *schema.ResourceData, meta interfac
d.Set("name", item.Name)
d.Set("slug", item.Slug)
d.Set("incident_permission_set_id", item.IncidentPermissionSetId)
d.Set("is_deletable", item.IsDeletable)
d.Set("is_editable", item.IsEditable)
d.Set("alerts_permissions", item.AlertsPermissions)
d.Set("pulses_permissions", item.PulsesPermissions)
d.Set("api_keys_permissions", item.ApiKeysPermissions)
Expand Down Expand Up @@ -543,12 +537,6 @@ func resourceRoleUpdate(ctx context.Context, d *schema.ResourceData, meta interf
if d.HasChange("incident_permission_set_id") {
s.IncidentPermissionSetId = d.Get("incident_permission_set_id").(string)
}
if d.HasChange("is_deletable") {
s.IsDeletable = tools.Bool(d.Get("is_deletable").(bool))
}
if d.HasChange("is_editable") {
s.IsEditable = tools.Bool(d.Get("is_editable").(bool))
}
if d.HasChange("alerts_permissions") {
s.AlertsPermissions = d.Get("alerts_permissions").([]interface{})
}
Expand Down

0 comments on commit 7604bc5

Please sign in to comment.