# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from . import utilities, tables

class GetMembershipResult:
    """
    A collection of values returned by getMembership.
    """
    def __init__(__self__, etag=None, id=None, role=None, username=None):
        if etag and not isinstance(etag, str):
            raise TypeError("Expected argument 'etag' to be a str")
        __self__.etag = etag
        """
        An etag representing the membership object.
        """
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        __self__.id = id
        """
        The provider-assigned unique ID for this managed resource.
        """
        if role and not isinstance(role, str):
            raise TypeError("Expected argument 'role' to be a str")
        __self__.role = role
        """
        `admin` or `member` -- the role the user has within the organization.
        """
        if username and not isinstance(username, str):
            raise TypeError("Expected argument 'username' to be a str")
        __self__.username = username
        """
        The username.
        """
class AwaitableGetMembershipResult(GetMembershipResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetMembershipResult(
            etag=self.etag,
            id=self.id,
            role=self.role,
            username=self.username)

def get_membership(username=None,opts=None):
    """
    Use this data source to find out if a user is a member of your organization, as well
    as what role they have within it.
    If the user's membership in the organization is pending their acceptance of an invite,
    the role they would have once they accept will be returned.

    ## Example Usage



    ```python
    import pulumi
    import pulumi_github as github

    membership_for_some_user = github.get_membership(username="SomeUser")
    ```



    :param str username: The username to lookup in the organization.
    """
    __args__ = dict()


    __args__['username'] = username
    if opts is None:
        opts = pulumi.InvokeOptions()
    if opts.version is None:
        opts.version = utilities.get_version()
    __ret__ = pulumi.runtime.invoke('github:index/getMembership:getMembership', __args__, opts=opts).value

    return AwaitableGetMembershipResult(
        etag=__ret__.get('etag'),
        id=__ret__.get('id'),
        role=__ret__.get('role'),
        username=__ret__.get('username'))
