Crates.io | test-shisho-policy |
lib.rs | test-shisho-policy |
version | 0.1.0 |
source | src |
created_at | 2022-11-09 04:38:27.766916 |
updated_at | 2022-11-09 04:38:27.766916 |
description | This is the SDK of Shisho Cloud policies to write your custom policies in Rust. |
homepage | |
repository | |
max_upload_size | |
id | 708543 |
size | 11,419 |
This is a helper crate for Shisho Cloud workflows to write custom policies.
This is the core library to write custom policies.
decision
includes the structs of output data
(=decsion
results).gqlgen
includes the functionalities of converting from geraphql
schema and queries. The original code comes from graphql-client/graphql_client_codegen
schema
includes the string of datasource
graphql query. The schema is generated by the codegen.This required the helper crate, shisho-gql-derive
use shisho_gql_derive::*;
pub use shisho_policy_sdk::decision::data_entry::*;
pub use shisho_policy_sdk::decision::github::organization::org_owners::*;
pub use shisho_policy_sdk::decision::*;
use self::input::InputGithubOrganizations;
#[allow(dead_code)]
#[derive(ShishoGraphQLQuery)]
#[shisho_graphql(
query_path = "src/policies/organization/org_owners/query.graphql",
response_derives = "Debug, PartialEq"
)]
pub struct Input;
pub fn decisions(input: input::InputData) -> Vec<Decision<OrgOwnersEntryData>> {
input
.github
.organizations
.into_iter()
.map(|o: InputGithubOrganizations| decide_on_each_org(o))
.collect()
}
pub fn decide_on_each_org(o: InputGithubOrganizations) -> Decision<OrgOwnersEntryData> {
...
}
graphql-client/graphql_client_codegen