// Copyright 2024 The go-github AUTHORS. All rights reserved.//// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package githubimport ()// CustomDeploymentProtectionRuleApp represents a single deployment protection rule app for an environment.typeCustomDeploymentProtectionRuleAppstruct { ID *int64`json:"id,omitempty"` Slug *string`json:"slug,omitempty"` IntegrationURL *string`json:"integration_url,omitempty"` NodeID *string`json:"node_id,omitempty"`}// CustomDeploymentProtectionRule represents a single deployment protection rule for an environment.typeCustomDeploymentProtectionRulestruct { ID *int64`json:"id,omitempty"` NodeID *string`json:"node_id,omitempty"` Enabled *bool`json:"enabled,omitempty"` App *CustomDeploymentProtectionRuleApp`json:"app,omitempty"`}// ListDeploymentProtectionRuleResponse represents the response that comes back when you list deployment protection rules.typeListDeploymentProtectionRuleResponsestruct { TotalCount *int`json:"total_count,omitempty"` ProtectionRules []*CustomDeploymentProtectionRule`json:"custom_deployment_protection_rules,omitempty"`}// ListCustomDeploymentRuleIntegrationsResponse represents the slightly different response that comes back when you list custom deployment rule integrations.typeListCustomDeploymentRuleIntegrationsResponsestruct { TotalCount *int`json:"total_count,omitempty"` AvailableIntegrations []*CustomDeploymentProtectionRuleApp`json:"available_custom_deployment_protection_rule_integrations,omitempty"`}// CustomDeploymentProtectionRuleRequest represents a deployment protection rule request.typeCustomDeploymentProtectionRuleRequeststruct { IntegrationID *int64`json:"integration_id,omitempty"`}// GetAllDeploymentProtectionRules gets all the deployment protection rules for an environment.//// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#get-all-deployment-protection-rules-for-an-environment////meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rulesfunc ( *RepositoriesService) ( context.Context, , , string) (*ListDeploymentProtectionRuleResponse, *Response, error) { := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", , , ) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var *ListDeploymentProtectionRuleResponse , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// CreateCustomDeploymentProtectionRule creates a custom deployment protection rule on an environment.//// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#create-a-custom-deployment-protection-rule-on-an-environment////meta:operation POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rulesfunc ( *RepositoriesService) ( context.Context, , , string, *CustomDeploymentProtectionRuleRequest) (*CustomDeploymentProtectionRule, *Response, error) { := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules", , , ) , := .client.NewRequest("POST", , )if != nil {returnnil, nil, } := new(CustomDeploymentProtectionRule) , := .client.Do(, , )if != nil {returnnil, , }return , , nil}// ListCustomDeploymentRuleIntegrations lists the custom deployment rule integrations for an environment.//// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#list-custom-deployment-rule-integrations-available-for-an-environment////meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/appsfunc ( *RepositoriesService) ( context.Context, , , string) (*ListCustomDeploymentRuleIntegrationsResponse, *Response, error) { := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/apps", , , ) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var *ListCustomDeploymentRuleIntegrationsResponse , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// GetCustomDeploymentProtectionRule gets a custom deployment protection rule for an environment.//// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#get-a-custom-deployment-protection-rule////meta:operation GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}func ( *RepositoriesService) ( context.Context, , , string, int64) (*CustomDeploymentProtectionRule, *Response, error) { := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/%v", , , , ) , := .client.NewRequest("GET", , nil)if != nil {returnnil, nil, }var *CustomDeploymentProtectionRule , := .client.Do(, , &)if != nil {returnnil, , }return , , nil}// DisableCustomDeploymentProtectionRule disables a custom deployment protection rule for an environment.//// GitHub API docs: https://docs.github.com/rest/deployments/protection-rules#disable-a-custom-protection-rule-for-an-environment////meta:operation DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}func ( *RepositoriesService) ( context.Context, , , string, int64) (*Response, error) { := fmt.Sprintf("repos/%v/%v/environments/%v/deployment_protection_rules/%v", , , , ) , := .client.NewRequest("DELETE", , nil)if != nil {returnnil, }return .client.Do(, , nil)}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.