Merge pull request #689 from sailpoint-oss/devrel-1886

fixed some issues in lambda functions
This commit is contained in:
Philip Ellis
2024-12-04 12:09:36 -05:00
committed by GitHub
8 changed files with 69 additions and 31 deletions

View File

@@ -1,10 +1,8 @@
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
exports.authHandler = async (event) => {
const token = event.headers.authorization;
const {siteConfig} = useDocusaurusContext();
const expectedUsername = siteConfig.customFields.AUTH_USERNAME;
const expectedPassword = siteConfig.customFields.AUTH_PASSWORD;
const expectedUsername = process.env.AUTH_USERNAME;
const expectedPassword = process.env.AUTH_PASSWORD;
try {
const {username, password} = decodeAuthToken(token);

View File

@@ -3,12 +3,10 @@
// Create a DocumentClient that represents the query to add an item
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { DynamoDBDocumentClient, GetCommand } from '@aws-sdk/lib-dynamodb';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
const {siteConfig} = useDocusaurusContext();
//DynamoDB Endpoint
const ENDPOINT_OVERRIDE = siteConfig.customFields.ENDPOINT_OVERRIDE;
const ENDPOINT_OVERRIDE = process.env.ENDPOINT_OVERRIDE;;
let ddbClient = undefined;
if(ENDPOINT_OVERRIDE){
@@ -23,7 +21,7 @@ else{
const ddbDocClient = DynamoDBDocumentClient.from(ddbClient);
// Get the DynamoDB table name from environment variables
const tableName = siteConfig.customFields.SAMPLE_TABLE;
const tableName = process.env.SAMPLE_TABLE;
/**
* A simple example includes a HTTP get method to get one item by id from a DynamoDB table.

View File

@@ -11,7 +11,7 @@ slug: api/beta/postman-collections
tags: ['postman']
---
import GitHubPublicFileComponent from '@site/src/components/GitHubLink';
import CMSLinkComponent from '@site/src/components/PostmanLink';
[Postman](https://www.postman.com/) is a platform you can use to design, build, test, and iterate your APIs. Postman users and teams can create public workspaces they can use to make it easy to access their API collections and environments and get started. SailPoint maintains a [public workspace for the Identity Security Cloud API collections](https://www.postman.com/sailpoint/workspace/identitynow). You can use this workspace to access all the ISC API collections and stay up to date.
@@ -21,10 +21,10 @@ Each ISC API version is broken out into a separate collection within the workspa
| API | Postman Collection |
| --- | --- |
| V2024 API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-ed8adb96-7931-4c78-970d-d87da8aa05bd?action=collection%2Ffork&collection-url=entityId%3D23226990-ed8adb96-7931-4c78-970d-d87da8aa05bd%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| V3 API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-3721beea-5615-44b4-9459-e858a0ca7aed?action=collection%2Ffork&collection-url=entityId%3D23226990-3721beea-5615-44b4-9459-e858a0ca7aed%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| Beta API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-3b87172a-cd55-40a2-9ace-1560a1158a4e?action=collection%2Ffork&collection-url=entityId%3D23226990-3b87172a-cd55-40a2-9ace-1560a1158a4e%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| NERM API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-20d718e3-b9b3-43ad-850c-637b00864ae2?action=collection%2Ffork&collection-url=entityId%3D23226990-20d718e3-b9b3-43ad-850c-637b00864ae2%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| V2024 API | <CMSLinkComponent source="v2024CollectionUrl"></CMSLinkComponent> |
| V3 API | <CMSLinkComponent source="v3CollectionUrl"></CMSLinkComponent> |
| Beta API | <CMSLinkComponent source="betaCollectionUrl"></CMSLinkComponent> |
| NERM API | <CMSLinkComponent source="nermCollectionUrl"></CMSLinkComponent> |
| SaaS Connectivity | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-a0b5c429-d8dd-4fe2-a4a2-eb7ff85322ef?action=collection%2Ffork&collection-url=entityId%3D23226990-a0b5c429-d8dd-4fe2-a4a2-eb7ff85322ef%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
You can also fork a collection by selecting the ellipses to the right of the collection and selecting 'Create a fork.'

View File

@@ -10,7 +10,7 @@ description: Run ISC APIs in Postman.
tags: ['postman']
---
import GitHubPublicFileComponent from '@site/src/components/GitHubLink';
import CMSLinkComponent from '@site/src/components/PostmanLink';
[Postman](https://www.postman.com/) is a platform you can use to design, build, test, and iterate your APIs. Postman users and teams can create public workspaces they can use to make it easy to access their API collections and environments and get started. SailPoint maintains a [public workspace for the Identity Security Cloud API collections](https://www.postman.com/sailpoint/workspace/identitynow). You can use this workspace to access all the ISC API collections and stay up to date.
@@ -20,10 +20,10 @@ Each ISC API version is broken out into a separate collection within the workspa
| API | Postman Collection |
| --- | --- |
| V2024 API | [![Run in Postman](./img/button.svg)](https://god.gw.postman.com/run-collection/23226990-ed8adb96-7931-4c78-970d-d87da8aa05bd?action=collection%2Ffork&collection-url=entityId%3D23226990-ed8adb96-7931-4c78-970d-d87da8aa05bd%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| V3 API | [![Run in Postman](./img/button.svg)](https://god.gw.postman.com/run-collection/23226990-3721beea-5615-44b4-9459-e858a0ca7aed?action=collection%2Ffork&collection-url=entityId%3D23226990-3721beea-5615-44b4-9459-e858a0ca7aed%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| Beta API | [![Run in Postman](./img/button.svg)](https://god.gw.postman.com/run-collection/23226990-3b87172a-cd55-40a2-9ace-1560a1158a4e?action=collection%2Ffork&collection-url=entityId%3D23226990-3b87172a-cd55-40a2-9ace-1560a1158a4e%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| NERM API | [![Run in Postman](./img/button.svg)](https://god.gw.postman.com/run-collection/23226990-20d718e3-b9b3-43ad-850c-637b00864ae2?action=collection%2Ffork&collection-url=entityId%3D23226990-20d718e3-b9b3-43ad-850c-637b00864ae2%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| V2024 API | <CMSLinkComponent source="v2024CollectionUrl"></CMSLinkComponent> |
| V3 API | <CMSLinkComponent source="v3CollectionUrl"></CMSLinkComponent> |
| Beta API | <CMSLinkComponent source="betaCollectionUrl"></CMSLinkComponent> |
| NERM API | <CMSLinkComponent source="nermCollectionUrl"></CMSLinkComponent> |
| SaaS Connectivity | [![Run in Postman](./img/button.svg)](https://god.gw.postman.com/run-collection/23226990-a0b5c429-d8dd-4fe2-a4a2-eb7ff85322ef?action=collection%2Ffork&collection-url=entityId%3D23226990-a0b5c429-d8dd-4fe2-a4a2-eb7ff85322ef%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
You can also fork a collection by selecting the ellipses to the right of the collection and selecting 'Create a fork.'

View File

@@ -10,8 +10,7 @@ description: Run ISC APIs in Postman.
slug: api/v2024/postman-collections
tags: ['postman']
---
import GitHubPublicFileComponent from '@site/src/components/GitHubLink';
import CMSLinkComponent from '@site/src/components/PostmanLink';
[Postman](https://www.postman.com/) is a platform you can use to design, build, test, and iterate your APIs. Postman users and teams can create public workspaces they can use to make it easy to access their API collections and environments and get started. SailPoint maintains a [public workspace for the Identity Security Cloud API collections](https://www.postman.com/sailpoint/workspace/identitynow). You can use this workspace to access all the ISC API collections and stay up to date.
@@ -19,12 +18,13 @@ import GitHubPublicFileComponent from '@site/src/components/GitHubLink';
Each ISC API version is broken out into a separate collection within the workspace. The following table lists the available ISC API collections. To import a collection into your workspace, select the 'Run in Postman' button for your desired version. Doing so forks the collection into your workspace.
| API | Postman Collection |
| --- | --- |
| V2024 API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-ed8adb96-7931-4c78-970d-d87da8aa05bd?action=collection%2Ffork&collection-url=entityId%3D23226990-ed8adb96-7931-4c78-970d-d87da8aa05bd%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| V3 API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-3721beea-5615-44b4-9459-e858a0ca7aed?action=collection%2Ffork&collection-url=entityId%3D23226990-3721beea-5615-44b4-9459-e858a0ca7aed%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| Beta API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-3b87172a-cd55-40a2-9ace-1560a1158a4e?action=collection%2Ffork&collection-url=entityId%3D23226990-3b87172a-cd55-40a2-9ace-1560a1158a4e%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| NERM API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-20d718e3-b9b3-43ad-850c-637b00864ae2?action=collection%2Ffork&collection-url=entityId%3D23226990-20d718e3-b9b3-43ad-850c-637b00864ae2%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| V2024 API | <CMSLinkComponent source="v2024CollectionUrl"></CMSLinkComponent> |
| V3 API | <CMSLinkComponent source="v3CollectionUrl"></CMSLinkComponent> |
| Beta API | <CMSLinkComponent source="betaCollectionUrl"></CMSLinkComponent> |
| NERM API | <CMSLinkComponent source="nermCollectionUrl"></CMSLinkComponent> |
| SaaS Connectivity | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-a0b5c429-d8dd-4fe2-a4a2-eb7ff85322ef?action=collection%2Ffork&collection-url=entityId%3D23226990-a0b5c429-d8dd-4fe2-a4a2-eb7ff85322ef%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
You can also fork a collection by selecting the ellipses to the right of the collection and selecting 'Create a fork.'

View File

@@ -11,7 +11,7 @@ slug: api/v3/postman-collections
tags: ['postman']
---
import GitHubPublicFileComponent from '@site/src/components/GitHubLink';
import CMSLinkComponent from '@site/src/components/PostmanLink';
[Postman](https://www.postman.com/) is a platform you can use to design, build, test, and iterate your APIs. Postman users and teams can create public workspaces they can use to make it easy to access their API collections and environments and get started. SailPoint maintains a [public workspace for the Identity Security Cloud API collections](https://www.postman.com/sailpoint/workspace/identitynow). You can use this workspace to access all the ISC API collections and stay up to date.
@@ -21,10 +21,10 @@ Each ISC API version is broken out into a separate collection within the workspa
| API | Postman Collection |
| --- | --- |
| V2024 API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-ed8adb96-7931-4c78-970d-d87da8aa05bd?action=collection%2Ffork&collection-url=entityId%3D23226990-ed8adb96-7931-4c78-970d-d87da8aa05bd%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| V3 API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-3721beea-5615-44b4-9459-e858a0ca7aed?action=collection%2Ffork&collection-url=entityId%3D23226990-3721beea-5615-44b4-9459-e858a0ca7aed%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| Beta API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-3b87172a-cd55-40a2-9ace-1560a1158a4e?action=collection%2Ffork&collection-url=entityId%3D23226990-3b87172a-cd55-40a2-9ace-1560a1158a4e%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| NERM API | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-20d718e3-b9b3-43ad-850c-637b00864ae2?action=collection%2Ffork&collection-url=entityId%3D23226990-20d718e3-b9b3-43ad-850c-637b00864ae2%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
| V2024 API | <CMSLinkComponent source="v2024CollectionUrl"></CMSLinkComponent> |
| V3 API | <CMSLinkComponent source="v3CollectionUrl"></CMSLinkComponent> |
| Beta API | <CMSLinkComponent source="betaCollectionUrl"></CMSLinkComponent> |
| NERM API | <CMSLinkComponent source="nermCollectionUrl"></CMSLinkComponent> |
| SaaS Connectivity | [![Run in Postman](../img/button.svg)](https://god.gw.postman.com/run-collection/23226990-a0b5c429-d8dd-4fe2-a4a2-eb7ff85322ef?action=collection%2Ffork&collection-url=entityId%3D23226990-a0b5c429-d8dd-4fe2-a4a2-eb7ff85322ef%26entityType%3Dcollection%26workspaceId%3D80af54be-a333-4712-af5e-41aa9eccbdd0) |
You can also fork a collection by selecting the ellipses to the right of the collection and selecting 'Create a fork.'

View File

@@ -0,0 +1,33 @@
import React, {useEffect, useState} from 'react';
import useBaseUrl from '@docusaurus/useBaseUrl';
import {getItem} from '../services/CMSService';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
export default function CMSLinkComponent({children, source}) {
const [fileContent, setFileContent] = useState('');
const {siteConfig} = useDocusaurusContext();
useEffect(() => {
const fetchFileContent = async () => {
try {
const response = await getV2024(siteConfig.customFields.CMS_APP_API_ENDPOINT);
//const response = await getItem('https://lyna7x4y34.execute-api.us-east-1.amazonaws.com/Prod/', source);
if (response.id) {
const content = response.Item
setFileContent(content);
} else {
console.error('Error fetching GitHub file:', response.statusText);
}
} catch (error) {
console.error('Error fetching GitHub file:', error);
}
};
fetchFileContent();
}, []);
return (
<a href={fileContent} target="_blank">
<img src={useBaseUrl('/img/button.svg')}></img>
</a>
);
}

View File

@@ -1,5 +1,3 @@
import { CMSBaseURL } from '../util/util';
export async function getBanner(cmsurl) {
try {
@@ -9,3 +7,14 @@ export async function getBanner(cmsurl) {
return [];
}
}
export async function getItem(cmsurl, itemId) {
try {
const response = await fetch(cmsurl + itemId);
return await response.json();
} catch (error) {
return [];
}
}