-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(action): add support data contract action
changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes changes
- Loading branch information
1 parent
5dc164b
commit 4e3d955
Showing
15 changed files
with
6,755 additions
and
816 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
node_modules/ | ||
event.json | ||
.idea | ||
.DS_Store | ||
.DS_Store | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { | ||
ATLAN_API_TOKEN, | ||
ATLAN_INSTANCE_URL, | ||
} from "../utils/get-environment-variables.js"; | ||
|
||
import fetch from "node-fetch"; | ||
|
||
export default async function getAssetClassifications() { | ||
var myHeaders = { | ||
Authorization: `Bearer ${ATLAN_API_TOKEN}`, | ||
"Content-Type": "application/json", | ||
}; | ||
|
||
var requestOptions = { | ||
method: "GET", | ||
headers: myHeaders, | ||
redirect: "follow", | ||
}; | ||
|
||
var response = await fetch( | ||
`${ATLAN_INSTANCE_URL}/api/meta/types/typedefs?type=classification`, | ||
requestOptions | ||
) | ||
.then((e) => e.json()) | ||
.catch((err) => { | ||
return { | ||
error: err | ||
} | ||
}); | ||
if (response.error) return response | ||
|
||
return response?.classificationDefs; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { | ||
ATLAN_API_TOKEN, | ||
ATLAN_INSTANCE_URL, | ||
} from "../utils/get-environment-variables.js"; | ||
|
||
import fetch from "node-fetch"; | ||
import { | ||
getErrorAssetNotFound, | ||
} from "../templates/atlan.js"; | ||
import stringify from "json-stringify-safe"; | ||
|
||
export default async function getContractAsset({ | ||
name, | ||
atlanConfig, | ||
contractSpec, | ||
}) { | ||
var myHeaders = { | ||
Authorization: `Bearer ${ATLAN_API_TOKEN}`, | ||
"Content-Type": "application/json", | ||
}; | ||
|
||
var raw = stringify( | ||
{ | ||
"atlanConfig": atlanConfig, | ||
"contractSpec": contractSpec | ||
} | ||
); | ||
|
||
var requestOptions = { | ||
method: "POST", | ||
headers: myHeaders, | ||
body: raw, | ||
}; | ||
|
||
var response = await fetch( | ||
`${ATLAN_INSTANCE_URL}/api/service/contracts/asset`, | ||
requestOptions | ||
) | ||
.then((e) => e.json()) | ||
.catch((err) => { | ||
return { | ||
error: err, | ||
comment: getErrorAssetNotFound(name) | ||
} | ||
}); | ||
|
||
if (!response?.entities?.length) { | ||
return { | ||
error: "asset not found", | ||
comment: getErrorAssetNotFound(name), | ||
}; | ||
} | ||
|
||
return response.entities[0]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.