<reponame>VeritasOS/NetBackup-Flex-Scale-REST-API-nuggets<filename>get_security_status.py
"""This scenario lists STIG and FIPS status of a given cluster
    Scenario requires below Environment Variables:
	APPLIANCE_ADMIN_USERNAME=""
	APPLIANCE_ADMIN_PASSWORD=""
	API_GATEWAY_IP=""
"""

import logging
import os
import sys
import utils
import log

sys.path.append(os.path.realpath('..'))

logger = logging.getLogger('get_security_status')
logger.addHandler(logging.NullHandler())

log.init_logger()

def main():
    username = os.environ.get("APPLIANCE_ADMIN_USERNAME", None)
    passwd = os.environ.get("APPLIANCE_ADMIN_PASSWORD", None)
    api_gateway = os.environ.get("API_GATEWAY_IP", None)  

    # Input parameter validation
    if(not username or not passwd or not api_gateway):
        logger.error("Missing required environment variable/s,"
                    "please check doc string for required variables")
        return 1

    # Description: Get FIPS status
    utils.run_api(api_gateway, "/api/appliance/v1.0/security/fips",
                username, passwd, req_type='get')

    # Description: Get STIG status
    utils.run_api(api_gateway, "/api/appliance/v1.0/security/stig",
                username, passwd, req_type='get')

    # Description: Get lockdown-mode
    utils.run_api(api_gateway, "/api/appliance/v1.0/security/lockdown"
                "-mode", username, passwd, req_type='get')

if __name__ == "__main__":
    main()

"""This scenario lists STIG and FIPS status of a given cluster
    Scenario requires below Environment Variables:
	APPLIANCE_ADMIN_USERNAME=""
	APPLIANCE_ADMIN_PASSWORD=""
	API_GATEWAY_IP=""
"""

import logging
import os
import sys
import utils
import log

sys.path.append(os.path.realpath('..'))

logger = logging.getLogger('get_security_status')
logger.addHandler(logging.NullHandler())

log.init_logger()

def main():
    username = os.environ.get("APPLIANCE_ADMIN_USERNAME", None)
    passwd = os.environ.get("APPLIANCE_ADMIN_PASSWORD", None)
    api_gateway = os.environ.get("API_GATEWAY_IP", None)  

    # Input parameter validation
    if(not username or not passwd or not api_gateway):
        logger.error("Missing required environment variable/s,"
                    "please check doc string for required variables")
        return 1

    # Description: Get FIPS status
    utils.run_api(api_gateway, "/api/appliance/v1.0/security/fips",
                username, passwd, req_type='get')

    # Description: Get STIG status
    utils.run_api(api_gateway, "/api/appliance/v1.0/security/stig",
                username, passwd, req_type='get')

    # Description: Get lockdown-mode
    utils.run_api(api_gateway, "/api/appliance/v1.0/security/lockdown"
                "-mode", username, passwd, req_type='get')

if __name__ == "__main__":
    main()
This scenario lists STIG and FIPS status of a given cluster     Scenario requires below Environment Variables: 	APPLIANCE_ADMIN_USERNAME="" 	APPLIANCE_ADMIN_PASSWORD="" 	API_GATEWAY_IP="" # Input parameter validation # Description: Get FIPS status # Description: Get STIG status # Description: Get lockdown-mode