Skip to content

Latest commit

 

History

History
665 lines (424 loc) · 19.3 KB

RoleAssignmentAPI.md

File metadata and controls

665 lines (424 loc) · 19.3 KB

\RoleAssignmentAPI

All URIs are relative to https://subdomain.okta.com

Method HTTP request Description
AssignRoleToGroup Post /api/v1/groups/{groupId}/roles Assign a Role to a Group
AssignRoleToUser Post /api/v1/users/{userId}/roles Assign a Role to a User
GetGroupAssignedRole Get /api/v1/groups/{groupId}/roles/{roleId} Retrieve a Role assigned to Group
GetUserAssignedRole Get /api/v1/users/{userId}/roles/{roleId} Retrieve a Role assigned to a User
ListAssignedRolesForUser Get /api/v1/users/{userId}/roles List all Roles assigned to a User
ListGroupAssignedRoles Get /api/v1/groups/{groupId}/roles List all Assigned Roles of Group
ListUsersWithRoleAssignments Get /api/v1/iam/assignees/users List all Users with Role Assignments
UnassignRoleFromGroup Delete /api/v1/groups/{groupId}/roles/{roleId} Unassign a Role from a Group
UnassignRoleFromUser Delete /api/v1/users/{userId}/roles/{roleId} Unassign a Role from a User

AssignRoleToGroup

Role AssignRoleToGroup(ctx, groupId).AssignRoleRequest(assignRoleRequest).DisableNotifications(disableNotifications).Execute()

Assign a Role to a Group

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    groupId := "00g1emaKYZTWRYYRRTSK" // string | The `id` of the group
    assignRoleRequest := *openapiclient.NewAssignRoleRequest() // AssignRoleRequest | 
    disableNotifications := true // bool | Setting this to `true` grants the group third-party admin status (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.RoleAssignmentAPI.AssignRoleToGroup(context.Background(), groupId).AssignRoleRequest(assignRoleRequest).DisableNotifications(disableNotifications).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `RoleAssignmentAPI.AssignRoleToGroup``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `AssignRoleToGroup`: Role
    fmt.Fprintf(os.Stdout, "Response from `RoleAssignmentAPI.AssignRoleToGroup`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
groupId string The `id` of the group

Other Parameters

Other parameters are passed through a pointer to a apiAssignRoleToGroupRequest struct via the builder pattern

Name Type Description Notes

assignRoleRequest | AssignRoleRequest | | disableNotifications | bool | Setting this to `true` grants the group third-party admin status |

Return type

Role

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

AssignRoleToUser

Role AssignRoleToUser(ctx, userId).AssignRoleRequest(assignRoleRequest).DisableNotifications(disableNotifications).Execute()

Assign a Role to a User

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    userId := "userId_example" // string | ID of an existing Okta user
    assignRoleRequest := *openapiclient.NewAssignRoleRequest() // AssignRoleRequest | 
    disableNotifications := true // bool | Setting this to `true` grants the user third-party admin status (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.RoleAssignmentAPI.AssignRoleToUser(context.Background(), userId).AssignRoleRequest(assignRoleRequest).DisableNotifications(disableNotifications).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `RoleAssignmentAPI.AssignRoleToUser``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `AssignRoleToUser`: Role
    fmt.Fprintf(os.Stdout, "Response from `RoleAssignmentAPI.AssignRoleToUser`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId string ID of an existing Okta user

Other Parameters

Other parameters are passed through a pointer to a apiAssignRoleToUserRequest struct via the builder pattern

Name Type Description Notes

assignRoleRequest | AssignRoleRequest | | disableNotifications | bool | Setting this to `true` grants the user third-party admin status |

Return type

Role

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetGroupAssignedRole

Role GetGroupAssignedRole(ctx, groupId, roleId).Execute()

Retrieve a Role assigned to Group

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    groupId := "00g1emaKYZTWRYYRRTSK" // string | The `id` of the group
    roleId := "3Vg1Pjp3qzw4qcCK5EdO" // string | `id` of the Role

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.RoleAssignmentAPI.GetGroupAssignedRole(context.Background(), groupId, roleId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `RoleAssignmentAPI.GetGroupAssignedRole``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetGroupAssignedRole`: Role
    fmt.Fprintf(os.Stdout, "Response from `RoleAssignmentAPI.GetGroupAssignedRole`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
groupId string The `id` of the group
roleId string `id` of the Role

Other Parameters

Other parameters are passed through a pointer to a apiGetGroupAssignedRoleRequest struct via the builder pattern

Name Type Description Notes

Return type

Role

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetUserAssignedRole

Role GetUserAssignedRole(ctx, userId, roleId).Execute()

Retrieve a Role assigned to a User

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    userId := "userId_example" // string | ID of an existing Okta user
    roleId := "3Vg1Pjp3qzw4qcCK5EdO" // string | `id` of the Role

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.RoleAssignmentAPI.GetUserAssignedRole(context.Background(), userId, roleId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `RoleAssignmentAPI.GetUserAssignedRole``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUserAssignedRole`: Role
    fmt.Fprintf(os.Stdout, "Response from `RoleAssignmentAPI.GetUserAssignedRole`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId string ID of an existing Okta user
roleId string `id` of the Role

Other Parameters

Other parameters are passed through a pointer to a apiGetUserAssignedRoleRequest struct via the builder pattern

Name Type Description Notes

Return type

Role

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListAssignedRolesForUser

[]Role ListAssignedRolesForUser(ctx, userId).Expand(expand).Execute()

List all Roles assigned to a User

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    userId := "userId_example" // string | ID of an existing Okta user
    expand := "expand_example" // string |  (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.RoleAssignmentAPI.ListAssignedRolesForUser(context.Background(), userId).Expand(expand).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `RoleAssignmentAPI.ListAssignedRolesForUser``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListAssignedRolesForUser`: []Role
    fmt.Fprintf(os.Stdout, "Response from `RoleAssignmentAPI.ListAssignedRolesForUser`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId string ID of an existing Okta user

Other Parameters

Other parameters are passed through a pointer to a apiListAssignedRolesForUserRequest struct via the builder pattern

Name Type Description Notes

expand | string | |

Return type

[]Role

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListGroupAssignedRoles

[]Role ListGroupAssignedRoles(ctx, groupId).Expand(expand).Execute()

List all Assigned Roles of Group

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    groupId := "00g1emaKYZTWRYYRRTSK" // string | The `id` of the group
    expand := "expand_example" // string |  (optional)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.RoleAssignmentAPI.ListGroupAssignedRoles(context.Background(), groupId).Expand(expand).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `RoleAssignmentAPI.ListGroupAssignedRoles``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListGroupAssignedRoles`: []Role
    fmt.Fprintf(os.Stdout, "Response from `RoleAssignmentAPI.ListGroupAssignedRoles`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
groupId string The `id` of the group

Other Parameters

Other parameters are passed through a pointer to a apiListGroupAssignedRolesRequest struct via the builder pattern

Name Type Description Notes

expand | string | |

Return type

[]Role

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListUsersWithRoleAssignments

RoleAssignedUsers ListUsersWithRoleAssignments(ctx).After(after).Limit(limit).Execute()

List all Users with Role Assignments

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    after := "after_example" // string |  (optional)
    limit := int32(56) // int32 | Specifies the number of results returned. Defaults to `100`. (optional) (default to 100)

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.RoleAssignmentAPI.ListUsersWithRoleAssignments(context.Background()).After(after).Limit(limit).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `RoleAssignmentAPI.ListUsersWithRoleAssignments``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListUsersWithRoleAssignments`: RoleAssignedUsers
    fmt.Fprintf(os.Stdout, "Response from `RoleAssignmentAPI.ListUsersWithRoleAssignments`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiListUsersWithRoleAssignmentsRequest struct via the builder pattern

Name Type Description Notes
after string
limit int32 Specifies the number of results returned. Defaults to `100`. [default to 100]

Return type

RoleAssignedUsers

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UnassignRoleFromGroup

UnassignRoleFromGroup(ctx, groupId, roleId).Execute()

Unassign a Role from a Group

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    groupId := "00g1emaKYZTWRYYRRTSK" // string | The `id` of the group
    roleId := "3Vg1Pjp3qzw4qcCK5EdO" // string | `id` of the Role

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    r, err := apiClient.RoleAssignmentAPI.UnassignRoleFromGroup(context.Background(), groupId, roleId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `RoleAssignmentAPI.UnassignRoleFromGroup``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
groupId string The `id` of the group
roleId string `id` of the Role

Other Parameters

Other parameters are passed through a pointer to a apiUnassignRoleFromGroupRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UnassignRoleFromUser

UnassignRoleFromUser(ctx, userId, roleId).Execute()

Unassign a Role from a User

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "github.com/lukas-hetzenecker/okta-sdk-golang"
)

func main() {
    userId := "userId_example" // string | ID of an existing Okta user
    roleId := "3Vg1Pjp3qzw4qcCK5EdO" // string | `id` of the Role

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    r, err := apiClient.RoleAssignmentAPI.UnassignRoleFromUser(context.Background(), userId, roleId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `RoleAssignmentAPI.UnassignRoleFromUser``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
userId string ID of an existing Okta user
roleId string `id` of the Role

Other Parameters

Other parameters are passed through a pointer to a apiUnassignRoleFromUserRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]