diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..c0e3cd88f --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,36 @@ +name: Release + +on: + release: + types: [created] + +jobs: + pypi-publish: + name: upload release to PyPI + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + - name: Checkout branch + uses: actions/checkout@v3 + with: + ref: ${{ github.ref }} + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install build package + id: requirements + run: | + python -m pip install --upgrade build + + - name: Build test package + id: build + if: steps.requirements.outcome == 'success' + run: | + python -m build + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..e30adea53 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,79 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at https://developer.sailpoint.com/discuss/c/feedback/. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of actions. + +**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..c8744c90a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,146 @@ +# Contribute to the SailPoint Python SDK + +The SailPoint Developer Relations Team is always actively working to improve the SailPoint Python SDK to make it as useful as possible to the SailPoint Developer Community. +This means adding and maintaining new resources and functionalities for the SDK. +The most valuable resource of all, however, is the community itself! +We greatly appreciate any input, feedback, and direct contributions you can provide to the Python SDK, big or small. +And we want to make the process of contributing to this project as easy and transparent as possible. + +This document will detail the different ways that you can contribute to the community. + +These are the main ways that you can contribute: +- [Report issues](#report-issues) +- [Request new features](#request-new-features) +- [Submit a fix](#submit-a-fix) +- [Submit a new feature](#submit-a-new-feature) + +## How we use GitHub + +We use GitHub to host code, track issues and feature requests, and manage contributions with pull requests. + +This project is open source, which means that it's publicly accessible, allowing anyone who comes across it to view, share, and improve its source code. + +## GitHub flow and pull requests + +The best way to propose changes to the codebase is to use pull requests, and [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow) is our preferred method of accepting pull requests. + +This is the basic GitHub flow we use for direct contributions to the codebase: + +1. Fork the repository and create your own branch from `main`. +2. Make your changes in your `main` branch. +3. Push the changes to the repository's `main` branch. +4. Create your pull request! +5. SailPoint Developer Relations team members will review your pull request and merge it in! + +## GitHub Issues + +We use [GitHub Issues](https://docs.github.com/en/issues/tracking-your-work-with-issues/about-issues) to publicly track bugs and feature requests. + +## Report issues + +You may encounter bugs and incorrect or outdated information when you explore the Python SDK. +We appreciate your help in identifying bugs of all sizes, from broken links or typos to major issues preventing you from using a resource. + +We use GitHub issues to track bugs publicly. If you see an issue with the SDK, please [report it here](https://github.com/sailpoint-oss/python-sdk/issues/new?assignees=&labels=&template=bug-report.md&title=%5BBug%5D+Your+Bug+Report+Here). + +We love thorough bug reports. +The more details you include, the faster we can troubleshoot and fix the issue. +Great bug reports include these details: + +1. A summary of the issue +2. The steps we can take to reproduce the issue + - Be as specific as you can when you describe these steps. + - Give us sample code if you can. +3. What you expect to happen +4. What actually happens +5. Screenshots +6. The operating system you were using when you encountered the issue +7. The browser you were using when you encountered the issue +8. Notes + - If you have an idea, tell us why you think the issue may be occurring, or what you think we should do to resolve it. + - Whatever you tried that didn't work. + - Anything else you think might be useful to us. + +## Request new features + +Many of our most valuable resources originate in ideas suggested by the community! +You may have an idea that will improve the site. +We would love to hear it and possibly implement it! + +We use GitHub issues to track feature requests. Please use [this template](https://github.com/sailpoint-oss/typescript-sdk/issues/new?assignees=&labels=&template=feature-request.md&title=%5BFeature%5D+Your+Feature+Request+Here) when you request a new feature. + +We love thorough feature requests. +The more details you include, the faster we can implement your request. +Great feature requests include these details: + +1. Tell us whether this feature is related to a problem. + - If it is, describe the problem. +2. Describe your desired solution. +3. Describe alternative solutions you may use yourself or other solutions you may have considered. +4. Notes + - If possible, include how you think this solution would benefit others. + - Anything else you think might be useful to us. + +## Submit a fix + +One of the main benefits of making our project open source is that it makes it possible for the community to contribute to the Python SDK directly. +We will always respond as quickly as we can to any issues you report, but if you know how to fix an issue, the fastest way to get it fixed is to submit a pull request and make the fix yourself! +If you can do this, it's tremendously helpful to us in our efforts to improve the community, and, if you're interested, you will receive ambassador points for your fix. +Check out the [ambassador program](https://developer.sailpoint.com/discuss/t/getting-started-as-a-developer-community-ambassador/11665) to learn more. + +To submit a fix, follow these steps: +1. Fork the repository and copy the `main` branch. +2. Pull the latest code and ensure that it's running properly. +3. Create a new branch from main. + - Follow this naming convention for your branch: `fix/your-fix-name` +4. Create a pull request from your branch to our origin repository's `main` branch! + +Once you create the pull request, the SailPoint Developer Relations Team will be tagged. +Someone will then review the pull request and merge it in! + +>Some files in the Python SDK are auto-generated, so you cannot directly make changes to them (your changes would be overwritten). +These are the auto-generated files (found within the 'sailpoint' folder) you cannot modify: +>- The 'beta' folder containing the Beta API specifications +>- The 'v3' folder containing the V3 API specifications + +## Submit a new feature + +We will always respond to your feature requests and implement them as soon as we can. +However, if you have an idea for a new feature and know how to implement it yourself, the fastest way to add the feature is to submit a pull request and add the feature yourself! +If you can do this, we greatly appreciate it, and other community members will benefit from your contribution! +And if you're interested, you will receive ambassador points for your feature contribution. +Check out the [ambassador program](https://developer.sailpoint.com/discuss/t/getting-started-as-a-developer-community-ambassador/11665) to learn more. + +To submit a new feature, follow these steps: +1. Fork the repository and copy the `main` branch. +2. Pull the latest code and ensure that it's running properly. +3. Create a new branch from main. + - Follow this naming convention for your branch: `feature/your-feature-name` +4. Create a pull request from your branch to our origin repository's `main` branch! + +Once you create the pull request, the SailPoint Developer Relations Team will be tagged. +Someone will then review the pull request and merge it in! + +>Some files in the Python SDK are auto-generated, so you cannot directly make changes to them (your changes would be overwritten). +These are the auto-generated files (found within the 'sailpoint' folder) you cannot modify: +>- The 'beta' folder containing the Beta API specifications +>- The 'v3' folder containing the V3 API specifications + +## Report general issues + +It's possible that none of the options listed here will properly address your issue. +If you have a general issue, you can submit a general issue by using GitHub's [issues](https://github.com/sailpoint-oss/python-sdk/issues). +Add as much detail as you can to your issue, and we will address it as quickly as we can. + +## Discuss on the forum + +What makes the SailPoint Developer Community great is its brilliant, knowledgeable members! +If you have a question, problem, or idea, one of the best ways to get answers or resolutions is to go to the [Developer Community Forum](https://developer.sailpoint.com/discuss) to discuss them directly with the community on the forum. +The SailPoint Developer Relations Team, the community ambassadors, and other members will be there to discuss them with you. +And once you're there, you can help others on the forum too! +If you're interested, you will receive ambassador points for the issues you help others resolve on the forum. Check out the [ambassador program](https://developer.sailpoint.com/discuss/t/getting-started-as-a-developer-community-ambassador/11665) to learn more. + +## MIT Software License + +This project uses the [MIT License](http://choosealicense.com/licenses/mit/). +Whenever you submit code changes, your submissions are held under the same MIT license that covers the project. \ No newline at end of file diff --git a/License b/License new file mode 100644 index 000000000..dc901012b --- /dev/null +++ b/License @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 SailPoint Technologies Holdings, Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index af2d1a9d4..407f4c257 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# Python SailPoint SDK + [![Discourse Topics][discourse-shield]][discourse-url] ![Times Downloaded][downloads-shield] ![Issues][issues-shield] ![Latest Releases][release-shield] ![Contributor Shield][contributor-shield] @@ -11,8 +13,29 @@ [contributor-shield]: https://img.shields.io/github/contributors/sailpoint-oss/python-sdk?label=Contributors [license-shield]: https://img.shields.io/badge/MIT-License-green -Documentation +## About the project + +The Python SDK allows you to use TypeScript to interact with the SailPoint APIs and other resources to customize and extend your SailPoint platform. + +## Documentation + +To get started with the Python SDK and learn about its various functionalities, refer to the [documentation](https://developer.sailpoint.com/idn/tools/sdk/python) on . + +## Contributing + +The SailPoint Developer Relations Team is always actively working to improve the SailPoint TypeScript SDK to make it as useful as possible to the SailPoint Developer Community. +This means adding and maintaining new resources and functionalities for the SDK. +The most valuable resource of all, however, is the community itself! +We greatly appreciate any input, feedback, and direct contributions you can provide to the TypeScript SDK, big or small. + +Refer to our [contribution guidelines](./CONTRIBUTING.md) to learn more about the different ways you can contribute to the SDK. + +Before you contribute, you [must sign our CLA](https://cla-assistant.io/sailpoint-oss/developer.sailpoint.com). + +## License + +Distributed under the MIT License. Refer to [the license](./LICENSE) for more information. -The SailPoint SDK is an API Client that provides programmable access to the SailPoint Identity Now APIs through various languages. +## Code of Conduct -For documentation, please see https://developer.sailpoint.com/idn/tools/sdk/python \ No newline at end of file +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. Read our [code of conduct](./CODE_OF_CONDUCT.md) to learn more. diff --git a/example.py b/example.py index 39db0078b..98cd53aa6 100644 --- a/example.py +++ b/example.py @@ -56,6 +56,8 @@ print(account.name) +with sailpoint.beta.ApiClient(configuration) as api_client: + workgroups = sailpoint.beta.GovernanceGroupsApi(api_client).list_workgroups() for workgroup in workgroups: print(workgroup.name) \ No newline at end of file diff --git a/sailpoint/cc_README.md b/sailpoint/cc_README.md deleted file mode 100644 index c6ee0af65..000000000 --- a/sailpoint/cc_README.md +++ /dev/null @@ -1,149 +0,0 @@ -# sailpoint.cc -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - -The `sailpoint.cc` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: 1.0.0 -- Package version: 1.0.0 -- Build package: org.openapitools.codegen.languages.PythonClientCodegen - -## Requirements. - -Python 3.7+ - -## Installation & Usage - -This python library package is generated without supporting files like setup.py or requirements files - -To be able to use it, you will need these dependencies in your own package that uses this library: - -* urllib3 >= 1.25.3 -* python-dateutil -* pydantic - -## Getting Started - -In your own code, to use this library to connect and interact with sailpoint.cc, -you can run the following: - -```python - -import time -import sailpoint.cc -from sailpoint.cc.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://sailpoint.api.identitynow.com -# See configuration.py for a list of all supported configuration parameters. -configuration = sailpoint.cc.Configuration( - host = "https://sailpoint.api.identitynow.com" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -configuration.access_token = os.environ["ACCESS_TOKEN"] - - -# Enter a context with an instance of the API client -with sailpoint.cc.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = sailpoint.cc.AccountsApi(api_client) - - try: - # List Accounts - api_response = api_instance.list_accounts() - print("The response of AccountsApi->list_accounts:\n") - pprint(api_response) - except ApiException as e: - print("Exception when calling AccountsApi->list_accounts: %s\n" % e) - -``` - -## Documentation for API Endpoints - -All URIs are relative to *https://sailpoint.api.identitynow.com* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*AccountsApi* | [**list_accounts**](sailpoint/cc/docs/AccountsApi.md#list_accounts) | **GET** /cc/api/account/list | List Accounts -*AccountsApi* | [**remove_account**](sailpoint/cc/docs/AccountsApi.md#remove_account) | **POST** /cc/api/account/remove/{id} | Remove Account -*ApplicationsApi* | [**create_application**](sailpoint/cc/docs/ApplicationsApi.md#create_application) | **POST** /cc/api/app/create | Create Application -*ApplicationsApi* | [**delete_application**](sailpoint/cc/docs/ApplicationsApi.md#delete_application) | **POST** /cc/api/app/delete/{id} | Delete Application -*ApplicationsApi* | [**get_application**](sailpoint/cc/docs/ApplicationsApi.md#get_application) | **GET** /cc/api/app/get/{id} | Get Single Application -*ApplicationsApi* | [**get_application_access_profiles**](sailpoint/cc/docs/ApplicationsApi.md#get_application_access_profiles) | **GET** /cc/api/app/getAccessProfiles/{id} | Get Access Profiles for Application -*ApplicationsApi* | [**list_applications**](sailpoint/cc/docs/ApplicationsApi.md#list_applications) | **GET** /cc/api/app/list | List Applications -*ApplicationsApi* | [**update_application**](sailpoint/cc/docs/ApplicationsApi.md#update_application) | **POST** /cc/api/app/update/{id} | Update Application -*ConnectorsApi* | [**create_connector**](sailpoint/cc/docs/ConnectorsApi.md#create_connector) | **POST** /cc/api/connector/create | Create Connector -*ConnectorsApi* | [**delete_connector**](sailpoint/cc/docs/ConnectorsApi.md#delete_connector) | **POST** /cc/api/connector/delete/{id} | Delete Connector -*ConnectorsApi* | [**export_connector_config**](sailpoint/cc/docs/ConnectorsApi.md#export_connector_config) | **GET** /cc/api/connector/export/{id} | Export Connector Config -*ConnectorsApi* | [**import_connector_config**](sailpoint/cc/docs/ConnectorsApi.md#import_connector_config) | **POST** /cc/api/connector/import/{id} | Import Connector Config -*ConnectorsApi* | [**list_connectors**](sailpoint/cc/docs/ConnectorsApi.md#list_connectors) | **GET** /cc/api/connector/list | List Connectors -*SourcesAccountsApi* | [**export_account_feed**](sailpoint/cc/docs/SourcesAccountsApi.md#export_account_feed) | **GET** /cc/api/source/exportAccountFeed/{id} | Export Account Feed -*SourcesAggregationApi* | [**load_accounts**](sailpoint/cc/docs/SourcesAggregationApi.md#load_accounts) | **POST** /cc/api/source/loadAccounts/{id} | Account Aggregation (File) -*SourcesAggregationApi* | [**load_entitlements**](sailpoint/cc/docs/SourcesAggregationApi.md#load_entitlements) | **POST** /cc/api/source/loadEntitlements/{id} | Account Aggregation (File) -*SystemApi* | [**refresh_identities**](sailpoint/cc/docs/SystemApi.md#refresh_identities) | **POST** /cc/api/system/refreshIdentities | Refresh Identities -*UserApi* | [**get_identity**](sailpoint/cc/docs/UserApi.md#get_identity) | **GET** /cc/api/user/get/{id} | Get Single Identity -*UserApi* | [**update_user_permissions**](sailpoint/cc/docs/UserApi.md#update_user_permissions) | **POST** /cc/api/user/updatePermissions | Update User Permissions - - -## Documentation For Models - - - [CreateApplicationRequest](sailpoint/cc/docs/CreateApplicationRequest.md) - - [CreateConnectorRequest](sailpoint/cc/docs/CreateConnectorRequest.md) - - [GetApplication200Response](sailpoint/cc/docs/GetApplication200Response.md) - - [GetIdentity200Response](sailpoint/cc/docs/GetIdentity200Response.md) - - [GetIdentity200ResponseAuth](sailpoint/cc/docs/GetIdentity200ResponseAuth.md) - - [GetIdentity200ResponseOrg](sailpoint/cc/docs/GetIdentity200ResponseOrg.md) - - [ImportConnectorConfigRequest](sailpoint/cc/docs/ImportConnectorConfigRequest.md) - - [ListAccounts200ResponseInner](sailpoint/cc/docs/ListAccounts200ResponseInner.md) - - [ListAccounts200ResponseInnerPasswordChangeResult](sailpoint/cc/docs/ListAccounts200ResponseInnerPasswordChangeResult.md) - - [ListApplications200ResponseInner](sailpoint/cc/docs/ListApplications200ResponseInner.md) - - [ListApplications200ResponseInnerAccountServicePoliciesInner](sailpoint/cc/docs/ListApplications200ResponseInnerAccountServicePoliciesInner.md) - - [ListApplications200ResponseInnerAppProfilesInner](sailpoint/cc/docs/ListApplications200ResponseInnerAppProfilesInner.md) - - [ListApplications200ResponseInnerHealth](sailpoint/cc/docs/ListApplications200ResponseInnerHealth.md) - - [ListApplications200ResponseInnerOwner](sailpoint/cc/docs/ListApplications200ResponseInnerOwner.md) - - [ListConnectors200Response](sailpoint/cc/docs/ListConnectors200Response.md) - - [ListConnectors200ResponseItemsInner](sailpoint/cc/docs/ListConnectors200ResponseItemsInner.md) - - [LoadAccountsRequest](sailpoint/cc/docs/LoadAccountsRequest.md) - - [LoadEntitlementsRequest](sailpoint/cc/docs/LoadEntitlementsRequest.md) - - [RefreshIdentitiesRequest](sailpoint/cc/docs/RefreshIdentitiesRequest.md) - - [RefreshIdentitiesRequestRefreshArgs](sailpoint/cc/docs/RefreshIdentitiesRequestRefreshArgs.md) - - [UpdateUserPermissionsRequest](sailpoint/cc/docs/UpdateUserPermissionsRequest.md) - - - -## Documentation For Authorization - - -Authentication schemes defined for the API: - -### UserContextAuth - -- **Type**: OAuth -- **Flow**: application -- **Authorization URL**: -- **Scopes**: - - **sp:scopes:default**: default scope - - **sp:scopes:all**: access to all scopes - - -### UserContextAuth - -- **Type**: OAuth -- **Flow**: accessCode -- **Authorization URL**: https://tenant.identitynow.com/oauth/authorize -- **Scopes**: - - **sp:scopes:default**: default scope - - **sp:scopes:all**: access to all scopes - - -## Author - - - - diff --git a/sailpoint/configuration.py b/sailpoint/configuration.py index 8e825e63f..dc0a56679 100644 --- a/sailpoint/configuration.py +++ b/sailpoint/configuration.py @@ -29,9 +29,9 @@ def __init__(self, configurationParams: ConfigurationParams = None) -> None: self.client_secret = configurationParams.client_secret self.token_url = configurationParams.token_url - url = f"{self.token_url}?grant_type=client_credentials&client_id={self.client_id}&client_secret={self.client_secret}" + url = f"{self.token_url}" if self.access_token == None: - self.access_token = self.get_access_token(url) + self.access_token = self.get_access_token(url, self.client_id, self.client_secret) self.temp_folder_path = None """Temp file folder for downloading files @@ -166,10 +166,10 @@ def get_local_params(self) -> ConfigurationParams: return config @classmethod - def get_access_token(self, url: str) -> str: + def get_access_token(self, url: str, client_id: str, client_secret: str) -> str: try: http = urllib3.PoolManager() - response = http.request("POST", url) + response = http.request_encode_body("POST", url, encode_multipart=False, fields={"grant_type": "client_credentials", "client_id": client_id, "client_secret": client_secret}) data = json.loads(response.data) if response.status == 200: return data["access_token"] diff --git a/sailpoint/configuration_generated.py b/sailpoint/configuration_generated.py deleted file mode 100644 index 14aa62db9..000000000 --- a/sailpoint/configuration_generated.py +++ /dev/null @@ -1,537 +0,0 @@ -# coding: utf-8 - -""" - IdentityNow V3 API - - Use these APIs to interact with the IdentityNow platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs. - - The version of the OpenAPI document: 3.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - -import json -import os -import copy -import logging -import multiprocessing -import sys -import urllib3 - -import http.client as httplib - -JSON_SCHEMA_VALIDATION_KEYWORDS = { - 'multipleOf', 'maximum', 'exclusiveMaximum', 'minimum', 'exclusiveMinimum', - 'maxLength', 'minLength', 'pattern', 'maxItems', 'minItems' -} - - -class Configuration: - """This class contains various settings of the API client. - - :param host: Base url. - :param api_key: Dict to store API key(s). - Each entry in the dict specifies an API key. - The dict key is the name of the security scheme in the OAS specification. - The dict value is the API key secret. - :param api_key_prefix: Dict to store API prefix (e.g. Bearer). - The dict key is the name of the security scheme in the OAS specification. - The dict value is an API key prefix when generating the auth data. - :param username: Username for HTTP basic authentication. - :param password: Password for HTTP basic authentication. - :param access_token: Access token. - :param server_index: Index to servers configuration. - :param server_variables: Mapping with string values to replace variables in - templated server configuration. The validation of enums is performed for - variables with defined enum values before. - :param server_operation_index: Mapping from operation ID to an index to server - configuration. - :param server_operation_variables: Mapping from operation ID to a mapping with - string values to replace variables in templated server configuration. - The validation of enums is performed for variables with defined enum - values before. - :param ssl_ca_cert: str - the path to a file of concatenated CA certificates - in PEM format. - - :Example: - """ - - _default = None - - def __init__( - self, - host=None, - base_url=None, - client_id=None, - client_secret=None, - token_url=None, - api_key=None, - api_key_prefix=None, - username=None, - password=None, - access_token=None, - server_index=None, - server_variables=None, - server_operation_index=None, - server_operation_variables=None, - ssl_ca_cert=None, - ) -> None: - """Constructor - """ - - - - self._base_path = "https://sailpoint.api.identitynow.com/v3" if host is None else host - """Default Base url - """ - - self.base_url = None - self.client_id = None - self.client_secret = None - - self.server_index = 0 if server_index is None and host is None else server_index - self.server_operation_index = server_operation_index or {} - """Default server index - """ - self.server_variables = server_variables or {} - self.server_operation_variables = server_operation_variables or {} - """Default server variables - """ - self.temp_folder_path = None - """Temp file folder for downloading files - """ - # Authentication Settings - self.api_key = {} - if api_key: - self.api_key = api_key - """dict to store API key(s) - """ - self.api_key_prefix = {} - if api_key_prefix: - self.api_key_prefix = api_key_prefix - """dict to store API prefix (e.g. Bearer) - """ - self.refresh_api_key_hook = None - """function hook to refresh API key if expired - """ - self.username = username - """Username for HTTP basic authentication - """ - self.password = password - """Password for HTTP basic authentication - """ - self.access_token = access_token - """Access token - """ - self.logger = {} - """Logging Settings - """ - self.logger["package_logger"] = logging.getLogger("v3") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = '%(asctime)s %(levelname)s %(message)s' - """Log format - """ - self.logger_stream_handler = None - """Log stream handler - """ - self.logger_file_handler = None - """Log file handler - """ - self.logger_file = None - """Debug file location - """ - self.debug = False - """Debug switch - """ - - self.verify_ssl = True - """SSL/TLS verification - Set this to false to skip verifying SSL certificate when calling API - from https server. - """ - self.ssl_ca_cert = ssl_ca_cert - """Set this to customize the certificate file to verify the peer. - """ - self.cert_file = None - """client certificate file - """ - self.key_file = None - """client key file - """ - self.assert_hostname = None - """Set this to True/False to enable/disable SSL hostname verification. - """ - self.tls_server_name = None - """SSL/TLS Server Name Indication (SNI) - Set this to the SNI value expected by the server. - """ - - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - """urllib3 connection pool's maximum number of connections saved - per pool. urllib3 uses 1 connection as default value, but this is - not the best value when you are making a lot of possibly parallel - requests to the same host, which is often the case here. - cpu_count * 5 is used as default value to increase performance. - """ - - self.proxy = None - """Proxy URL - """ - self.proxy_headers = None - """Proxy headers - """ - self.safe_chars_for_path_param = '' - """Safe chars for path_param - """ - self.retries = None - """Adding retries to override urllib3 default value 3 - """ - # Enable client side validation - self.client_side_validation = True - - self.socket_options = None - """Options to pass down to the underlying urllib3 socket - """ - - self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" - """datetime format - """ - - self.date_format = "%Y-%m-%d" - """date format - """ - - #self.get_config() - - #print(self.client_id) - - # if(self.get_config() == False): - # raise Exception("No configuration options set. Please set configuration through environment variables or a local json config file.") - - @classmethod - def environment_config(self)-> Configuration: - if(os.environ.get('SAIL_BASE_URL')): - self.host = os.environ.get('SAIL_BASE_URL') - if(os.environ.get('SAIL_CLIENT_ID')): - self.client_id = os.environ.get('SAIL_CLIENT_ID') - if(os.environ.get('SAIL_CLIENT_SECRET')): - self.client_secret = os.environ.get('SAIL_CLIENT_SECRET') - - self.token_url = str(self.host) + '/oauth/token' - - @classmethod - def local_config(self): - config = Configuration() - if(os.path.exists('./config.json')): - ("File is present") - with open('./config.json') as file: - data = json.load(file) - config.base_url = data['BaseURL'] - config.client_id = data['ClientId'] - config.client_secret = data['ClientSecret'] - config.token_url = config.base_url + '/oauth/token' - return config - - @classmethod - def get_config(self): - envConfiguration = self.environment_config() - - if(envConfiguration.client_id): - return True - - self.local_config() - - if(self.client_id): - return True - - return False - - - def __deepcopy__(self, memo): - cls = self.__class__ - result = cls.__new__(cls) - memo[id(self)] = result - for k, v in self.__dict__.items(): - if k not in ('logger', 'logger_file_handler'): - setattr(result, k, copy.deepcopy(v, memo)) - # shallow copy of loggers - result.logger = copy.copy(self.logger) - # use setters to configure loggers - result.logger_file = self.logger_file - result.debug = self.debug - return result - - def __setattr__(self, name, value): - object.__setattr__(self, name, value) - - @classmethod - def set_default(cls, default): - """Set default instance of configuration. - - It stores default configuration, which can be - returned by get_default_copy method. - - :param default: object of Configuration - """ - cls._default = default - - @classmethod - def get_default_copy(cls): - """Deprecated. Please use `get_default` instead. - - Deprecated. Please use `get_default` instead. - - :return: The configuration object. - """ - return cls.get_default() - - @classmethod - def get_default(cls): - """Return the default configuration. - - This method returns newly created, based on default constructor, - object of Configuration class or returns a copy of default - configuration. - - :return: The configuration object. - """ - if cls._default is None: - cls._default = Configuration() - return cls._default - - @property - def logger_file(self): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - return self.__logger_file - - @logger_file.setter - def logger_file(self, value): - """The logger file. - - If the logger_file is None, then add stream handler and remove file - handler. Otherwise, add file handler and remove stream handler. - - :param value: The logger_file path. - :type: str - """ - self.__logger_file = value - if self.__logger_file: - # If set logging file, - # then add file handler and remove stream handler. - self.logger_file_handler = logging.FileHandler(self.__logger_file) - self.logger_file_handler.setFormatter(self.logger_formatter) - for _, logger in self.logger.items(): - logger.addHandler(self.logger_file_handler) - - @property - def debug(self): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - return self.__debug - - @debug.setter - def debug(self, value): - """Debug status - - :param value: The debug status, True or False. - :type: bool - """ - self.__debug = value - if self.__debug: - # if debug status is True, turn on debug logging - for _, logger in self.logger.items(): - logger.setLevel(logging.DEBUG) - # turn on httplib debug - httplib.HTTPConnection.debuglevel = 1 - else: - # if debug status is False, turn off debug logging, - # setting log level to default `logging.WARNING` - for _, logger in self.logger.items(): - logger.setLevel(logging.WARNING) - # turn off httplib debug - httplib.HTTPConnection.debuglevel = 0 - - @property - def logger_format(self): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - return self.__logger_format - - @logger_format.setter - def logger_format(self, value): - """The logger format. - - The logger_formatter will be updated when sets logger_format. - - :param value: The format string. - :type: str - """ - self.__logger_format = value - self.logger_formatter = logging.Formatter(self.__logger_format) - - def get_api_key_with_prefix(self, identifier, alias=None): - """Gets API key (with prefix if set). - - :param identifier: The identifier of apiKey. - :param alias: The alternative identifier of apiKey. - :return: The token for api key authentication. - """ - if self.refresh_api_key_hook is not None: - self.refresh_api_key_hook(self) - key = self.api_key.get( - identifier, - self.api_key.get(alias) if alias is not None else None) - if key: - prefix = self.api_key_prefix.get(identifier) - if prefix: - return "%s %s" % (prefix, key) - else: - return key - - def get_basic_auth_token(self): - """Gets HTTP basic authentication header (string). - - :return: The token for basic HTTP authentication. - """ - username = "" - if self.username is not None: - username = self.username - password = "" - if self.password is not None: - password = self.password - return urllib3.util.make_headers(basic_auth=username + ':' + - password).get('authorization') - - def auth_settings(self): - """Gets Auth Settings dict for api client. - - :return: The Auth Settings information dict. - """ - auth = {} - if self.access_token is not None: - auth['UserContextAuth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } - if self.access_token is not None: - auth['UserContextAuth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } - if self.access_token is not None: - auth['ApplicationOnlyAuth'] = { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - } - return auth - - def to_debug_report(self): - """Gets the essential information for debugging. - - :return: The report for debugging. - """ - return "Python SDK Debug Report:\n"\ - "OS: {env}\n"\ - "Python Version: {pyversion}\n"\ - "Version of the API: 3.0.0\n"\ - "SDK Package Version: 1.0.0".\ - format(env=sys.platform, pyversion=sys.version) - - def get_host_settings(self): - """Gets an array of host settings - - :return: An array of host settings - """ - return [{ - 'url': "https://{tenant}.api.identitynow.com/v3", - 'description': "This is the production API server.", - 'variables': { - 'tenant': { - 'description': - "This is the name of your tenant, typically your company's name.", - 'default_value': "sailpoint", - } - } - }, { - 'url': "https://{apiUrl}/v3", - 'description': "This is the V3 API server.", - 'variables': { - 'apiUrl': { - 'description': "This is the api url of your tenant", - 'default_value': "sailpoint.api.identitynow.com", - } - } - }] - - def get_host_from_settings(self, index, variables=None, servers=None): - """Gets host URL based on the index and variables - :param index: array index of the host settings - :param variables: hash of variable and the corresponding value - :param servers: an array of host settings or None - :return: URL based on host settings - """ - if index is None: - return self._base_path - - variables = {} if variables is None else variables - servers = self.get_host_settings() if servers is None else servers - - try: - server = servers[index] - except IndexError: - raise ValueError( - "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers))) - - url = server['url'] - - # go through variables and replace placeholders - for variable_name, variable in server.get('variables', {}).items(): - used_value = variables.get(variable_name, - variable['default_value']) - - if 'enum_values' in variable \ - and used_value not in variable['enum_values']: - raise ValueError( - "The variable `{0}` in the host URL has invalid value " - "{1}. Must be {2}.".format(variable_name, - variables[variable_name], - variable['enum_values'])) - - url = url.replace("{" + variable_name + "}", used_value) - - return url - - @property - def host(self): - """Return generated host.""" - return self.get_host_from_settings(self.server_index, - variables=self.server_variables) - - @host.setter - def host(self, value): - """Fix base path.""" - self._base_path = value - self.server_index = None diff --git a/sailpoint/v2_README.md b/sailpoint/v2_README.md deleted file mode 100644 index 6350b75f9..000000000 --- a/sailpoint/v2_README.md +++ /dev/null @@ -1,136 +0,0 @@ -# sailpoint.v2 -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - -The `sailpoint.v2` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - -- API version: 2.0.0 -- Package version: 1.0.0 -- Build package: org.openapitools.codegen.languages.PythonClientCodegen - -## Requirements. - -Python 3.7+ - -## Installation & Usage - -This python library package is generated without supporting files like setup.py or requirements files - -To be able to use it, you will need these dependencies in your own package that uses this library: - -* urllib3 >= 1.25.3 -* python-dateutil -* pydantic - -## Getting Started - -In your own code, to use this library to connect and interact with sailpoint.v2, -you can run the following: - -```python - -import time -import sailpoint.v2 -from sailpoint.v2.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://sailpoint.api.identitynow.com/v2 -# See configuration.py for a list of all supported configuration parameters. -configuration = sailpoint.v2.Configuration( - host = "https://sailpoint.api.identitynow.com/v2" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -configuration.access_token = os.environ["ACCESS_TOKEN"] - -configuration.access_token = os.environ["ACCESS_TOKEN"] - - -# Enter a context with an instance of the API client -with sailpoint.v2.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = sailpoint.v2.GovernanceGroupsApi(api_client) - bulk_delete_work_groups_request = sailpoint.v2.BulkDeleteWorkGroupsRequest() # BulkDeleteWorkGroupsRequest | Work group ids to delete - - try: - # Bulk delete work groups - api_response = api_instance.bulk_delete_work_groups(bulk_delete_work_groups_request) - print("The response of GovernanceGroupsApi->bulk_delete_work_groups:\n") - pprint(api_response) - except ApiException as e: - print("Exception when calling GovernanceGroupsApi->bulk_delete_work_groups: %s\n" % e) - -``` - -## Documentation for API Endpoints - -All URIs are relative to *https://sailpoint.api.identitynow.com/v2* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*GovernanceGroupsApi* | [**bulk_delete_work_groups**](sailpoint/v2/docs/GovernanceGroupsApi.md#bulk_delete_work_groups) | **POST** /workgroups/bulk-delete | Bulk delete work groups -*GovernanceGroupsApi* | [**create_workgroup**](sailpoint/v2/docs/GovernanceGroupsApi.md#create_workgroup) | **POST** /workgroups | Create Work Group -*GovernanceGroupsApi* | [**delete_workgroup**](sailpoint/v2/docs/GovernanceGroupsApi.md#delete_workgroup) | **DELETE** /workgroups/{workgroupId} | Delete Work Group By Id -*GovernanceGroupsApi* | [**get_workgroup**](sailpoint/v2/docs/GovernanceGroupsApi.md#get_workgroup) | **GET** /workgroups/{workgroupId} | Get Work Group By Id -*GovernanceGroupsApi* | [**list_workgroup_connections**](sailpoint/v2/docs/GovernanceGroupsApi.md#list_workgroup_connections) | **GET** /workgroups/{workgroupId}/connections | List Work Group Connections -*GovernanceGroupsApi* | [**list_workgroup_members**](sailpoint/v2/docs/GovernanceGroupsApi.md#list_workgroup_members) | **GET** /workgroups/{workgroupId}/members | List Work Group Members -*GovernanceGroupsApi* | [**list_workgroups**](sailpoint/v2/docs/GovernanceGroupsApi.md#list_workgroups) | **GET** /workgroups | List Work Groups -*GovernanceGroupsApi* | [**modify_workgroup_members**](sailpoint/v2/docs/GovernanceGroupsApi.md#modify_workgroup_members) | **POST** /workgroups/{workgroupId}/members | Modify Work Group Members -*GovernanceGroupsApi* | [**update_workgroup**](sailpoint/v2/docs/GovernanceGroupsApi.md#update_workgroup) | **PATCH** /workgroups/{workgroupId} | Update Work Group By Id -*OrgApi* | [**get_org_settings**](sailpoint/v2/docs/OrgApi.md#get_org_settings) | **GET** /org | Retrieves your org settings. -*OrgApi* | [**update_org_settings**](sailpoint/v2/docs/OrgApi.md#update_org_settings) | **PATCH** /org | Updates one or more org attributes. - - -## Documentation For Models - - - [BulkDeleteWorkGroups200Response](sailpoint/v2/docs/BulkDeleteWorkGroups200Response.md) - - [BulkDeleteWorkGroupsRequest](sailpoint/v2/docs/BulkDeleteWorkGroupsRequest.md) - - [CreateWorkgroupRequest](sailpoint/v2/docs/CreateWorkgroupRequest.md) - - [CreateWorkgroupRequestOwner](sailpoint/v2/docs/CreateWorkgroupRequestOwner.md) - - [GetOrgSettings200Response](sailpoint/v2/docs/GetOrgSettings200Response.md) - - [GetOrgSettings200ResponseApprovalConfig](sailpoint/v2/docs/GetOrgSettings200ResponseApprovalConfig.md) - - [GetOrgSettings200ResponseSystemNotificationConfig](sailpoint/v2/docs/GetOrgSettings200ResponseSystemNotificationConfig.md) - - [GetOrgSettings200ResponseSystemNotificationConfigNotificationsInner](sailpoint/v2/docs/GetOrgSettings200ResponseSystemNotificationConfigNotificationsInner.md) - - [GetOrgSettings200ResponseSystemNotificationConfigNotificationsInnerThresholds](sailpoint/v2/docs/GetOrgSettings200ResponseSystemNotificationConfigNotificationsInnerThresholds.md) - - [ListWorkgroupConnections200ResponseInner](sailpoint/v2/docs/ListWorkgroupConnections200ResponseInner.md) - - [ListWorkgroupMembers200ResponseInner](sailpoint/v2/docs/ListWorkgroupMembers200ResponseInner.md) - - [ListWorkgroups200ResponseInner](sailpoint/v2/docs/ListWorkgroups200ResponseInner.md) - - [ListWorkgroups200ResponseInnerOwner](sailpoint/v2/docs/ListWorkgroups200ResponseInnerOwner.md) - - [ModifyWorkgroupMembersRequest](sailpoint/v2/docs/ModifyWorkgroupMembersRequest.md) - - [UpdateOrgSettingsRequest](sailpoint/v2/docs/UpdateOrgSettingsRequest.md) - - - -## Documentation For Authorization - - -Authentication schemes defined for the API: - -### UserContextAuth - -- **Type**: OAuth -- **Flow**: application -- **Authorization URL**: -- **Scopes**: - - **sp:scopes:default**: default scope - - **sp:scopes:all**: access to all scopes - - -### UserContextAuth - -- **Type**: OAuth -- **Flow**: accessCode -- **Authorization URL**: https://tenant.identitynow.com/oauth/authorize -- **Scopes**: - - **sp:scopes:default**: default scope - - **sp:scopes:all**: access to all scopes - - -## Author - - - - diff --git a/setup.py b/setup.py index 89e2733cf..0c39dfdee 100644 --- a/setup.py +++ b/setup.py @@ -19,10 +19,10 @@ setup( name=NAME, version=VERSION, - description="SailPoint SDK", - author="Developer Relations", + description="The SailPoint API SDK for Python", + author="SailPoint Developer Relations", author_email="developer-relations@sailpoint.com", - url="", + url="https://developer.sailpoint.com/", keywords=["OpenAPI", "OpenAPI-Generator", "SailPoint", "SDK"], install_requires=REQUIRES, packages=find_packages(exclude=["test", "tests"]), @@ -33,4 +33,24 @@ Use this SDK to interact with the IdentityNow platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs. """, # noqa: E501 package_data={"sailpoint": ["py.typed"]}, + classifiers=[ + "Development Status :: 4 - Beta", + + "Intended Audience :: Developers", + + "License :: OSI Approved :: MIT License", + + "Operating System :: OS Independent", + + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + ], + project_urls={ + "Documentation": "https://developer.sailpoint.com/idn/tools/sdk/python", + "Issues": "https://github.com/sailpoint-oss/python-sdk/issues" + } )