Skip to content

Latest commit

 

History

History
506 lines (342 loc) · 57.5 KB

File metadata and controls

506 lines (342 loc) · 57.5 KB

Indexing.Permissions

Overview

Available Operations

update_permissions

Updates the permissions for a given document without modifying document content.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.update_permissions(datasource="<value>", permissions={})

    # Use the SDK ...

Parameters

Parameter Type Required Description
datasource str ✔️ N/A
permissions models.DocumentPermissionsDefinition ✔️ describes the access control details of the document
object_type Optional[str] The type of the document (Case, KnowledgeArticle for Salesforce for example). It cannot have spaces or _
id Optional[str] The datasource specific id for the document. This field is case insensitive and should not be more than 200 characters in length.
view_url Optional[str] The permalink for viewing the document. Note: viewURL is a required field if id was not set when uploading the document.'
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

index_user

Adds a datasource user or updates an existing user.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.index_user(datasource="<value>", user={
        "email": "Art.Schaden@hotmail.com",
        "name": "<value>",
    })

    # Use the SDK ...

Parameters

Parameter Type Required Description
datasource str ✔️ The datasource for which the user is added
user models.DatasourceUserDefinition ✔️ describes a user in the datasource
version Optional[int] Version number for document for optimistic concurrency control. If absent or 0 then no version checks are done.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

bulk_index_users

Replaces the users in a datasource using paginated batch API calls. Please refer to the bulk indexing documentation for an explanation of how to use bulk endpoints. Note: Any users deleted from the existing set will have their associated memberships deleted as well.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.bulk_index_users(upload_id="<id>", datasource="<value>", users=[
        {
            "email": "Ivory_Cummerata@hotmail.com",
            "name": "<value>",
        },
    ])

    # Use the SDK ...

Parameters

Parameter Type Required Description
upload_id str ✔️ Unique id that must be used for this instance of datasource users upload
datasource str ✔️ datasource of the users
users List[models.DatasourceUserDefinition] ✔️ batch of users for the datasource
is_first_page Optional[bool] true if this is the first page of the upload. Defaults to false
is_last_page Optional[bool] true if this is the last page of the upload. Defaults to false
force_restart_upload Optional[bool] Flag to discard previous upload attempts and start from scratch. Must be specified with isFirstPage=true
disable_stale_data_deletion_check Optional[bool] True if older user data needs to be force deleted after the upload completes. Defaults to older data being deleted only if the percentage of data being deleted is less than a reasonable threshold. This must only be set when isLastPage = true
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

index_group

Add or update a group in the datasource.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.index_group(datasource="<value>", group={
        "name": "<value>",
    })

    # Use the SDK ...

Parameters

Parameter Type Required Description
datasource str ✔️ The datasource for which the group is added
group models.DatasourceGroupDefinition ✔️ describes a group in the datasource
version Optional[int] Version number for document for optimistic concurrency control. If absent or 0 then no version checks are done.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

bulk_index_groups

Replaces the groups in a datasource using paginated batch API calls. Please refer to the bulk indexing documentation for an explanation of how to use bulk endpoints. Note: Any groups deleted from the existing set will have their associated memberships deleted as well.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.bulk_index_groups(upload_id="<id>", datasource="<value>", groups=[
        {
            "name": "<value>",
        },
    ])

    # Use the SDK ...

Parameters

Parameter Type Required Description
upload_id str ✔️ Unique id that must be used for this instance of datasource groups upload
datasource str ✔️ datasource of the groups
groups List[models.DatasourceGroupDefinition] ✔️ batch of groups for the datasource
is_first_page Optional[bool] true if this is the first page of the upload. Defaults to false
is_last_page Optional[bool] true if this is the last page of the upload. Defaults to false
force_restart_upload Optional[bool] Flag to discard previous upload attempts and start from scratch. Must be specified with isFirstPage=true
disable_stale_data_deletion_check Optional[bool] True if older group data needs to be force deleted after the upload completes. Defaults to older data being deleted only if the percentage of data being deleted is less than a reasonable threshold. This must only be set when isLastPage = true
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

index_membership

Add the memberships of a group in the datasource.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.index_membership(datasource="<value>", membership={
        "group_name": "<value>",
    })

    # Use the SDK ...

Parameters

Parameter Type Required Description
datasource str ✔️ The datasource for which the membership is added
membership models.DatasourceMembershipDefinition ✔️ describes the membership row of a group. Only one of memberUserId and memberGroupName can be specified.
version Optional[int] Version number for document for optimistic concurrency control. If absent or 0 then no version checks are done.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

bulk_index_memberships

Replaces the memberships for a group in a datasource using paginated batch API calls. Please refer to the bulk indexing documentation for an explanation of how to use bulk endpoints.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.bulk_index_memberships(upload_id="<id>", datasource="<value>", memberships=[
        {},
    ])

    # Use the SDK ...

Parameters

Parameter Type Required Description
upload_id str ✔️ Unique id that must be used for this instance of datasource group memberships upload
datasource str ✔️ datasource of the memberships
memberships List[models.DatasourceBulkMembershipDefinition] ✔️ batch of memberships for the group
is_first_page Optional[bool] true if this is the first page of the upload. Defaults to false
is_last_page Optional[bool] true if this is the last page of the upload. Defaults to false
force_restart_upload Optional[bool] Flag to discard previous upload attempts and start from scratch. Must be specified with isFirstPage=true
group Optional[str] group who's memberships are specified
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

process_memberships

Schedules the immediate processing of all group memberships uploaded through the indexing API. By default the uploaded group memberships will be processed asynchronously but this API can be used to schedule processing of all memberships on demand.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.process_memberships()

    # Use the SDK ...

Parameters

Parameter Type Required Description
request models.ProcessAllMembershipsRequest ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

delete_user

Delete the user from the datasource. Silently succeeds if user is not present. Note: All memberships associated with the deleted user will also be deleted.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.delete_user(datasource="<value>", email="Ed.Johnston@gmail.com")

    # Use the SDK ...

Parameters

Parameter Type Required Description
datasource str ✔️ The datasource for which the user is removed
email str ✔️ The email of the user to be deleted
version Optional[int] Version number for document for optimistic concurrency control. If absent or 0 then no version checks are done.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

delete_group

Delete group from the datasource. Silently succeeds if group is not present. Note: All memberships associated with the deleted group will also be deleted.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.delete_group(datasource="<value>", group_name="<value>")

    # Use the SDK ...

Parameters

Parameter Type Required Description
datasource str ✔️ The datasource for which the group is removed
group_name str ✔️ the name of the group to be deleted
version Optional[int] Version number for document for optimistic concurrency control. If absent or 0 then no version checks are done.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

delete_membership

Delete membership to a group in the specified datasource. Silently succeeds if membership is not present.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.delete_membership(datasource="<value>", membership={
        "group_name": "<value>",
    })

    # Use the SDK ...

Parameters

Parameter Type Required Description
datasource str ✔️ The datasource for which the membership is removed
membership models.DatasourceMembershipDefinition ✔️ describes the membership row of a group. Only one of memberUserId and memberGroupName can be specified.
version Optional[int] Version number for document for optimistic concurrency control. If absent or 0 then no version checks are done.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*

authorize_beta_users

Allow the datasource be visible to the specified beta users. The default behaviour is datasource being visible to all users if it is enabled and not visible to any user if it is not enabled.

Example Usage

from glean.api_client import Glean
import os


with Glean(
    api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:

    glean.indexing.permissions.authorize_beta_users(datasource="<value>", emails=[
        "Neil92@gmail.com",
        "Alejandrin_Boyer4@hotmail.com",
        "Shyanne_McLaughlin95@hotmail.com",
    ])

    # Use the SDK ...

Parameters

Parameter Type Required Description
datasource str ✔️ Datasource which needs to be made visible to users specified in the emails field.
emails List[str] ✔️ The emails of the beta users
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Errors

Error Type Status Code Content Type
errors.GleanError 4XX, 5XX */*