Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for TenableAD license APIs #510

Merged
merged 2 commits into from May 21, 2024

Conversation

tushar-balwani
Copy link
Contributor

Description

Added Tenable.AD License APIs

  • Get license singleton. (details)
  • Create new license singleton (create)

updated docs to support license api details

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Added tests for license endpoints to test responses
  • Added schema tests for testing payload inputs and response dict validation

Test Configuration:

  • Python Version(s) Tested: 3.8.6
  • Tenable.sc version (if necessary):

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Comment on lines 34 to 52
def create(self,
ad_license: str
) -> Dict:
'''
Create new license singleton

Args:
ad_license (str):
The AD license string object.

Return:
The license object

Example:
>>> tad.license.create(
... ad_license='license'
... )
'''
payload = self._schema.dump(self._schema.load({
'license': ad_license
}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def create(self,
ad_license: str
) -> Dict:
'''
Create new license singleton
Args:
ad_license (str):
The AD license string object.
Return:
The license object
Example:
>>> tad.license.create(
... ad_license='license'
... )
'''
payload = self._schema.dump(self._schema.load({
'license': ad_license
}))
def create(self, license: str) -> Dict:
'''
Create new license singleton
Args:
license (str):
The license string object.
Return:
The license object
Example:
>>> tad.license.create(
... license='license'
... )
'''
payload = self._schema.dump(self._schema.load({
'license': license
}))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implemented suggested changes

'type': 'license type'
}
)
resp = api.license.create(ad_license='license')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resp = api.license.create(ad_license='license')
resp = api.license.create(license='license')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implemented suggested changes

Comment on lines 27 to 29
@pre_load
def convert(self, data, **kwargs):
return convert_keys_to_camel(data, special=['search_user_dn'])
return convert_keys_to_camel(data, special=[SEARCH_USER_DN])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer necessary per #526

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed pre_load method

Comment on lines 1 to 8
'''
Constants
'''

# field-names constants that are required to be converted to
# last word uppercase
SEARCH_USER_DN: str = 'search_user_dn' # ad-ldap-configuration
EXPIRATION_DATE_UTC: str = 'expiration_date_utc' # ad-license
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer necessary per #526

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed constants file

Added feature - TenableAD license APIs

rebased to master and done requested changes
@SteveMcGrath SteveMcGrath requested a review from a team as a code owner May 21, 2024 19:12
@SteveMcGrath SteveMcGrath merged commit 862f365 into master May 21, 2024
15 checks passed
@SteveMcGrath SteveMcGrath deleted the feature/tenable.ad-license branch May 21, 2024 19:17
Copy link

sonarcloud bot commented May 21, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants