Create credentials.

        Creates a set of credentials to connect to a remote source. Created credentials
        are used in a configuration to associate a collection with the remote source.
        **Note:** All credentials are sent over an encrypted connection and encrypted at
        rest.

        :param str environment_id: The ID of the environment.
        :param str source_type: The source that this credentials object connects to.
        -  `box` indicates the credentials are used to connect an instance of Enterprise
        Box.
        -  `salesforce` indicates the credentials are used to connect to Salesforce.
        -  `sharepoint` indicates the credentials are used to connect to Microsoft
        SharePoint Online.
        -  `web_crawl` indicates the credentials are used to perform a web crawl.
        =  `cloud_object_storage` indicates the credentials are used to connect to an IBM
        Cloud Object Store.
        :param CredentialDetails credential_details: Object containing details of the
        stored credentials.
        Obtain credentials for your source from the administrator of the source.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse

def create_credentials(self,
                           environment_id,
                           source_type=None,
                           credential_details=None,
                           **kwargs):
        """
        Create credentials.

        Creates a set of credentials to connect to a remote source. Created credentials
        are used in a configuration to associate a collection with the remote source.
        **Note:** All credentials are sent over an encrypted connection and encrypted at
        rest.

        :param str environment_id: The ID of the environment.
        :param str source_type: The source that this credentials object connects to.
        -  `box` indicates the credentials are used to connect an instance of Enterprise
        Box.
        -  `salesforce` indicates the credentials are used to connect to Salesforce.
        -  `sharepoint` indicates the credentials are used to connect to Microsoft
        SharePoint Online.
        -  `web_crawl` indicates the credentials are used to perform a web crawl.
        =  `cloud_object_storage` indicates the credentials are used to connect to an IBM
        Cloud Object Store.
        :param CredentialDetails credential_details: Object containing details of the
        stored credentials.
        Obtain credentials for your source from the administrator of the source.
        :param dict headers: A `dict` containing the request headers
        :return: A `DetailedResponse` containing the result, headers and HTTP status code.
        :rtype: DetailedResponse
        """

        if environment_id is None:
            raise ValueError('environment_id must be provided')
        if credential_details is not None:
            credential_details = self._convert_model(credential_details,
                                                     CredentialDetails)

        headers = {}
        if 'headers' in kwargs:
            headers.update(kwargs.get('headers'))
        sdk_headers = get_sdk_headers('discovery', 'V1', 'create_credentials')
        headers.update(sdk_headers)

        params = {'version': self.version}

        data = {
            'source_type': source_type,
            'credential_details': credential_details
        }

        url = '/v1/environments/{0}/credentials'.format(
            *self._encode_path_vars(environment_id))
        response = self.request(
            method='POST',
            url=url,
            headers=headers,
            params=params,
            json=data,
            accept_json=True)
        return response