pub struct OrgSecretsHandler<'octo> { /* private fields */ }Expand description
A client to GitHub’s organization API.
Created with crate::Octocrab::orgs.
Implementations§
Source§impl<'octo> OrgSecretsHandler<'octo>
impl<'octo> OrgSecretsHandler<'octo>
Sourcepub async fn get_secrets(&self) -> Result<OrganizationSecrets>
pub async fn get_secrets(&self) -> Result<OrganizationSecrets>
Lists all secrets available in an organization without revealing their encrypted values. You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the secrets organization permission to use this endpoint.
let org = octocrab.orgs("owner");
let secrets = org.secrets();
let all_secrets = secrets.get_secrets().await?;Sourcepub async fn get_public_key(&self) -> Result<PublicKey>
pub async fn get_public_key(&self) -> Result<PublicKey>
let org = octocrab.orgs("owner");
let secrets = org.secrets();
let public_key = secrets.get_public_key().await?;Sourcepub async fn get_secret(
&self,
secret_name: impl AsRef<str>,
) -> Result<OrganizationSecret>
pub async fn get_secret( &self, secret_name: impl AsRef<str>, ) -> Result<OrganizationSecret>
Gets a specific secret from the organization without revealing its encrypted values. You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the secrets organization permission to use this endpoint.
let org = octocrab.orgs("owner");
let secrets = org.secrets();
let secret_info = secrets.get_secret("TOKEN").await?;Sourcepub async fn create_or_update_secret(
&self,
secret_name: impl AsRef<str>,
secret: &CreateOrganizationSecret<'_>,
) -> Result<CreateOrganizationSecretResponse>
pub async fn create_or_update_secret( &self, secret_name: impl AsRef<str>, secret: &CreateOrganizationSecret<'_>, ) -> Result<CreateOrganizationSecretResponse>
Creates or updates an organization secret with an encrypted value.
Encrypt your secret using crypto_box.
You must authenticate using an access token with the admin:org scope to use this endpoint.
GitHub Apps must have the secrets organization permission to use this endpoint
use octocrab::models::orgs::secrets::{
CreateOrganizationSecret, CreateOrganizationSecretResponse,
Visibility
};
let org = octocrab.orgs("owner");
let secrets = org.secrets();
let result = secrets.create_or_update_secret("GH_TOKEN", &CreateOrganizationSecret{
key_id: "123456",
encrypted_value: "some-b64-encrypted-string",
visibility: Visibility::Selected,
selected_repository_ids: None,
}).await?;
match result {
CreateOrganizationSecretResponse::Created => println!("Created secret!"),
CreateOrganizationSecretResponse::Updated => println!("Updated secret!"),
}Sourcepub async fn delete_secret(&self, secret_name: impl AsRef<str>) -> Result<()>
pub async fn delete_secret(&self, secret_name: impl AsRef<str>) -> Result<()>
Deletes an organization secret. You must authenticate using an access token with the admin:org scope to use this endpoint. GitHub Apps must have the secrets organization permission to use this endpoint
let org = octocrab.orgs("owner");
let secrets = org.secrets();
secrets.delete_secret("GH_TOKEN").await?;
Auto Trait Implementations§
impl<'octo> Freeze for OrgSecretsHandler<'octo>
impl<'octo> !RefUnwindSafe for OrgSecretsHandler<'octo>
impl<'octo> Send for OrgSecretsHandler<'octo>
impl<'octo> Sync for OrgSecretsHandler<'octo>
impl<'octo> Unpin for OrgSecretsHandler<'octo>
impl<'octo> !UnwindSafe for OrgSecretsHandler<'octo>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more