|
| 1 | +"""CrowdStrike Falcon CloudSecurityCompliance API interface class. |
| 2 | +
|
| 3 | + _______ __ _______ __ __ __ |
| 4 | +| _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |
| 5 | +|. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |
| 6 | +|. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |
| 7 | +|: 1 | |: 1 | |
| 8 | +|::.. . | CROWDSTRIKE FALCON |::.. . | FalconPy |
| 9 | +`-------' `-------' |
| 10 | +
|
| 11 | +OAuth2 API - Customer SDK |
| 12 | +
|
| 13 | +This is free and unencumbered software released into the public domain. |
| 14 | +
|
| 15 | +Anyone is free to copy, modify, publish, use, compile, sell, or |
| 16 | +distribute this software, either in source code form or as a compiled |
| 17 | +binary, for any purpose, commercial or non-commercial, and by any |
| 18 | +means. |
| 19 | +
|
| 20 | +In jurisdictions that recognize copyright laws, the author or authors |
| 21 | +of this software dedicate any and all copyright interest in the |
| 22 | +software to the public domain. We make this dedication for the benefit |
| 23 | +of the public at large and to the detriment of our heirs and |
| 24 | +successors. We intend this dedication to be an overt act of |
| 25 | +relinquishment in perpetuity of all present and future rights to this |
| 26 | +software under copyright law. |
| 27 | +
|
| 28 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 29 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 30 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 31 | +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 32 | +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 33 | +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 34 | +OTHER DEALINGS IN THE SOFTWARE. |
| 35 | +
|
| 36 | +For more information, please refer to <https://unlicense.org> |
| 37 | +""" |
| 38 | +from typing import Dict, Union |
| 39 | +from ._util import force_default, process_service_request, handle_single_argument |
| 40 | +from ._result import Result |
| 41 | +from ._service_class import ServiceClass |
| 42 | +from ._endpoint._cloud_security_compliance import _cloud_security_compliance_endpoints as Endpoints |
| 43 | + |
| 44 | + |
| 45 | +class CloudSecurityCompliance(ServiceClass): |
| 46 | + """The only requirement to instantiate an instance of this class is one of the following. |
| 47 | +
|
| 48 | + - a valid client_id and client_secret provided as keywords. |
| 49 | + - a credential dictionary with client_id and client_secret containing valid API credentials |
| 50 | + { |
| 51 | + "client_id": "CLIENT_ID_HERE", |
| 52 | + "client_secret": "CLIENT_SECRET_HERE" |
| 53 | + } |
| 54 | + - a previously-authenticated instance of the authentication service class (oauth2.py) |
| 55 | + - a valid token provided by the authentication service class (oauth2.py) |
| 56 | + """ |
| 57 | + |
| 58 | + @force_default(defaults=["parameters"], default_types=["dict"]) |
| 59 | + def framework_posture_summaries(self: object, |
| 60 | + *args, |
| 61 | + parameters: dict = None, |
| 62 | + **kwargs |
| 63 | + ) -> Union[Dict[str, Union[int, dict]], Result]: |
| 64 | + """Get sections and requirements with scores for benchmarks. |
| 65 | +
|
| 66 | + Keyword arguments: |
| 67 | + ids -- The UUIDs of compliance frameworks to retrieve (maximum 20 IDs allowed). String or list of strings. |
| 68 | + parameters -- Full parameters payload dictionary. Not required if using other keywords. |
| 69 | +
|
| 70 | + Arguments: When not specified, the first argument to this method is assumed to be 'ids'. |
| 71 | + All others are ignored. |
| 72 | +
|
| 73 | + Returns: dict object containing API response. |
| 74 | +
|
| 75 | + HTTP Method: GET |
| 76 | +
|
| 77 | + Swagger URL |
| 78 | + https://assets.falcon.crowdstrike.com/support/api/swagger.html# |
| 79 | + /cloud-security-compliance/cloud-compliance-framework-posture-summaries |
| 80 | + """ |
| 81 | + return process_service_request( |
| 82 | + calling_object=self, |
| 83 | + endpoints=Endpoints, |
| 84 | + operation_id="cloud_compliance_framework_posture_summaries", |
| 85 | + keywords=kwargs, |
| 86 | + params=handle_single_argument(args, parameters, "ids") |
| 87 | + ) |
| 88 | + |
| 89 | + @force_default(defaults=["parameters"], default_types=["dict"]) |
| 90 | + def rule_posture_summaries(self: object, |
| 91 | + *args, |
| 92 | + parameters: dict = None, |
| 93 | + **kwargs |
| 94 | + ) -> Union[Dict[str, Union[int, dict]], Result]: |
| 95 | + """Get compliance score and counts for rules. |
| 96 | +
|
| 97 | + Keyword arguments: |
| 98 | + ids -- The uuids of compliance rules to retrieve (maximum 300 IDs allowed). |
| 99 | + parameters -- Full parameters payload dictionary. Not required if using other keywords. |
| 100 | +
|
| 101 | + Arguments: When not specified, the first argument to this method is assumed to be 'ids'. |
| 102 | + All others are ignored. |
| 103 | +
|
| 104 | + Returns: dict object containing API response. |
| 105 | +
|
| 106 | + HTTP Method: GET |
| 107 | +
|
| 108 | + Swagger URL |
| 109 | + https://assets.falcon.crowdstrike.com/support/api/swagger.html# |
| 110 | + /cloud-security-compliance/cloud-compliance-rule-posture-summaries |
| 111 | + """ |
| 112 | + return process_service_request( |
| 113 | + calling_object=self, |
| 114 | + endpoints=Endpoints, |
| 115 | + operation_id="cloud_compliance_rule_posture_summaries", |
| 116 | + keywords=kwargs, |
| 117 | + params=handle_single_argument(args, parameters, "ids") |
| 118 | + ) |
| 119 | + |
| 120 | + cloud_compliance_framework_posture_summaries = framework_posture_summaries |
| 121 | + cloud_compliance_rule_posture_summaries = rule_posture_summaries |
0 commit comments