How to use the azure-devops.azext_devops.dev.common.services.get_identity_client function in azure-devops

To help you get started, we’ve selected a few azure-devops examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-devops-cli-extension / azure-devops / azext_devops / dev / common / identities.py View on Github external
def get_identities(organization, identity_ids):
    identity_client = get_identity_client(organization)
    return identity_client.read_identities(identity_ids=identity_ids)
github Azure / azure-devops-cli-extension / azure-devops / azext_devops / dev / common / identities.py View on Github external
def resolve_identity(identity_filter, organization):
    """Takes an identity name, email, alias, or id, and returns the identity.
    """
    if identity_filter is None:
        return None

    if identity_filter.lower() == ME:
        return get_current_identity(organization)

    identity_client = get_identity_client(organization)
    if identity_filter.find(' ') > 0 or identity_filter.find('@') > 0:
        identities = identity_client.read_identities(search_filter='General',
                                                     filter_value=identity_filter)
        if identities is None or not identities:
            identities = identity_client.read_identities(search_filter='DirectoryAlias',
                                                         filter_value=identity_filter)
    else:
        identities = identity_client.read_identities(search_filter='DirectoryAlias',
                                                     filter_value=identity_filter)
        if identities is None or not identities:
            identities = identity_client.read_identities(search_filter='General',
                                                         filter_value=identity_filter)
    if not identities:
        raise CLIError('Could not resolve identity: ' + identity_filter)
    if len(identities) > 1:
        # prefer users with same domain
github Azure / azure-devops-cli-extension / azure-devops / azext_devops / dev / common / identities.py View on Github external
def get_identity_descriptor_from_subject_descriptor(subject_descriptor, organization):
    identity_client = get_identity_client(organization)
    identities = identity_client.read_identities(subject_descriptors=subject_descriptor)
    if identities:
        return identities[0].descriptor
    return subject_descriptor

azure-devops

Python wrapper around the Azure DevOps 7.x APIs

MIT
Latest version published 1 year ago

Package Health Score

80 / 100
Full package analysis