### List Git installations Source: https://context7.com/armor-code/acsdk/llms.txt Returns all Git-based installations for a given repo type (e.g., `GITHUB`, `GITLAB`, `BITBUCKET`, `AZURE_REPOS`). ```python import asyncio, os from acsdk import ArmorCodeClient async def main(): client = ArmorCodeClient(os.environ["ARMORCODE_API_KEY"]) installations = await client.get_all_installations_by_tool_name("GITHUB") for inst in installations: print(f"Installation ID: {inst['id']} Name: {inst.get('name', 'N/A')}") await client.close() asyncio.run(main()) ``` -------------------------------- ### Minimal ArmorCode Python SDK Example Source: https://github.com/armor-code/acsdk/blob/main/README.md A basic example demonstrating how to initialize the client and fetch all products. Requires the ArmorCode API key to be set as an environment variable or provided in a file. ```python import asyncio import os from pathlib import Path from acsdk import ArmorCodeClient async def main(api_key): client = ArmorCodeClient(api_key) products = await client.get_all_products() print(products) await client.close() if __name__ == "__main__": api_key_path = os.path.normpath(os.path.join(Path(__file__).parent.absolute(), "ArmorCode_API_key.txt")) api_key = os.getenv("ARMORCODE_API_KEY").strip() #open(api_key_path, "r").read().strip() loop = asyncio.new_event_loop() loop.run_until_complete(main(api_key)) loop.close() ``` -------------------------------- ### Install ArmorCode Python SDK Source: https://context7.com/armor-code/acsdk/llms.txt Install the ArmorCode Python SDK directly from GitHub using pip. ```sh python -m pip install --user git+https://github.com/armor-code/acsdk ``` -------------------------------- ### Get Product Details by Name (REST) Source: https://github.com/armor-code/acsdk/blob/main/acsdk/products/USAGE.md This is the REST equivalent for retrieving product information by name. The example indicates 'N/A' for the direct REST call, suggesting it might be handled via the SDK's abstraction. ```http N/A ``` -------------------------------- ### Example Product JSON Response (List) Source: https://github.com/armor-code/acsdk/blob/main/README.md This is an example JSON response structure for a list of products retrieved from the Armor Code system. It details various attributes of each product. ```json [ { "id": "202687", "createdAtDate": 1721911006000, "updatedAtDate": 1721911006000, "createdBy": "bjenkins@armorcode.io", "updatedBy": "bjenkins@armorcode.io", "isDeleted": false, "isPublished": true, "updateSource": null, "tenant": 295, "businessUnitId": 1283, "name": "PRODUCT_NAME", "type": 1, "types": null, "description": null, "status": "Active", "versionNumber": null, "category": null, "revenueImpact": null, "environment": null, "classType": "Software only", "hostedCloud": null, "complianceRequireds": null, "userRecords": null, "businessOwner": null, "businessOwnerName": null, "businessOwnerEmail": null, "securityOwner": null, "securityOwnerName": null, "securityOwnerEmail": null, "engineeringOwner": null, "engineeringOwnerName": null, "engineeringOwnerEmail": null, "supportOwner": null, "supportOwnerName": null, "supportOwnerEmail": null, "complianceOwner": null, "complianceOwnerName": null, "complianceOwnerEmail": null, "teamId": null, "teamName": null, "complianceRequired": true, "publicCloud": true, "internetFacing": true, "score": null, "risk": null, "tier": null, "confidentialityRequirement": "Not Defined", "confidentiality": "None", "availabilityRequirement": "Low", "availability": "None", "attackingVector": "Network", "confidentialityOptions": "", "impact": null, "likelihood": null, "tags": null, "slaTemplateId": null, "subProductCount": 1, "riskCalculationType": null, "mostRiskySubProduct": null, "artifacts": [], "tagList": [], "sourceProvidedId": null, "riskyFinding": null, "unusedRecommendedTools": null, "riskCachedProperties": null, "deleted": false, "published": true } ] ``` -------------------------------- ### client.get_all_installations_by_tool_name Source: https://context7.com/armor-code/acsdk/llms.txt Returns all Git-based installations for a given repo type. ```APIDOC ## client.get_all_installations_by_tool_name(tool_name) ### Description Returns all Git-based installations for a given repo type (e.g., `"GITHUB"`, `"GITLAB"`, `"BITBUCKET"`, `"AZURE_REPOS"`) using `GET /user/tools/git/gitInstallation/repoType/{toolName}`. ### Method GET ### Endpoint `/user/tools/git/gitInstallation/repoType/{toolName}` ### Parameters #### Path Parameters - **toolName** (string) - Required - The repository type (e.g., "GITHUB", "GITLAB"). ### Request Example ```python await client.get_all_installations_by_tool_name("GITHUB") ``` ### Response #### Success Response (200) - **id** (string) - The ID of the installation. - **name** (string) - The name of the installation. ``` -------------------------------- ### Example Product JSON Response Source: https://github.com/armor-code/acsdk/blob/main/README.md This is an example JSON response structure for a product retrieved from the Armor Code system. It details various attributes of the product. ```json { "id": "202687", "createdAtDate": 1721911006000, "updatedAtDate": 1721911006000, "createdBy": "bjenkins@armorcode.io", "updatedBy": "bjenkins@armorcode.io", "isDeleted": false, "isPublished": true, "updateSource": null, "tenant": 295, "businessUnitId": 1283, "name": "PRODUCT_NAME", "type": 1, "types": null, "description": null, "status": "Active", "versionNumber": null, "category": null, "revenueImpact": null, "environment": null, "classType": "Software only", "hostedCloud": null, "complianceRequireds": null, "userRecords": null, "businessOwner": null, "businessOwnerName": null, "businessOwnerEmail": null, "securityOwner": null, "securityOwnerName": null, "securityOwnerEmail": null, "engineeringOwner": null, "engineeringOwnerName": null, "engineeringOwnerEmail": null, "supportOwner": null, "supportOwnerName": null, "supportOwnerEmail": null, "complianceOwner": null, "complianceOwnerName": null, "complianceOwnerEmail": null, "teamId": null, "teamName": null, "complianceRequired": true, "publicCloud": true, "internetFacing": true, "score": null, "risk": null, "tier": null, "confidentialityRequirement": "Not Defined", "confidentiality": "None", "availabilityRequirement": "Low", "availability": "None", "attackingVector": "Network", "confidentialityOptions": "", "impact": null, "likelihood": null, "tags": null, "slaTemplateId": null, "subProductCount": 1, "riskCalculationType": null, "mostRiskySubProduct": null, "artifacts": [], "tagList": [], "sourceProvidedId": null, "riskyFinding": null, "unusedRecommendedTools": null, "riskCachedProperties": null, "deleted": false, "published": true } ``` -------------------------------- ### Integration Status Response Example Source: https://github.com/armor-code/acsdk/blob/main/acsdk/integrations/USAGE.md This is an example of the JSON response structure when querying for integration statuses. ```json [ { "toolName": "APIKEY", "toolType": "INTEGRATION", "toolId": "APIKEY", "configurationStatus": "ACTIVE", "integrations": 1, "operationalStatus": "ACTIVE", "scanStatus": null, "executionDate": 1717766692000, "version": null, "isAuditEnabled": false, "businessUnitId": null, "tenant": null, "productId": null, "subProductId": null, "isShareable": null, "operationalStatusMessage": null, "activeCount": 1, "inactiveCount": 0, "configErrorCount": 0 } ] ``` -------------------------------- ### Advanced Fetch Example Source: https://github.com/armor-code/acsdk/blob/main/README.md Demonstrates how to use the underlying fetch function for custom API requests, including handling pagination. ```APIDOC ## Advanced Usage: Custom Fetch Request ### Description This example shows how to use the `fetch` utility for making custom API calls, which can be useful for requests not directly supported by the SDK or for fine-grained control over requests, including manual pagination handling. ### Method POST (example uses GET, but `fetch` supports various methods) ### Endpoint /user/product/elastic/paged (example endpoint) ### Parameters #### Query Parameters (example) - **environmentName** (string) - Required - The name of the environment. - **pageSize** (string) - Required - The number of items per page. - **pageNumber** (string) - Optional - The page number to retrieve. - **tags** (string) - Optional - Tags to filter by. - **sortBy** (string) - Required - Field to sort by. - **direction** (string) - Required - Sort direction (ASC or DESC). ### Request Example ```python import asyncio from acsdk import ArmorCodeClient, fetch async def main(api_key): client = ArmorCodeClient(api_key) page_number = None # Example: set to 1 for a specific page products = await fetch(client, "get", "/user/product/elastic/paged", params=list({ "environmentName": "PRODUCTION", "pageSize": "100", "pageNumber": str(page_number) if page_number is not None else None, "tags": "", "sortBy": "NAME", "direction": "ASC" }.items())) print(products) await client.close() ``` ### Response #### Success Response (200) The response structure depends on the specific API endpoint called. The example above would return a paginated list of products. ``` -------------------------------- ### Get All Integrations (Python) Source: https://github.com/armor-code/acsdk/blob/main/acsdk/integrations/USAGE.md Use this method to retrieve a list of all configured integrations. Ensure the client is properly initialized before calling. ```python integrations = await client.get_all_integrations() ``` -------------------------------- ### Get All Users Source: https://github.com/armor-code/acsdk/blob/main/acsdk/users/USAGE.md Retrieves a list of all users within the tenant. This can be done using the SDK's `get_all_users` method or by making a GET request to the `/user/data/users` REST endpoint. ```APIDOC ## GET /user/data/users ### Description Retrieves a list of all users in the tenant. ### Method GET ### Endpoint https://app.armorcode.com/user/data/users ### Response #### Success Response (200) - **userId** (integer) - The unique identifier for the user. - **email** (string) - The email address of the user. - **tenantRole** (string) - The role assigned to the user within the tenant. - **name** (string) - The full name of the user. - **data** (any) - Additional data associated with the user (can be null). - **canBeModified** (boolean) - Indicates if the user's information can be modified. - **disableLogin** (boolean) - Indicates if login is disabled for the user. - **isBasicAuthEnabled** (boolean) - Indicates if basic authentication is enabled for the user. - **lastlogin** (integer) - Timestamp of the last login. - **teamInfo** (any) - Information about the user's team (can be null). - **defaultBu** (any) - The user's default business unit (can be null). ### Response Example { "example": "[\n {\n \"userId\": 3692,\n \"email\": \"bjenkins@armorcode.io\",\n \"tenantRole\": \"ROLE_TENANTADMIN\",\n \"name\": \"Brian Jenkins\",\n \"data\": null,\n \"canBeModified\": true,\n \"disableLogin\": false,\n \"isBasicAuthEnabled\": false,\n \"lastlogin\": 1721910574000,\n \"teamInfo\": null,\n \"defaultBu\": null\n }\n]" } ``` -------------------------------- ### Get All Logins by Tool Name Source: https://github.com/armor-code/acsdk/blob/main/acsdk/logins/USAGE.md Retrieves all login configurations associated with a specific tool name. ```APIDOC ## GET /user/tools/generic/login_details/{{tool_name}} ### Description Retrieves all login configurations for a given tool. ### Method GET ### Endpoint https://app.armorcode.com/user/tools/generic/login_details/{{tool_name}} ### Parameters #### Path Parameters - **tool_name** (string) - Required - The name of the tool to retrieve logins for. ### Response #### Success Response (200) - **configurations** (array) - A list of login configuration objects. - **name** (string) - The name of the configuration. - **shareable** (boolean) - Indicates if the configuration is shareable. - **id** (integer) - The unique identifier for the configuration. - **total_configurations** (integer) - The total number of configurations. - **status** (string) - The status of the configuration (e.g., ENABLED). - **apiEndpoint** (string) - The API endpoint associated with the configuration. - **bot_id** (any) - The bot ID, if applicable. - **expires_in** (any) - Expiration time for tokens, if applicable. - **refresh_expires_in** (any) - Refresh token expiration time, if applicable. - **scope** (any) - The scope of the token, if applicable. - **token_type** (any) - The type of the token, if applicable. ### Response Example ```json { "configurations": [ { "name": "CONFIGURATION_NAME", "shareable": false, "id": 51704, "total_configurations": 1, "status": "ENABLED", "apiEndpoint": "https://api.snyk.io/", "bot_id": null, "expires_in": null, "refresh_expires_in": null, "scope": null, "token_type": null } ] } ``` ``` -------------------------------- ### Get All Products Source: https://github.com/armor-code/acsdk/blob/main/acsdk/products/USAGE.md Retrieves a paginated list of all products. Supports filtering and sorting via query parameters. ```APIDOC ## client.get_all_products() ### Description Retrieves a paginated list of all products available in the ArmorCode platform. This method can be used to fetch product data for various purposes, such as inventory management or analysis. ### Method GET ### Endpoint https://app.armorcode.com/user/product/elastic/paged ### Parameters #### Query Parameters - **environmentName** (string) - Optional - Filters products by environment name. - **pageSize** (integer) - Optional - Specifies the number of items to return per page. Defaults to 20. - **pageNumber** (integer) - Optional - Specifies the page number to retrieve. Defaults to 0. - **tags** (string) - Optional - Filters products by tags. - **sortBy** (string) - Optional - Specifies the field to sort the results by. Defaults to NAME. - **direction** (string) - Optional - Specifies the sorting direction (ASC or DESC). Defaults to ASC. ### Response #### Success Response (200) - **content** (array) - An array of product objects. - **id** (string) - The unique identifier of the product. - **name** (string) - The name of the product. - **createdAtDate** (integer) - Timestamp when the product was created. - **updatedAtDate** (integer) - Timestamp when the product was last updated. - **createdBy** (string) - The user who created the product. - **updatedBy** (string) - The user who last updated the product. - **isDeleted** (boolean) - Indicates if the product is deleted. - **isPublished** (boolean) - Indicates if the product is published. - **tenant** (integer) - The tenant ID associated with the product. - **businessUnitId** (integer) - The business unit ID associated with the product. - **type** (integer) - The type of the product. - **description** (string) - A description of the product. - **status** (string) - The current status of the product. - **versionNumber** (string) - The version number of the product. - **category** (string) - The category of the product. - **revenueImpact** (string) - The revenue impact of the product. - **environment** (string) - The environment the product is deployed in. - **classType** (string) - The class type of the product. - **hostedCloud** (string) - The hosted cloud provider. - **complianceRequireds** (array) - List of compliance requirements. - **userRecords** (string) - User records associated with the product. - **businessOwner** (string) - The business owner of the product. - **businessOwnerName** (string) - The name of the business owner. - **businessOwnerEmail** (string) - The email of the business owner. - **securityOwner** (string) - The security owner of the product. - **securityOwnerName** (string) - The name of the security owner. - **securityOwnerEmail** (string) - The email of the security owner. - **engineeringOwner** (string) - The engineering owner of the product. - **engineeringOwnerName** (string) - The name of the engineering owner. - **engineeringOwnerEmail** (string) - The email of the engineering owner. - **supportOwner** (string) - The support owner of the product. - **supportOwnerName** (string) - The name of the support owner. - **supportOwnerEmail** (string) - The email of the support owner. - **complianceOwner** (string) - The compliance owner of the product. - **complianceOwnerName** (string) - The name of the compliance owner. - **complianceOwnerEmail** (string) - The email of the compliance owner. - **teamId** (string) - The team ID associated with the product. - **teamName** (string) - The name of the team. - **complianceRequired** (boolean) - Indicates if compliance is required for the product. - **publicCloud** (boolean) - Indicates if the product is on a public cloud. - **internetFacing** (boolean) - Indicates if the product is internet-facing. - **score** (string) - The score of the product. - **risk** (string) - The risk level of the product. - **tier** (string) - The tier of the product. - **confidentialityRequirement** (string) - The confidentiality requirement. - **confidentiality** (string) - The confidentiality level. - **availabilityRequirement** (string) - The availability requirement. - **availability** (string) - The availability level. - **attackingVector** (string) - The attacking vector. - **confidentialityOptions** (string) - Confidentiality options. - **impact** (string) - The impact of the product. - **likelihood** (string) - The likelihood of the product. - **tags** (array) - List of tags associated with the product. - **slaTemplateId** (string) - The SLA template ID. - **subProductCount** (integer) - The number of sub-products. - **riskCalculationType** (string) - The risk calculation type. - **mostRiskySubProduct** (string) - The most risky sub-product. - **artifacts** (array) - List of artifacts. - **tagList** (array) - List of tags. - **sourceProvidedId** (string) - The source provided ID. - **riskyFinding** (string) - Risky finding information. - **unusedRecommendedTools** (string) - Information about unused recommended tools. - **riskCachedProperties** (string) - Cached risk properties. - **deleted** (boolean) - Indicates if the product is deleted. - **published** (boolean) - Indicates if the product is published. - **pageable** (object) - Pagination information. - **pageNumber** (integer) - The current page number. - **pageSize** (integer) - The number of items per page. - **sort** (object) - Sorting information. - **offset** (integer) - The offset for the current page. - **paged** (boolean) - Indicates if pagination is enabled. - **unpaged** (boolean) - Indicates if pagination is disabled. - **last** (boolean) - Indicates if this is the last page. - **totalElements** (integer) - The total number of elements. - **totalPages** (integer) - The total number of pages. - **first** (boolean) - Indicates if this is the first page. - **size** (integer) - The size of the current page. - **number** (integer) - The page number. - **sort** (object) - Sorting information. - **numberOfElements** (integer) - The number of elements on the current page. - **empty** (boolean) - Indicates if the page is empty. ### Request Example ```python products = await client.get_all_products() ``` ### Response Example ```json { "content": [ { "id": "202687", "createdAtDate": 1721911006000, "updatedAtDate": 1721911006000, "createdBy": "bjenkins@armorcode.io", "updatedBy": "bjenkins@armorcode.io", "isDeleted": false, "isPublished": true, "updateSource": null, "tenant": 295, "businessUnitId": 1283, "name": "PRODUCT_NAME", "type": 1, "types": null, "description": null, "status": "Active", "versionNumber": null, "category": null, "revenueImpact": null, "environment": null, "classType": "Software only", "hostedCloud": null, "complianceRequireds": null, "userRecords": null, "businessOwner": null, "businessOwnerName": null, "businessOwnerEmail": null, "securityOwner": null, "securityOwnerName": null, "securityOwnerEmail": null, "engineeringOwner": null, "engineeringOwnerName": null, "engineeringOwnerEmail": null, "supportOwner": null, "supportOwnerName": null, "supportOwnerEmail": null, "complianceOwner": null, "complianceOwnerName": null, "complianceOwnerEmail": null, "teamId": null, "teamName": null, "complianceRequired": true, "publicCloud": true, "internetFacing": true, "score": null, "risk": null, "tier": null, "confidentialityRequirement": "Not Defined", "confidentiality": "None", "availabilityRequirement": "Low", "availability": "None", "attackingVector": "Network", "confidentialityOptions": "", "impact": null, "likelihood": null, "tags": null, "slaTemplateId": null, "subProductCount": 1, "riskCalculationType": null, "mostRiskySubProduct": null, "artifacts": [], "tagList": [], "sourceProvidedId": null, "riskyFinding": null, "unusedRecommendedTools": null, "riskCachedProperties": null, "deleted": false, "published": true } ], "pageable": { "pageNumber": 0, "pageSize": 100, "sort": { "empty": false, "sorted": true, "unsorted": false }, "offset": 0, "paged": true, "unpaged": false }, "last": true, "totalElements": 1, "totalPages": 1, "first": true, "size": 100, "number": 0, "sort": { "empty": false, "sorted": true, "unsorted": false }, "numberOfElements": 1, "empty": false } ``` ``` -------------------------------- ### Example JSON Response for Projects Source: https://github.com/armor-code/acsdk/blob/main/acsdk/logins/USAGE.md This JSON structure represents the response when retrieving project data, including project name, ID, and other properties. ```json { "projects": [ { "name": "TheRedHatter/hello-world", "id": "TheRedHatter/hello-world", "mappedStatus": null, "versions": null, "projectStatus": null, "otherProperties": { "orgId": "75ab4acb-f7b0-4531-9066-4105ac959a82", "orgName": "ORGANIZATION_NAME", "origin": "github", "projectStatus": "ACTIVE", "references": [ "master" ], "actualProjectId": "ca50e06b-d026-435a-8a9e-f7c123a5199a", "targetId": "6b88e0d1-9cdc-4c50-93f2-f3fb2d0e29cd", "displayName": "TheRedHatter/hello-world", "tags": "{\"snyk.projecttarget\":[\"theredhatter/hello-world\"],\"snyk.origin\":[\"github\"],\"snyk.projectowner\":[\"theredhatter\"],\"snyk.projecttype\":[\"sast\"],\"snyk.orgname\":[\"organization name\"],\"snyk.projectrepourl\":[\"https://github.com/theredhatter/hello-world\"],\"snyk.targetreference\":[\"master\"]}" }, "tags": null } ], "page": 1, "total": 1, "next": false, "isListFromCachedProjects": null, "message": null, "pageAfter": null } ``` -------------------------------- ### Get All Products (Python) Source: https://github.com/armor-code/acsdk/blob/main/README.md Retrieves a list of all available products within the ArmorCode platform. Supports filtering and sorting. ```python products = await client.get_all_products() ``` -------------------------------- ### client.get_all_users() Source: https://context7.com/armor-code/acsdk/llms.txt Fetches all user records from GET /user/data/users, including email, tenant role, login timestamps, and team assignments. ```APIDOC ## get_all_users() ### Description Fetches all user records from `GET /user/data/users`, including email, tenant role, login timestamps, and team assignments. ### Method GET ### Endpoint `/user/data/users` ### Response #### Success Response (200) - **users** (list) - A list of user objects, each containing details like 'name', 'email', 'tenantRole', etc. ``` -------------------------------- ### Get All Projects by Login ID Source: https://github.com/armor-code/acsdk/blob/main/acsdk/logins/USAGE.md Retrieves all projects associated with a specific login ID and tool name. ```APIDOC ## GET /user/tools/generic/configurations/{{toolName}}/project ### Description Retrieves a list of projects associated with a specific tool and login ID. This endpoint allows fetching project details for a given tool configuration. ### Method GET ### Endpoint https://app.armorcode.com/user/tools/generic/configurations/{{toolName}}/project ### Parameters #### Query Parameters - **login_id** (integer) - Required - The ID of the login configuration to filter projects by. - **page** (integer) - Optional - The page number for pagination. Defaults to 0. #### Path Parameters - **toolName** (string) - Required - The name of the tool. ### Response #### Success Response (200) (Response structure not explicitly defined in the source, but expected to contain project details.) ``` -------------------------------- ### List all products Source: https://context7.com/armor-code/acsdk/llms.txt Fetches all products across all pages from `GET /user/product/elastic/paged`, sorted alphabetically by name. Pages are fetched concurrently. ```python import asyncio, os from acsdk import ArmorCodeClient async def main(): client = ArmorCodeClient(os.environ["ARMORCODE_API_KEY"]) products = await client.get_all_products() print(f"Total products: {len(products)}") for p in products[:5]: print(f" [{p['id']}] {p['name']} status={p['status']} subProducts={p['subProductCount']}") await client.close() asyncio.run(main()) ``` -------------------------------- ### Get Subproduct by Name (Python) Source: https://github.com/armor-code/acsdk/blob/main/acsdk/subproducts/USAGE.md Use this method to retrieve subproduct details by providing the subproduct name. Requires an asynchronous client instance. ```python subproducts = await client.get_subproducts_by_name(subproduct_name) ``` -------------------------------- ### Get Logins by Tool Name (Python SDK) Source: https://github.com/armor-code/acsdk/blob/main/README.md Retrieves login details for a specific tool. Requires the tool name as a parameter. ```python logins = await client.get_all_logins_by_tool_name(tool_name) ``` -------------------------------- ### Get All Products (REST) Source: https://github.com/armor-code/acsdk/blob/main/README.md REST API endpoint to retrieve product information. Allows specifying environment, page size, and sorting preferences. ```http GET https://app.armorcode.com/user/product/elastic/paged ?environmentName=PRODUCTION &pageSize=20 &pageNumber=0 &tags= &sortBy=NAME &direction=ASC ``` -------------------------------- ### Get All Alerts (Python/REST) Source: https://github.com/armor-code/acsdk/blob/main/acsdk/alerts/USAGE.md Use this to retrieve a list of all alerts. You can filter by severity, page, size, and sort order. The Python example uses the SDK, while the REST example shows the equivalent HTTP request. ```python alerts = await client.get_all_alerts() ``` ```http GET https://app.armorcode.com/api/alerts ?severity=CRITICAL,HIGH &page=0 &size=10 &sort=createdAt,desc ``` -------------------------------- ### Get User by ID with Python SDK Source: https://github.com/armor-code/acsdk/blob/main/acsdk/users/USAGE.md Retrieve a specific user's details using their unique ID with the Python SDK. The REST API equivalent is not directly provided for this specific operation in the example. ```python user = await client.get_user_by_id(user_id) ``` -------------------------------- ### List all tool mappings by login ID Source: https://context7.com/armor-code/acsdk/llms.txt Fetches all project-to-sub-product mappings for a given login. Paginates automatically. `tool_type` can be `PULL`, `PUSH`, or `WEBHOOK`. ```python import asyncio, os from acsdk import ArmorCodeClient async def main(): client = ArmorCodeClient(os.environ["ARMORCODE_API_KEY"]) mappings = await client.get_all_mappings_by_login_id("Snyk", login_id=51704) for m in mappings: print(f"Project: {m['projectName']} Product: {m['product_name']} SubProduct: {m['sub_product_name']}") # Project: juice-shop Product: My App SubProduct: frontend await client.close() asyncio.run(main()) ``` -------------------------------- ### client.get_all_mappings_by_login_id Source: https://context7.com/armor-code/acsdk/llms.txt Fetches all project-to-sub-product mappings for a given login. Paginates automatically. `tool_type` can be `"PULL"`, `"PUSH"`, or `"WEBHOOK"`. ```APIDOC ## client.get_all_mappings_by_login_id(tool_name, login_id, tool_type="PULL") ### Description Fetches all project-to-sub-product mappings for a given login via `POST /user/tools/generic/configurations/{toolName}`. Paginates automatically. `tool_type` can be `"PULL"`, `"PUSH"`, or `"WEBHOOK"`. ### Method POST ### Endpoint `/user/tools/generic/configurations/{toolName}` ### Parameters #### Path Parameters - **toolName** (string) - Required - The name of the tool. #### Query Parameters - **login_id** (integer) - Required - The ID of the login credential. - **tool_type** (string) - Optional - Defaults to "PULL". Can be "PULL", "PUSH", or "WEBHOOK". ### Request Example ```python await client.get_all_mappings_by_login_id("Snyk", login_id=51704) ``` ### Response #### Success Response (200) - **projectName** (string) - The name of the project. - **product_name** (string) - The name of the product. - **sub_product_name** (string) - The name of the sub-product. ``` -------------------------------- ### Get All Teams Source: https://github.com/armor-code/acsdk/blob/main/acsdk/teams/USAGE.md Retrieves a list of all teams available in the ArmorCode platform. This can be used to get an overview of all existing teams. ```APIDOC ## GET /api/team/filters ### Description Retrieves a list of all teams. ### Method GET ### Endpoint https://app.armorcode.com/api/team/filters ### Response #### Success Response (200) - **name** (array) - A list of team objects, each containing an 'id' and 'name'. #### Response Example ```json { "name": [ { "id": 16635, "name": "All Armorcode Users" } ] } ``` ``` -------------------------------- ### List logins for a tool Source: https://context7.com/armor-code/acsdk/llms.txt Fetches all login configurations for a given tool name. Supports 100+ tools and custom tools. ```python import asyncio, os from acsdk import ArmorCodeClient async def main(): client = ArmorCodeClient(os.environ["ARMORCODE_API_KEY"]) snyk_logins = await client.get_all_logins_by_tool_name("Snyk") for login in snyk_logins: print(f"Login ID: {login['id']} Name: {login['name']} Status: {login['status']}") # Login ID: 51704 Name: My Snyk Config Status: ENABLED await client.close() asyncio.run(main()) ``` -------------------------------- ### Get Logins by Tool Name (REST API) Source: https://github.com/armor-code/acsdk/blob/main/README.md Fetches login details for a given tool name via a GET request. The tool name is a path parameter. ```http GET https://app.armorcode.com/user/tools/generic/login_details/{{tool_name}} ``` -------------------------------- ### Get All Security Tools (REST API) Source: https://github.com/armor-code/acsdk/blob/main/acsdk/security_tools/USAGE.md This endpoint retrieves the status of all application security tools configured in your ArmorCode account. Make a GET request to the specified URL. ```http GET https://app.armorcode.com/user/tools/appsec-tools/status ``` -------------------------------- ### Get Product Details by Name (Python) Source: https://github.com/armor-code/acsdk/blob/main/acsdk/products/USAGE.md Use this function to retrieve product information by specifying the product name. Ensure the client is properly initialized before calling. ```python products = await client.get_products_by_name(product_name) ``` -------------------------------- ### client.create_product(product_name, product_payload={}) Source: https://context7.com/armor-code/acsdk/llms.txt Creates a new product. Default values are used for certain fields, but can be overridden using the product_payload. ```APIDOC ## POST /user/product ### Description Creates a new product. Default values are set for `classType`, `publicCloud`, `internetFacing`, and other required fields; these can be overridden with `product_payload`. ### Method POST ### Endpoint /user/product ### Parameters #### Request Body - **product_name** (string) - Required - The name of the product to create. - **product_payload** (object) - Optional - A dictionary containing additional fields to configure the new product. Example fields include `description`, `internetFacing`, `confidentialityRequirement`. ``` -------------------------------- ### Get All Teams (Python & REST) Source: https://github.com/armor-code/acsdk/blob/main/acsdk/teams/USAGE.md Use this method to retrieve a list of all teams accessible by the client. The Python SDK provides an asynchronous function, while the REST API uses a GET request. ```python teams = await client.get_all_teams() ``` ```http GET https://app.armorcode.com/api/team/filters ``` -------------------------------- ### Get Team by ID (Python & REST) Source: https://github.com/armor-code/acsdk/blob/main/acsdk/teams/USAGE.md Retrieve details for a specific team using its ID. This can be done via the Python SDK's asynchronous function or a REST API GET request. ```python team = await client.get_team_by_id(team_id) ``` ```http GET https://app.armorcode.com/api/team/{{teamId}} ``` -------------------------------- ### client.create_configuration Source: https://context7.com/armor-code/acsdk/llms.txt Creates a new Git-based integration configuration. Returns the new configuration ID. ```APIDOC ## POST /user/tools/git/gitInstallation ### Description Creates a new Git-based integration configuration. Returns the new configuration ID. ### Method POST ### Endpoint /user/tools/git/gitInstallation ### Parameters #### Request Body - **configuration** (object) - Required - The configuration details for the Git integration. - **repoType** (string) - Required - The type of repository (e.g., GITHUB). - **name** (string) - Required - The name of the integration configuration. - **token** (string) - Required - The API token for the Git repository. ### Request Example ```json { "repoType": "GITHUB", "name": "My GitHub Integration", "token": "YOUR_GITHUB_TOKEN" } ``` ### Response #### Success Response (200) - **config_id** (integer) - The ID of the newly created configuration. ``` -------------------------------- ### Get All Findings by Saved Search ID (Python & REST) Source: https://github.com/armor-code/acsdk/blob/main/acsdk/findings/USAGE.md Use this to retrieve all findings linked to a specific saved search. The Python SDK provides a direct method, while the REST API requires a GET request to the findings endpoint. ```python findings = await client.get_all_findings_by_saved_search_id(saved_search_id) ``` ```http GET https://app.armorcode.com/user/findings/saved-search/{{saved_search_id}} ?page=0 &size=100 ``` -------------------------------- ### client.get_products_by_name(product_name) Source: https://context7.com/armor-code/acsdk/llms.txt Searches for products by name using a case-insensitive exact match. Returns a list of matching products. ```APIDOC ## GET /user/product ### Description Search products by name. This performs a case-insensitive exact-match search across all products. ### Method GET ### Endpoint /user/product ### Query Parameters - **name** (string) - Required - The name of the product to search for. ``` -------------------------------- ### Mark Alerts as Read (Python/REST) Source: https://github.com/armor-code/acsdk/blob/main/acsdk/alerts/USAGE.md This snippet demonstrates how to update the status of alerts to 'READ'. Provide a list of alert IDs to mark. The Python example uses the SDK, and the REST example shows the corresponding JSON payload for a PUT request. ```python await client.mark_alerts_as_read(alert_ids) ``` ```http PUT https://app.armorcode.com/api/alerts/update Content-Type: application/json { "state": "READ", "id": ["1116"] } ``` -------------------------------- ### List available projects for a login Source: https://context7.com/armor-code/acsdk/llms.txt Returns all projects available in the external tool for the given login credential. Useful for identifying projects to map. ```python import asyncio, os from acsdk import ArmorCodeClient async def main(): client = ArmorCodeClient(os.environ["ARMORCODE_API_KEY"]) projects = await client.get_all_projects_by_login_id("Snyk", login_id=51704) print(f"Available projects: {len(projects)}") for p in projects[:3]: print(f" {p['id']} — {p['name']}") await client.close() asyncio.run(main()) ``` -------------------------------- ### ArmorCodeClient Initialization Source: https://context7.com/armor-code/acsdk/llms.txt Initializes the ArmorCodeClient with an API key and optionally overrides default settings like the base URL. ```APIDOC ## ArmorCodeClient — Client Initialization `ArmorCodeClient(api_key, overrides={})` creates the session. It validates the UUID format of the key, sets a connection pool limit of 2 concurrent TCP connections, and attaches the `Authorization: Bearer` header to every request. Pass `overrides={"base_url": "..."}` to target a different ArmorCode environment. ```python import asyncio import os from acsdk import ArmorCodeClient async def main(): api_key = os.environ["ARMORCODE_API_KEY"] # e.g. "a1b2c3d4-e5f6-7890-abcd-ef1234567890" client = ArmorCodeClient(api_key) # Optional: point at a non-production instance # client = ArmorCodeClient(api_key, overrides={"base_url": "https://staging.armorcode.com"}) products = await client.get_all_products() print(f"Found {len(products)} products") await client.close() asyncio.run(main()) ``` ``` -------------------------------- ### Get All Users Source: https://github.com/armor-code/acsdk/blob/main/README.md Retrieves a list of all users in the ArmorCode system. ```APIDOC ## GET /user/data/users ### Description Retrieves a list of all users. ### Method GET ### Endpoint https://app.armorcode.com/user/data/users ### Response #### Success Response (200) - **userId** (integer) - The unique identifier for the user. - **email** (string) - The email address of the user. - **tenantRole** (string) - The role of the user within the tenant. - **name** (string) - The name of the user. - **data** (any) - Additional data associated with the user (can be null). - **canBeModified** (boolean) - Indicates if the user can be modified. - **disableLogin** (boolean) - Indicates if login is disabled for the user. - **isBasicAuthEnabled** (boolean) - Indicates if basic authentication is enabled. - **lastlogin** (integer) - Timestamp of the last login. - **teamInfo** (any) - Information about the teams the user belongs to (can be null). - **defaultBu** (any) - The default business unit for the user (can be null). ``` -------------------------------- ### Initialize ArmorCodeClient Source: https://context7.com/armor-code/acsdk/llms.txt Initialize the ArmorCodeClient with an API key. The client handles authentication, rate limiting, and pagination. Optionally, override the base URL to target different ArmorCode environments. ```python import asyncio import os from acsdk import ArmorCodeClient async def main(): api_key = os.environ["ARMORCODE_API_KEY"] # e.g. "a1b2c3d4-e5f6-7890-abcd-ef1234567890" client = ArmorCodeClient(api_key) # Optional: point at a non-production instance # client = ArmorCodeClient(api_key, overrides={"base_url": "https://staging.armorcode.com"}) products = await client.get_all_products() print(f"Found {len(products)} products") await client.close() asyncio.run(main()) ``` -------------------------------- ### Finding Data Structure Example Source: https://github.com/armor-code/acsdk/blob/main/acsdk/findings/USAGE.md Illustrates the typical JSON structure returned for a security finding, including fields like suppression times, asset scores, and associated CWEs. ```json { "lastSuppressDateTime": null, "lastControlledDateTime": null, "lastInProgressDateTime": null, "lastTriageDateTime": null, "indirectExportFields": null, "assetScore": null, "comments": null, "history": null, "exploitMetaInfo": null, "attachments": null, "tagsUsedForAssetScore": [], "versionFindingsCount": null, "correlatedFindingsCount": null, "vmHostIpAddresses": null, "riskRegisters": null, "ctiScore": null, "cwesStrings": [ "CWE-20" ], "assessment": [] } ``` -------------------------------- ### client.get_all_teams() Source: https://context7.com/armor-code/acsdk/llms.txt Fetches all team name/ID pairs from GET /api/team/filters. ```APIDOC ## get_all_teams() ### Description Fetches all team name/ID pairs from `GET /api/team/filters`. ### Method GET ### Endpoint `/api/team/filters` ### Response #### Success Response (200) - **name** (list) - A list of team objects, each containing 'id' and 'name'. ``` -------------------------------- ### Create a new product Source: https://context7.com/armor-code/acsdk/llms.txt Creates a new product with a given name and an optional payload for additional fields. Returns the new product ID. ```python import asyncio, os from acsdk import ArmorCodeClient async def main(): client = ArmorCodeClient(os.environ["ARMORCODE_API_KEY"]) product_id = await client.create_product( "My New Service", product_payload={ "description": "Core API service", "internetFacing": False, "confidentialityRequirement": "High", } ) print(f"Created product ID: {product_id}") await client.close() asyncio.run(main()) ```