Given an activation requirements document and an endpoint_id
    returns a string of help text for how to activate the endpoint
191270
def activation_requirements_help_text(res, ep_id):
    
    methods = supported_activation_methods(res)

    lines = [
        "This endpoint supports the following activation methods: ",
        ", ".join(methods).replace("_", " "),
        "\n",
        (
            "For web activation use:\n"
            "'globus endpoint activate --web {}'\n".format(ep_id)
            if "web" in methods
            else ""
        ),
        (
            "For myproxy activation use:\n"
            "'globus endpoint activate --myproxy {}'\n".format(ep_id)
            if "myproxy" in methods
            else ""
        ),
        (
            "For oauth activation use web activation:\n"
            "'globus endpoint activate --web {}'\n".format(ep_id)
            if "oauth" in methods
            else ""
        ),
        (
            "For delegate proxy activation use:\n"
            "'globus endpoint activate --delegate-proxy "
            "X.509_PEM_FILE {}'\n".format(ep_id)
            if "delegate_proxy" in methods
            else ""
        ),
        (
            "Delegate proxy activation requires an additional dependency on "
            "cryptography. See the docs for details:\n"
            "https://docs.globus.org/cli/reference/endpoint_activate/\n"
            if "delegate_proxy" in methods
            else ""
        ),
    ]

    return "".join(lines)
102532
def fetch(cls, id, api_key=None, endpoint=None, add_headers=None,
              **kwargs):
        
        if endpoint is None:
            endpoint = cls.get_endpoint()

        inst = cls(api_key=api_key)
        parse_key = cls.sanitize_ep(endpoint).split("/")[-1]
        endpoint = '/'.join((endpoint, id))
        data = cls._parse(inst.request('GET',
                                       endpoint=endpoint,
                                       add_headers=add_headers,
                                       query_params=kwargs),
                          key=parse_key)
        inst._set(data)
        return inst
68335
def setup_endpoints(provider):
    """"""
    app_routing = {}
    endpoints = [
        AuthorizationEndpoint(
            pyoidcMiddleware(provider.authorization_endpoint)),
        TokenEndpoint(
            pyoidcMiddleware(provider.token_endpoint)),
        UserinfoEndpoint(
            pyoidcMiddleware(provider.userinfo_endpoint)),
        RegistrationEndpoint(
            pyoidcMiddleware(provider.registration_endpoint)),
        EndSessionEndpoint(
            pyoidcMiddleware(provider.endsession_endpoint))
    ]

    for ep in endpoints:
        app_routing["/{}".format(ep.etype)] = ep

    return app_routing
277329
def show_command(endpoint_id, rule_id):
    
    client = get_client()

    rule = client.get_endpoint_acl_rule(endpoint_id, rule_id)
    formatted_print(
        rule,
        text_format=FORMAT_TEXT_RECORD,
        fields=(
            ("Rule ID", "id"),
            ("Permissions", "permissions"),
            ("Shared With", _shared_with_keyfunc),
            ("Path", "path"),
        ),
    )
516987
def server_side_activation=(activation)
      raise JSS::InvalidDataError, 'Activation must be a Time' unless activation.is_a? Time
      @server_side_limitations[:activation] = activation
      @need_to_update = true
    end
484202
def activate(self, prefix=None, backend=None):
        
        if isinstance(prefix, compat.string_types):
            self.prefix = prefix

        if isinstance(backend, RmoqStorageBackend):
            self.backend = backend

        def activate(func):
            if isinstance(func, type):
                return self._decorate_class(func)

            def wrapper(*args, **kwargs):
                with self:
                    return func(*args, **kwargs)

            return wrapper

        return activate
465201
def role_list(endpoint_id):
    
    client = get_client()
    roles = client.endpoint_role_list(endpoint_id)

    resolved_ids = LazyIdentityMap(
        x["principal"] for x in roles if x["principal_type"] == "identity"
    )

    def principal_str(role):
        principal = role["principal"]
        if role["principal_type"] == "identity":
            username = resolved_ids.get(principal)
            return username or principal
        elif role["principal_type"] == "group":
            return (u"https://app.globus.org/groups/{}").format(principal)
        else:
            return principal

    formatted_print(
        roles,
        fields=[
            ("Principal Type", "principal_type"),
            ("Role ID", "id"),
            ("Principal", principal_str),
            ("Role", "role"),
        ],
    )
1085588
def to_string(self, endpoints):
        # type: (List[EndpointDescription]) -> str
        
        # Make the ElementTree
        root = self._make_xml(endpoints)
        tree = ElementTree.ElementTree(root)

        # Force the default name space
        ElementTree.register_namespace("", EDEF_NAMESPACE)

        # Make the XML
        # Prepare a StringIO output
        output = StringIO()

        # Try to write with a correct encoding
        tree.write(
            output,
            encoding=self._encoding,
            xml_declaration=self._xml_declaration,
        )

        return output.getvalue().strip()
1116210
def get_match(self, match_id):
        """"""
        return self._make_req(endpoints.MATCH, dict(
            k=self.key,
            mp=match_id), Match)
306310
def docs
      unless identifier = shift_argument
        error("Usage: heroku addons:docs ADDON\nMust specify ADDON to open docs for.")
      end
      validate_arguments!

      # If it looks like a plan, optimistically open docs, otherwise try to
      # lookup a corresponding add-on and open the docs for its service.
      if identifier.include?(':') || get_service(identifier)
        identifier = identifier.split(':').first
        launchy("Opening #{identifier} docs", addon_docs_url(identifier))
      else
        # searching by any number of things
        addon = resolve_addon!(identifier)
        service = addon['addon_service']['name']
        launchy("Opening #{service} docs", addon_docs_url(service))
      end
    end
641632
private function endpoint($endpoint, $schema = null, $doc_id = null, $file_id = null)
    {
        $endpoints = [
            'auth' => 'auth/',
            'user' => 'auth/user/',
            'schema-list' => 'schemas/',
            'schema-detail' => 'schemas/%s/',
            'document-query' => 'schemas/%s/query/',
            'document-save' => 'schemas/%s/save/',
            'document-detail' => 'schemas/%s/%s/',
            'file-list' => 'files/',
            'file-detail' => 'files/%s/',
        ];

        if (!array_key_exists($endpoint, $endpoints))
        {
            throw new MontageUnknownEndpointException(
                sprintf('Unknown endpoint "%s" requested.', $endpoint)
            );
        }

        //do the endpoint formatting
        if (!is_null($file_id)) {
            return sprintf($endpoints[$endpoint], $file_id);
        } else if (!is_null($schema) && !is_null($doc_id)) {
            return sprintf($endpoints[$endpoint], $schema, $doc_id);
        } else if (!is_null($schema)) {
            return sprintf($endpoints[$endpoint], $schema);
        }

        return $endpoints[$endpoint];
    }
507340
def helper_list(access_token, oid, path):
    '''
    '''
    if oid != "":
        path = ''.join([path, "('", oid, "')"])
    endpoint = ''.join([ams_rest_endpoint, path])
    return do_ams_get(endpoint, path, access_token)
774889
private EndpointActivationServiceInfo createEndpointActivationServiceInfo(String id) {
        EndpointActivationServiceInfo easInfo = endpointActivationServices.get(id);
        if (easInfo == null) {
            easInfo = new EndpointActivationServiceInfo(id);
            endpointActivationServices.put(id, easInfo);
        }
        return easInfo;
    }
129855
def endpoint_deactivate(endpoint_id):
    
    client = get_client()
    res = client.endpoint_deactivate(endpoint_id)
    formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
729534
def activate(self):
        
        self.commands.register("doc_list", "List all documents", self._list_documents)
        self.commands.register("doc", "Shows the documentation", self._show_documentation)
        self.commands.register("doc_write", "Stores documents as files ", self._store_documentation,
                               params=[Argument(("path",),
                                                required=True),
                                       Option(("--html", "-h"),
                                              required=False,
                                              help="Will output html instead of rst",
                                              default=False,
                                              is_flag=True),
                                       Option(("--overwrite", "-o"),
                                              required=False,
                                              help="Will overwrite existing files",
                                              default=False,
                                              is_flag=True),
                                       Option(("--quiet", "-q"),
                                              required=False,
                                              help="Will suppress any user interaction",
                                              default=False,
                                              is_flag=True)
                                       ])

        self.documents.register(name="documents_overview",
                                content=documents_content,
                                description="Gives an overview about all registered documents")
708705
def get_documents(self, ehr_username, patient_id, start_date=None,
                      end_date=None, document_id=None, doc_type=None,
                      newest_document='N'):
        

        if not start_date:
            start_date = ''
        if not end_date:
            end_date = ''
        if not doc_type:
            doc_type = ''
        magic = self._magic_json(action=TouchWorksMagicConstants.ACTION_GET_DOCUMENTS,
                                 user_id=ehr_username, token=self._token.token,
                                 patient_id=patient_id,
                                 app_name=self._app_name,
                                 parameter1=start_date,
                                 parameter2=end_date,
                                 parameter3=document_id,
                                 parameter4=doc_type,
                                 parameter5=newest_document)
        response = self._http_request(TouchWorksEndPoints.MAGIC_JSON, data=magic)
        result = self._get_results_or_raise_if_magic_invalid(
            magic,
            response,
            TouchWorksMagicConstants.RESULT_GET_DOCUMENTS)
        return result
248330
def _get(app, endpoint, id=None, auth_required=False, **kwargs):
    '''
    
    '''
    nb = _nb_obj(auth_required=auth_required)
    if id:
        item = getattr(getattr(nb, app), endpoint).get(id)
    else:
        kwargs = __utils__['args.clean_kwargs'](**kwargs)
        item = getattr(getattr(nb, app), endpoint).get(**kwargs)
    return item