mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
359
vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/policy/client.go
generated
vendored
359
vendor/github.com/Microsoft/azure-devops-go-api/azuredevops/policy/client.go
generated
vendored
@@ -21,22 +21,49 @@ import (
|
||||
|
||||
var ResourceAreaId, _ = uuid.Parse("fb13a388-40dd-4a04-b530-013a739c72ef")
|
||||
|
||||
type Client struct {
|
||||
type Client interface {
|
||||
// Create a policy configuration of a given policy type.
|
||||
CreatePolicyConfiguration(context.Context, CreatePolicyConfigurationArgs) (*PolicyConfiguration, error)
|
||||
// Delete a policy configuration by its ID.
|
||||
DeletePolicyConfiguration(context.Context, DeletePolicyConfigurationArgs) error
|
||||
// Get a policy configuration by its ID.
|
||||
GetPolicyConfiguration(context.Context, GetPolicyConfigurationArgs) (*PolicyConfiguration, error)
|
||||
// Retrieve a specific revision of a given policy by ID.
|
||||
GetPolicyConfigurationRevision(context.Context, GetPolicyConfigurationRevisionArgs) (*PolicyConfiguration, error)
|
||||
// Retrieve all revisions for a given policy.
|
||||
GetPolicyConfigurationRevisions(context.Context, GetPolicyConfigurationRevisionsArgs) (*[]PolicyConfiguration, error)
|
||||
// Get a list of policy configurations in a project.
|
||||
GetPolicyConfigurations(context.Context, GetPolicyConfigurationsArgs) (*GetPolicyConfigurationsResponseValue, error)
|
||||
// [Preview API] Gets the present evaluation state of a policy.
|
||||
GetPolicyEvaluation(context.Context, GetPolicyEvaluationArgs) (*PolicyEvaluationRecord, error)
|
||||
// [Preview API] Retrieves a list of all the policy evaluation statuses for a specific pull request.
|
||||
GetPolicyEvaluations(context.Context, GetPolicyEvaluationsArgs) (*[]PolicyEvaluationRecord, error)
|
||||
// Retrieve a specific policy type by ID.
|
||||
GetPolicyType(context.Context, GetPolicyTypeArgs) (*PolicyType, error)
|
||||
// Retrieve all available policy types.
|
||||
GetPolicyTypes(context.Context, GetPolicyTypesArgs) (*[]PolicyType, error)
|
||||
// [Preview API] Requeue the policy evaluation.
|
||||
RequeuePolicyEvaluation(context.Context, RequeuePolicyEvaluationArgs) (*PolicyEvaluationRecord, error)
|
||||
// Update a policy configuration by its ID.
|
||||
UpdatePolicyConfiguration(context.Context, UpdatePolicyConfigurationArgs) (*PolicyConfiguration, error)
|
||||
}
|
||||
|
||||
type ClientImpl struct {
|
||||
Client azuredevops.Client
|
||||
}
|
||||
|
||||
func NewClient(ctx context.Context, connection *azuredevops.Connection) (*Client, error) {
|
||||
func NewClient(ctx context.Context, connection *azuredevops.Connection) (Client, error) {
|
||||
client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Client{
|
||||
return &ClientImpl{
|
||||
Client: *client,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Create a policy configuration of a given policy type.
|
||||
func (client *Client) CreatePolicyConfiguration(ctx context.Context, args CreatePolicyConfigurationArgs) (*PolicyConfiguration, error) {
|
||||
func (client *ClientImpl) CreatePolicyConfiguration(ctx context.Context, args CreatePolicyConfigurationArgs) (*PolicyConfiguration, error) {
|
||||
if args.Configuration == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Configuration"}
|
||||
}
|
||||
@@ -75,7 +102,7 @@ type CreatePolicyConfigurationArgs struct {
|
||||
}
|
||||
|
||||
// Delete a policy configuration by its ID.
|
||||
func (client *Client) DeletePolicyConfiguration(ctx context.Context, args DeletePolicyConfigurationArgs) error {
|
||||
func (client *ClientImpl) DeletePolicyConfiguration(ctx context.Context, args DeletePolicyConfigurationArgs) error {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
@@ -104,7 +131,7 @@ type DeletePolicyConfigurationArgs struct {
|
||||
}
|
||||
|
||||
// Get a policy configuration by its ID.
|
||||
func (client *Client) GetPolicyConfiguration(ctx context.Context, args GetPolicyConfigurationArgs) (*PolicyConfiguration, error) {
|
||||
func (client *ClientImpl) GetPolicyConfiguration(ctx context.Context, args GetPolicyConfigurationArgs) (*PolicyConfiguration, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
@@ -134,8 +161,87 @@ type GetPolicyConfigurationArgs struct {
|
||||
ConfigurationId *int
|
||||
}
|
||||
|
||||
// Retrieve a specific revision of a given policy by ID.
|
||||
func (client *ClientImpl) GetPolicyConfigurationRevision(ctx context.Context, args GetPolicyConfigurationRevisionArgs) (*PolicyConfiguration, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
}
|
||||
routeValues["project"] = *args.Project
|
||||
if args.ConfigurationId == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"}
|
||||
}
|
||||
routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId)
|
||||
if args.RevisionId == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RevisionId"}
|
||||
}
|
||||
routeValues["revisionId"] = strconv.Itoa(*args.RevisionId)
|
||||
|
||||
locationId, _ := uuid.Parse("fe1e68a2-60d3-43cb-855b-85e41ae97c95")
|
||||
resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var responseValue PolicyConfiguration
|
||||
err = client.Client.UnmarshalBody(resp, &responseValue)
|
||||
return &responseValue, err
|
||||
}
|
||||
|
||||
// Arguments for the GetPolicyConfigurationRevision function
|
||||
type GetPolicyConfigurationRevisionArgs struct {
|
||||
// (required) Project ID or project name
|
||||
Project *string
|
||||
// (required) The policy configuration ID.
|
||||
ConfigurationId *int
|
||||
// (required) The revision ID.
|
||||
RevisionId *int
|
||||
}
|
||||
|
||||
// Retrieve all revisions for a given policy.
|
||||
func (client *ClientImpl) GetPolicyConfigurationRevisions(ctx context.Context, args GetPolicyConfigurationRevisionsArgs) (*[]PolicyConfiguration, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
}
|
||||
routeValues["project"] = *args.Project
|
||||
if args.ConfigurationId == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"}
|
||||
}
|
||||
routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId)
|
||||
|
||||
queryParams := url.Values{}
|
||||
if args.Top != nil {
|
||||
queryParams.Add("$top", strconv.Itoa(*args.Top))
|
||||
}
|
||||
if args.Skip != nil {
|
||||
queryParams.Add("$skip", strconv.Itoa(*args.Skip))
|
||||
}
|
||||
locationId, _ := uuid.Parse("fe1e68a2-60d3-43cb-855b-85e41ae97c95")
|
||||
resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var responseValue []PolicyConfiguration
|
||||
err = client.Client.UnmarshalCollectionBody(resp, &responseValue)
|
||||
return &responseValue, err
|
||||
}
|
||||
|
||||
// Arguments for the GetPolicyConfigurationRevisions function
|
||||
type GetPolicyConfigurationRevisionsArgs struct {
|
||||
// (required) Project ID or project name
|
||||
Project *string
|
||||
// (required) The policy configuration ID.
|
||||
ConfigurationId *int
|
||||
// (optional) The number of revisions to retrieve.
|
||||
Top *int
|
||||
// (optional) The number of revisions to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
|
||||
Skip *int
|
||||
}
|
||||
|
||||
// Get a list of policy configurations in a project.
|
||||
func (client *Client) GetPolicyConfigurations(ctx context.Context, args GetPolicyConfigurationsArgs) (*GetPolicyConfigurationsResponseValue, error) {
|
||||
func (client *ClientImpl) GetPolicyConfigurations(ctx context.Context, args GetPolicyConfigurationsArgs) (*GetPolicyConfigurationsResponseValue, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
@@ -146,6 +252,12 @@ func (client *Client) GetPolicyConfigurations(ctx context.Context, args GetPolic
|
||||
if args.Scope != nil {
|
||||
queryParams.Add("scope", *args.Scope)
|
||||
}
|
||||
if args.Top != nil {
|
||||
queryParams.Add("$top", strconv.Itoa(*args.Top))
|
||||
}
|
||||
if args.ContinuationToken != nil {
|
||||
queryParams.Add("continuationToken", *args.ContinuationToken)
|
||||
}
|
||||
if args.PolicyType != nil {
|
||||
queryParams.Add("policyType", (*args.PolicyType).String())
|
||||
}
|
||||
@@ -167,6 +279,10 @@ type GetPolicyConfigurationsArgs struct {
|
||||
Project *string
|
||||
// (optional) [Provided for legacy reasons] The scope on which a subset of policies is defined.
|
||||
Scope *string
|
||||
// (optional) Maximum number of policies to return.
|
||||
Top *int
|
||||
// (optional) The continuation token used for pagination.
|
||||
ContinuationToken *string
|
||||
// (optional) Filter returned policies to only this type
|
||||
PolicyType *uuid.UUID
|
||||
}
|
||||
@@ -178,48 +294,8 @@ type GetPolicyConfigurationsResponseValue struct {
|
||||
ContinuationToken string
|
||||
}
|
||||
|
||||
// Update a policy configuration by its ID.
|
||||
func (client *Client) UpdatePolicyConfiguration(ctx context.Context, args UpdatePolicyConfigurationArgs) (*PolicyConfiguration, error) {
|
||||
if args.Configuration == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Configuration"}
|
||||
}
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
}
|
||||
routeValues["project"] = *args.Project
|
||||
if args.ConfigurationId == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"}
|
||||
}
|
||||
routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId)
|
||||
|
||||
body, marshalErr := json.Marshal(*args.Configuration)
|
||||
if marshalErr != nil {
|
||||
return nil, marshalErr
|
||||
}
|
||||
locationId, _ := uuid.Parse("dad91cbe-d183-45f8-9c6e-9c1164472121")
|
||||
resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var responseValue PolicyConfiguration
|
||||
err = client.Client.UnmarshalBody(resp, &responseValue)
|
||||
return &responseValue, err
|
||||
}
|
||||
|
||||
// Arguments for the UpdatePolicyConfiguration function
|
||||
type UpdatePolicyConfigurationArgs struct {
|
||||
// (required) The policy configuration to update.
|
||||
Configuration *PolicyConfiguration
|
||||
// (required) Project ID or project name
|
||||
Project *string
|
||||
// (required) ID of the existing policy configuration to be updated.
|
||||
ConfigurationId *int
|
||||
}
|
||||
|
||||
// [Preview API] Gets the present evaluation state of a policy.
|
||||
func (client *Client) GetPolicyEvaluation(ctx context.Context, args GetPolicyEvaluationArgs) (*PolicyEvaluationRecord, error) {
|
||||
func (client *ClientImpl) GetPolicyEvaluation(ctx context.Context, args GetPolicyEvaluationArgs) (*PolicyEvaluationRecord, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
@@ -249,39 +325,8 @@ type GetPolicyEvaluationArgs struct {
|
||||
EvaluationId *uuid.UUID
|
||||
}
|
||||
|
||||
// [Preview API] Requeue the policy evaluation.
|
||||
func (client *Client) RequeuePolicyEvaluation(ctx context.Context, args RequeuePolicyEvaluationArgs) (*PolicyEvaluationRecord, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
}
|
||||
routeValues["project"] = *args.Project
|
||||
if args.EvaluationId == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.EvaluationId"}
|
||||
}
|
||||
routeValues["evaluationId"] = (*args.EvaluationId).String()
|
||||
|
||||
locationId, _ := uuid.Parse("46aecb7a-5d2c-4647-897b-0209505a9fe4")
|
||||
resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var responseValue PolicyEvaluationRecord
|
||||
err = client.Client.UnmarshalBody(resp, &responseValue)
|
||||
return &responseValue, err
|
||||
}
|
||||
|
||||
// Arguments for the RequeuePolicyEvaluation function
|
||||
type RequeuePolicyEvaluationArgs struct {
|
||||
// (required) Project ID or project name
|
||||
Project *string
|
||||
// (required) ID of the policy evaluation to be retrieved.
|
||||
EvaluationId *uuid.UUID
|
||||
}
|
||||
|
||||
// [Preview API] Retrieves a list of all the policy evaluation statuses for a specific pull request.
|
||||
func (client *Client) GetPolicyEvaluations(ctx context.Context, args GetPolicyEvaluationsArgs) (*[]PolicyEvaluationRecord, error) {
|
||||
func (client *ClientImpl) GetPolicyEvaluations(ctx context.Context, args GetPolicyEvaluationsArgs) (*[]PolicyEvaluationRecord, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
@@ -327,87 +372,8 @@ type GetPolicyEvaluationsArgs struct {
|
||||
Skip *int
|
||||
}
|
||||
|
||||
// Retrieve a specific revision of a given policy by ID.
|
||||
func (client *Client) GetPolicyConfigurationRevision(ctx context.Context, args GetPolicyConfigurationRevisionArgs) (*PolicyConfiguration, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
}
|
||||
routeValues["project"] = *args.Project
|
||||
if args.ConfigurationId == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"}
|
||||
}
|
||||
routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId)
|
||||
if args.RevisionId == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.RevisionId"}
|
||||
}
|
||||
routeValues["revisionId"] = strconv.Itoa(*args.RevisionId)
|
||||
|
||||
locationId, _ := uuid.Parse("fe1e68a2-60d3-43cb-855b-85e41ae97c95")
|
||||
resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, nil, nil, "", "application/json", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var responseValue PolicyConfiguration
|
||||
err = client.Client.UnmarshalBody(resp, &responseValue)
|
||||
return &responseValue, err
|
||||
}
|
||||
|
||||
// Arguments for the GetPolicyConfigurationRevision function
|
||||
type GetPolicyConfigurationRevisionArgs struct {
|
||||
// (required) Project ID or project name
|
||||
Project *string
|
||||
// (required) The policy configuration ID.
|
||||
ConfigurationId *int
|
||||
// (required) The revision ID.
|
||||
RevisionId *int
|
||||
}
|
||||
|
||||
// Retrieve all revisions for a given policy.
|
||||
func (client *Client) GetPolicyConfigurationRevisions(ctx context.Context, args GetPolicyConfigurationRevisionsArgs) (*[]PolicyConfiguration, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
}
|
||||
routeValues["project"] = *args.Project
|
||||
if args.ConfigurationId == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"}
|
||||
}
|
||||
routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId)
|
||||
|
||||
queryParams := url.Values{}
|
||||
if args.Top != nil {
|
||||
queryParams.Add("$top", strconv.Itoa(*args.Top))
|
||||
}
|
||||
if args.Skip != nil {
|
||||
queryParams.Add("$skip", strconv.Itoa(*args.Skip))
|
||||
}
|
||||
locationId, _ := uuid.Parse("fe1e68a2-60d3-43cb-855b-85e41ae97c95")
|
||||
resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", routeValues, queryParams, nil, "", "application/json", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var responseValue []PolicyConfiguration
|
||||
err = client.Client.UnmarshalCollectionBody(resp, &responseValue)
|
||||
return &responseValue, err
|
||||
}
|
||||
|
||||
// Arguments for the GetPolicyConfigurationRevisions function
|
||||
type GetPolicyConfigurationRevisionsArgs struct {
|
||||
// (required) Project ID or project name
|
||||
Project *string
|
||||
// (required) The policy configuration ID.
|
||||
ConfigurationId *int
|
||||
// (optional) The number of revisions to retrieve.
|
||||
Top *int
|
||||
// (optional) The number of revisions to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
|
||||
Skip *int
|
||||
}
|
||||
|
||||
// Retrieve a specific policy type by ID.
|
||||
func (client *Client) GetPolicyType(ctx context.Context, args GetPolicyTypeArgs) (*PolicyType, error) {
|
||||
func (client *ClientImpl) GetPolicyType(ctx context.Context, args GetPolicyTypeArgs) (*PolicyType, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
@@ -438,7 +404,7 @@ type GetPolicyTypeArgs struct {
|
||||
}
|
||||
|
||||
// Retrieve all available policy types.
|
||||
func (client *Client) GetPolicyTypes(ctx context.Context, args GetPolicyTypesArgs) (*[]PolicyType, error) {
|
||||
func (client *ClientImpl) GetPolicyTypes(ctx context.Context, args GetPolicyTypesArgs) (*[]PolicyType, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
@@ -461,3 +427,74 @@ type GetPolicyTypesArgs struct {
|
||||
// (required) Project ID or project name
|
||||
Project *string
|
||||
}
|
||||
|
||||
// [Preview API] Requeue the policy evaluation.
|
||||
func (client *ClientImpl) RequeuePolicyEvaluation(ctx context.Context, args RequeuePolicyEvaluationArgs) (*PolicyEvaluationRecord, error) {
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
}
|
||||
routeValues["project"] = *args.Project
|
||||
if args.EvaluationId == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.EvaluationId"}
|
||||
}
|
||||
routeValues["evaluationId"] = (*args.EvaluationId).String()
|
||||
|
||||
locationId, _ := uuid.Parse("46aecb7a-5d2c-4647-897b-0209505a9fe4")
|
||||
resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var responseValue PolicyEvaluationRecord
|
||||
err = client.Client.UnmarshalBody(resp, &responseValue)
|
||||
return &responseValue, err
|
||||
}
|
||||
|
||||
// Arguments for the RequeuePolicyEvaluation function
|
||||
type RequeuePolicyEvaluationArgs struct {
|
||||
// (required) Project ID or project name
|
||||
Project *string
|
||||
// (required) ID of the policy evaluation to be retrieved.
|
||||
EvaluationId *uuid.UUID
|
||||
}
|
||||
|
||||
// Update a policy configuration by its ID.
|
||||
func (client *ClientImpl) UpdatePolicyConfiguration(ctx context.Context, args UpdatePolicyConfigurationArgs) (*PolicyConfiguration, error) {
|
||||
if args.Configuration == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Configuration"}
|
||||
}
|
||||
routeValues := make(map[string]string)
|
||||
if args.Project == nil || *args.Project == "" {
|
||||
return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"}
|
||||
}
|
||||
routeValues["project"] = *args.Project
|
||||
if args.ConfigurationId == nil {
|
||||
return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ConfigurationId"}
|
||||
}
|
||||
routeValues["configurationId"] = strconv.Itoa(*args.ConfigurationId)
|
||||
|
||||
body, marshalErr := json.Marshal(*args.Configuration)
|
||||
if marshalErr != nil {
|
||||
return nil, marshalErr
|
||||
}
|
||||
locationId, _ := uuid.Parse("dad91cbe-d183-45f8-9c6e-9c1164472121")
|
||||
resp, err := client.Client.Send(ctx, http.MethodPut, locationId, "5.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var responseValue PolicyConfiguration
|
||||
err = client.Client.UnmarshalBody(resp, &responseValue)
|
||||
return &responseValue, err
|
||||
}
|
||||
|
||||
// Arguments for the UpdatePolicyConfiguration function
|
||||
type UpdatePolicyConfigurationArgs struct {
|
||||
// (required) The policy configuration to update.
|
||||
Configuration *PolicyConfiguration
|
||||
// (required) Project ID or project name
|
||||
Project *string
|
||||
// (required) ID of the existing policy configuration to be updated.
|
||||
ConfigurationId *int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user