openapi_github/models/deployment_branch_policy_settings.rs
1/*
2 * GitHub's official OpenAPI spec + Octokit extension
3 *
4 * OpenAPI specs from https://github.com/github/rest-api-description with the 'x-octokit' extension required by the Octokit SDKs
5 *
6 * The version of the OpenAPI document: 16.6.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// DeploymentBranchPolicySettings : The type of deployment branch policy for this environment. To allow all branches to deploy, set to `null`.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DeploymentBranchPolicySettings {
17 /// Whether only branches with branch protection rules can deploy to this environment. If `protected_branches` is `true`, `custom_branch_policies` must be `false`; if `protected_branches` is `false`, `custom_branch_policies` must be `true`.
18 #[serde(rename = "protected_branches")]
19 pub protected_branches: bool,
20 /// Whether only branches that match the specified name patterns can deploy to this environment. If `custom_branch_policies` is `true`, `protected_branches` must be `false`; if `custom_branch_policies` is `false`, `protected_branches` must be `true`.
21 #[serde(rename = "custom_branch_policies")]
22 pub custom_branch_policies: bool,
23}
24
25impl DeploymentBranchPolicySettings {
26 /// The type of deployment branch policy for this environment. To allow all branches to deploy, set to `null`.
27 pub fn new(protected_branches: bool, custom_branch_policies: bool) -> DeploymentBranchPolicySettings {
28 DeploymentBranchPolicySettings {
29 protected_branches,
30 custom_branch_policies,
31 }
32 }
33}
34