### ServiceNow API Configuration Example
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/app_docs/README.md
Illustrates the expected configuration for ServiceNow credentials when installing the Falcon Foundry app. This is crucial for enabling the ServiceNow API integration and the 'servicenow' function.
```APIDOC
ServiceNow Credentials:
- instance_url: The URL of your ServiceNow instance.
- username: Your ServiceNow username.
- password: Your ServiceNow password.
Note: Fake values can be used for installation if the ServiceNow integration is not intended to be tested, but this will prevent the 'servicenow' function from working.
```
--------------------------------
### Install and Watch Dependencies (npm)
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/ui/extensions/hello/README.md
Installs project dependencies and starts Rollup in watch mode for continuous development. Output is generated in `/src/dist`.
```bash
npm install
npm run watch
```
--------------------------------
### Install Foundry CLI (Windows)
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/README.md
Installs the Foundry CLI on Windows using Scoop. This involves adding the Foundry CLI bucket and then installing the CLI itself.
```shell
scoop bucket add foundry https://github.com/crowdstrike/scoop-foundry-cli.git
scoop install foundry
```
--------------------------------
### Install Foundry CLI (Linux/macOS)
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/README.md
Installs the Foundry CLI on Linux and macOS using Homebrew. This requires tapping the Foundry CLI repository and then installing the CLI.
```shell
brew tap crowdstrike/foundry-cli
brew install crowdstrike/foundry-cli/foundry
```
--------------------------------
### Release Foundry App
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/README.md
Releases the deployed Foundry application, making it available for installation within the Foundry UI.
```shell
foundry apps release
```
--------------------------------
### Clone and Deploy Foundry App
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/README.md
Clones the sample project locally, logs into Foundry, sets necessary permissions, and deploys the application.
```shell
git clone https://github.com/CrowdStrike/foundry-sample-functions-python
cd foundry-sample-sample-functions-python
foundry login
# Select permissions as described in documentation
foundry apps deploy
```
--------------------------------
### Build Application for Deployment (npm)
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/ui/extensions/hello/README.md
Generates a production build of the UI extension, ensuring all latest files are included in the `/src/dist` directory for deployment.
```bash
npm run build
```
--------------------------------
### Python Functions in Foundry
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/README.md
Demonstrates Python functions within the Foundry framework, including a simple greeting service, host details retrieval using FalconPy, invoking API integrations, and storing data in collections.
```python
# functions/hello/main.py
def main(event, context):
return {
"statusCode": 200,
"body": "Hello from Foundry!"
}
```
```python
# functions/host-details/main.py
from falconpy import HostMeta
def main(event, context):
host_id = event.get("host_id")
if not host_id:
return {"statusCode": 400, "body": "Missing host_id"}
host_api = HostMeta(creds=context.get('falcon_creds'))
response = host_api.get_host_details(ids=host_id)
return {
"statusCode": 200,
"body": response
}
```
```python
# functions/servicenow/main.py
from falconpy import APIIntegration
def main(event, context):
# Assuming event contains data to send to ServiceNow
# and context contains credentials for API Integration
api_integration_name = "your_servicenow_integration_name"
payload = event.get("payload")
if not payload:
return {"statusCode": 400, "body": "Missing payload"}
api_integration = APIIntegration(creds=context.get('falcon_creds'))
response = api_integration.invoke_api_integration(name=api_integration_name, body=payload)
return {
"statusCode": 200,
"body": response
}
```
```python
# functions/log-event/main.py
from falconpy import Collections
def main(event, context):
collection_name = "my_log_collection"
data_to_log = event.get("data")
if not data_to_log:
return {"statusCode": 400, "body": "Missing data to log"}
collections_api = Collections(creds=context.get('falcon_creds'))
response = collections_api.store_collection_data(name=collection_name, body=data_to_log)
return {
"statusCode": 200,
"body": response
}
```
--------------------------------
### Manifest Path and Entrypoint Configuration (YAML)
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/ui/extensions/hello/README.md
Details the required updates to the `path` and `entrypoint` fields in the `manifest.yml` file when using the React template, pointing to the build output directory.
```yaml
- path: ui/extensions/{extensionName}/src/dist
- entrypoint: ui/extensions/{extensionName}/src/dist/index.html
```
--------------------------------
### React Link Component for Routing
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/ui/extensions/hello/README.md
Demonstrates the usage of the custom Link component for navigation within a Foundry application. It supports both internal routing and navigation within the Falcon Console.
```javascript
import { Link } from '../components/link';
// navigates to https://falcon.crowdstrike.com/crowdscore
Crowdscore
// navigates to an /about route within your Extension or Page
Crowdscore
```
--------------------------------
### Manifest Ignored Fields Configuration (YAML)
Source: https://github.com/crowdstrike/foundry-sample-functions-python/blob/main/ui/extensions/hello/README.md
Provides starter regex patterns for the `ignored` field in the `manifest.yml` file to exclude unnecessary files and directories during deployment.
```yaml
ignored:
- ui/(extensions|pages)/[^/]*?/public
- ui/(extensions|pages)/[^/]*?/index.html
- ui/(extensions|pages)/[^/]*?/favicon.ico
- ui/(extensions|pages)/.*?/node_modules
- ui/(extensions|pages)/.*?/config
- ui/(extensions|pages)/.*?/.gitignore
- ui/(extensions|pages)/.*?/package.json
- ui/(extensions|pages)/.*?/tsconfig.json
- ui/(extensions|pages)/.*?/tsconfig..*.json
- ui/(extensions|pages)/.*?/.*?.(md|log|lock|cjs)
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.