Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(teams) Add custom role data source #382

Closed
wants to merge 3 commits into from

Conversation

Shadow649
Copy link
Collaborator

This is first PR in order to add tthe ability to assign custom roles to users in teams

Changes made in the PR:

  • Add custom role data source
  • Add documentation

Tests are missing and will be added in a later stage, when we introduce the custom role resource.

@Shadow649 Shadow649 self-assigned this Jul 11, 2023
}

func dataSourceSysdigCustomRoleRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
client, err := m.(SysdigClients).sysdigCommonClientV2()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do a check regarding the type cast, to avoid any panic in the application

cli, ok := m.(SysdigClients)

return diag.FromErr(err)
}

name := d.Get("name").(string)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

}

d.SetId(strconv.Itoa(customRole.ID))
_ = d.Set("name", customRole.Name)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to omit the _ = if you don't need them :)

@Shadow649 Shadow649 force-pushed the SP-950_custom_role_data_source branch from ef1aea0 to 8b3c7f1 Compare July 27, 2023 10:03
@Shadow649
Copy link
Collaborator Author

closing everything will be done in #383

@Shadow649 Shadow649 closed this Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants