From 933530300cae1bb0a4e9549d48057b2557b6cf6b Mon Sep 17 00:00:00 2001 From: Ted Chambers Date: Tue, 11 Aug 2020 10:46:46 -0400 Subject: [PATCH 1/4] add pipeline permissions and checks clients --- azuredevops/pipelinepermissions/client.go | 160 ++++++++++++ azuredevops/pipelinepermissions/models.go | 48 ++++ azuredevops/pipelineschecks/client.go | 290 ++++++++++++++++++++++ azuredevops/pipelineschecks/models.go | 121 +++++++++ 4 files changed, 619 insertions(+) create mode 100644 azuredevops/pipelinepermissions/client.go create mode 100644 azuredevops/pipelinepermissions/models.go create mode 100644 azuredevops/pipelineschecks/client.go create mode 100644 azuredevops/pipelineschecks/models.go diff --git a/azuredevops/pipelinepermissions/client.go b/azuredevops/pipelinepermissions/client.go new file mode 100644 index 00000000..11982b30 --- /dev/null +++ b/azuredevops/pipelinepermissions/client.go @@ -0,0 +1,160 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package pipelinepermissions + +import ( + "bytes" + "context" + "encoding/json" + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "net/http" +) + +var ResourceAreaId, _ = uuid.Parse("a81a0441-de52-4000-aa15-ff0e07bfbbaa") + +type Client interface { + // [Preview API] Given a ResourceType and ResourceId, returns authorized definitions for that resource. + GetPipelinePermissionsForResource(context.Context, GetPipelinePermissionsForResourceArgs) (*ResourcePipelinePermissions, error) + // [Preview API] Authorizes/Unauthorizes a list of definitions for a given resource. + UpdatePipelinePermisionsForResource(context.Context, UpdatePipelinePermisionsForResourceArgs) (*ResourcePipelinePermissions, error) + // [Preview API] Batch API to authorize/unauthorize a list of definitions for a multiple resources. + UpdatePipelinePermisionsForResources(context.Context, UpdatePipelinePermisionsForResourcesArgs) (*[]ResourcePipelinePermissions, error) +} + +type ClientImpl struct { + Client azuredevops.Client +} + +func NewClient(ctx context.Context, connection *azuredevops.Connection) (Client, error) { + client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId) + if err != nil { + return nil, err + } + return &ClientImpl{ + Client: *client, + }, nil +} + +// [Preview API] Given a ResourceType and ResourceId, returns authorized definitions for that resource. +func (client *ClientImpl) GetPipelinePermissionsForResource(ctx context.Context, args GetPipelinePermissionsForResourceArgs) (*ResourcePipelinePermissions, 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.ResourceType == nil || *args.ResourceType == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ResourceType"} + } + routeValues["resourceType"] = *args.ResourceType + if args.ResourceId == nil || *args.ResourceId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ResourceId"} + } + routeValues["resourceId"] = *args.ResourceId + + locationId, _ := uuid.Parse("b5b9a4a4-e6cd-4096-853c-ab7d8b0c4eb2") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ResourcePipelinePermissions + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetPipelinePermissionsForResource function +type GetPipelinePermissionsForResourceArgs struct { + // (required) Project ID or project name + Project *string + // (required) + ResourceType *string + // (required) + ResourceId *string +} + +// [Preview API] Authorizes/Unauthorizes a list of definitions for a given resource. +func (client *ClientImpl) UpdatePipelinePermisionsForResource(ctx context.Context, args UpdatePipelinePermisionsForResourceArgs) (*ResourcePipelinePermissions, error) { + if args.ResourceAuthorization == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ResourceAuthorization"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.ResourceType == nil || *args.ResourceType == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ResourceType"} + } + routeValues["resourceType"] = *args.ResourceType + if args.ResourceId == nil || *args.ResourceId == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.ResourceId"} + } + routeValues["resourceId"] = *args.ResourceId + + body, marshalErr := json.Marshal(*args.ResourceAuthorization) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("b5b9a4a4-e6cd-4096-853c-ab7d8b0c4eb2") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue ResourcePipelinePermissions + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdatePipelinePermisionsForResource function +type UpdatePipelinePermisionsForResourceArgs struct { + // (required) + ResourceAuthorization *ResourcePipelinePermissions + // (required) Project ID or project name + Project *string + // (required) + ResourceType *string + // (required) + ResourceId *string +} + +// [Preview API] Batch API to authorize/unauthorize a list of definitions for a multiple resources. +func (client *ClientImpl) UpdatePipelinePermisionsForResources(ctx context.Context, args UpdatePipelinePermisionsForResourcesArgs) (*[]ResourcePipelinePermissions, error) { + if args.ResourceAuthorizations == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.ResourceAuthorizations"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.ResourceAuthorizations) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("b5b9a4a4-e6cd-4096-853c-ab7d8b0c4eb2") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []ResourcePipelinePermissions + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdatePipelinePermisionsForResources function +type UpdatePipelinePermisionsForResourcesArgs struct { + // (required) + ResourceAuthorizations *[]ResourcePipelinePermissions + // (required) Project ID or project name + Project *string +} diff --git a/azuredevops/pipelinepermissions/models.go b/azuredevops/pipelinepermissions/models.go new file mode 100644 index 00000000..36c0bb53 --- /dev/null +++ b/azuredevops/pipelinepermissions/models.go @@ -0,0 +1,48 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package pipelinepermissions + +import ( + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/pipelineschecks" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" +) + +type Permission struct { + Authorized *bool `json:"authorized,omitempty"` + AuthorizedBy *webapi.IdentityRef `json:"authorizedBy,omitempty"` + AuthorizedOn *azuredevops.Time `json:"authorizedOn,omitempty"` +} + +type PipelinePermission struct { + Authorized *bool `json:"authorized,omitempty"` + AuthorizedBy *webapi.IdentityRef `json:"authorizedBy,omitempty"` + AuthorizedOn *azuredevops.Time `json:"authorizedOn,omitempty"` + Id *int `json:"id,omitempty"` +} + +type PipelineProcessResources struct { + Resources *[]PipelineResourceReference `json:"resources,omitempty"` +} + +type PipelineResourceReference struct { + Authorized *bool `json:"authorized,omitempty"` + AuthorizedBy *uuid.UUID `json:"authorizedBy,omitempty"` + AuthorizedOn *azuredevops.Time `json:"authorizedOn,omitempty"` + DefinitionId *int `json:"definitionId,omitempty"` + Id *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` +} + +type ResourcePipelinePermissions struct { + AllPipelines *Permission `json:"allPipelines,omitempty"` + Pipelines *[]PipelinePermission `json:"pipelines,omitempty"` + Resource *pipelineschecks.Resource `json:"resource,omitempty"` +} diff --git a/azuredevops/pipelineschecks/client.go b/azuredevops/pipelineschecks/client.go new file mode 100644 index 00000000..c800428f --- /dev/null +++ b/azuredevops/pipelineschecks/client.go @@ -0,0 +1,290 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package pipelineschecks + +import ( + "bytes" + "context" + "encoding/json" + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "net/http" + "net/url" + "strconv" +) + +var ResourceAreaId, _ = uuid.Parse("4a933897-0488-45af-bd82-6fd3ad33f46a") + +type Client interface { + // [Preview API] Add a check configuration + AddCheckConfiguration(context.Context, AddCheckConfigurationArgs) (*CheckConfiguration, error) + // [Preview API] + DeleteCheckConfiguration(context.Context, DeleteCheckConfigurationArgs) error + // [Preview API] + EvaluateCheckSuite(context.Context, EvaluateCheckSuiteArgs) (*CheckSuite, error) + // [Preview API] Get Check configuration by Id + GetCheckConfiguration(context.Context, GetCheckConfigurationArgs) (*CheckConfiguration, error) + // [Preview API] Get Check configuration by resource type and id + GetCheckConfigurationsOnResource(context.Context, GetCheckConfigurationsOnResourceArgs) (*[]CheckConfiguration, error) + // [Preview API] + GetCheckSuite(context.Context, GetCheckSuiteArgs) (*CheckSuite, error) + // [Preview API] Update check configuration + UpdateCheckConfiguration(context.Context, UpdateCheckConfigurationArgs) (*CheckConfiguration, error) +} + +type ClientImpl struct { + Client azuredevops.Client +} + +func NewClient(ctx context.Context, connection *azuredevops.Connection) (Client, error) { + client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId) + if err != nil { + return nil, err + } + return &ClientImpl{ + Client: *client, + }, nil +} + +// [Preview API] Add a check configuration +func (client *ClientImpl) AddCheckConfiguration(ctx context.Context, args AddCheckConfigurationArgs) (*CheckConfiguration, 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 + + body, marshalErr := json.Marshal(*args.Configuration) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("86c8381e-5aee-4cde-8ae4-25c0c7f5eaea") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue CheckConfiguration + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the AddCheckConfiguration function +type AddCheckConfigurationArgs struct { + // (required) + Configuration *CheckConfiguration + // (required) Project ID or project name + Project *string +} + +// [Preview API] +func (client *ClientImpl) DeleteCheckConfiguration(ctx context.Context, args DeleteCheckConfigurationArgs) error { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + if args.Id == nil { + return &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + locationId, _ := uuid.Parse("86c8381e-5aee-4cde-8ae4-25c0c7f5eaea") + _, err := client.Client.Send(ctx, http.MethodDelete, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return err + } + + return nil +} + +// Arguments for the DeleteCheckConfiguration function +type DeleteCheckConfigurationArgs struct { + // (required) Project ID or project name + Project *string + // (required) + Id *int +} + +// [Preview API] +func (client *ClientImpl) EvaluateCheckSuite(ctx context.Context, args EvaluateCheckSuiteArgs) (*CheckSuite, error) { + if args.Request == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Request"} + } + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + body, marshalErr := json.Marshal(*args.Request) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("91282c1d-c183-444f-9554-1485bfb3879d") + resp, err := client.Client.Send(ctx, http.MethodPost, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue CheckSuite + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the EvaluateCheckSuite function +type EvaluateCheckSuiteArgs struct { + // (required) + Request *CheckSuiteRequest + // (required) Project ID or project name + Project *string +} + +// [Preview API] Get Check configuration by Id +func (client *ClientImpl) GetCheckConfiguration(ctx context.Context, args GetCheckConfigurationArgs) (*CheckConfiguration, 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.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + locationId, _ := uuid.Parse("86c8381e-5aee-4cde-8ae4-25c0c7f5eaea") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue CheckConfiguration + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCheckConfiguration function +type GetCheckConfigurationArgs struct { + // (required) Project ID or project name + Project *string + // (required) + Id *int +} + +// [Preview API] Get Check configuration by resource type and id +func (client *ClientImpl) GetCheckConfigurationsOnResource(ctx context.Context, args GetCheckConfigurationsOnResourceArgs) (*[]CheckConfiguration, error) { + routeValues := make(map[string]string) + if args.Project == nil || *args.Project == "" { + return nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: "args.Project"} + } + routeValues["project"] = *args.Project + + queryParams := url.Values{} + if args.ResourceType == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "resourceType"} + } + queryParams.Add("resourceType", *args.ResourceType) + if args.ResourceId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "resourceId"} + } + queryParams.Add("resourceId", *args.ResourceId) + locationId, _ := uuid.Parse("86c8381e-5aee-4cde-8ae4-25c0c7f5eaea") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, queryParams, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue []CheckConfiguration + err = client.Client.UnmarshalCollectionBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCheckConfigurationsOnResource function +type GetCheckConfigurationsOnResourceArgs struct { + // (required) Project ID or project name + Project *string + // (required) resource type + ResourceType *string + // (required) resource id + ResourceId *string +} + +// [Preview API] +func (client *ClientImpl) GetCheckSuite(ctx context.Context, args GetCheckSuiteArgs) (*CheckSuite, 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.CheckSuiteId == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.CheckSuiteId"} + } + routeValues["checkSuiteId"] = (*args.CheckSuiteId).String() + + locationId, _ := uuid.Parse("91282c1d-c183-444f-9554-1485bfb3879d") + resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1-preview.1", routeValues, nil, nil, "", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue CheckSuite + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the GetCheckSuite function +type GetCheckSuiteArgs struct { + // (required) Project ID or project name + Project *string + // (required) + CheckSuiteId *uuid.UUID +} + +// [Preview API] Update check configuration +func (client *ClientImpl) UpdateCheckConfiguration(ctx context.Context, args UpdateCheckConfigurationArgs) (*CheckConfiguration, 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.Id == nil { + return nil, &azuredevops.ArgumentNilError{ArgumentName: "args.Id"} + } + routeValues["id"] = strconv.Itoa(*args.Id) + + body, marshalErr := json.Marshal(*args.Configuration) + if marshalErr != nil { + return nil, marshalErr + } + locationId, _ := uuid.Parse("86c8381e-5aee-4cde-8ae4-25c0c7f5eaea") + resp, err := client.Client.Send(ctx, http.MethodPatch, locationId, "5.1-preview.1", routeValues, nil, bytes.NewReader(body), "application/json", "application/json", nil) + if err != nil { + return nil, err + } + + var responseValue CheckConfiguration + err = client.Client.UnmarshalBody(resp, &responseValue) + return &responseValue, err +} + +// Arguments for the UpdateCheckConfiguration function +type UpdateCheckConfigurationArgs struct { + // (required) check configuration + Configuration *CheckConfiguration + // (required) Project ID or project name + Project *string + // (required) check configuration id + Id *int +} diff --git a/azuredevops/pipelineschecks/models.go b/azuredevops/pipelineschecks/models.go new file mode 100644 index 00000000..a126c4c6 --- /dev/null +++ b/azuredevops/pipelineschecks/models.go @@ -0,0 +1,121 @@ +// -------------------------------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// -------------------------------------------------------------------------------------------- +// Generated file, DO NOT EDIT +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// -------------------------------------------------------------------------------------------- + +package pipelineschecks + +import ( + "github.com/google/uuid" + "github.com/microsoft/azure-devops-go-api/azuredevops" + "github.com/microsoft/azure-devops-go-api/azuredevops/webapi" +) + +type CheckConfiguration struct { + // Check configuration id. + Id *int `json:"id,omitempty"` + // Resource on which check get configured. + Resource *Resource `json:"resource,omitempty"` + // Check configuration type + Type *CheckType `json:"type,omitempty"` + // The URL from which one can fetch the configured check. + Url *string `json:"url,omitempty"` + // Reference links. + Links interface{} `json:"_links,omitempty"` + // Identity of person who configured check. + CreatedBy *webapi.IdentityRef `json:"createdBy,omitempty"` + // Time when check got configured. + CreatedOn *azuredevops.Time `json:"createdOn,omitempty"` + // Identity of person who modified the configured check. + ModifiedBy *webapi.IdentityRef `json:"modifiedBy,omitempty"` + // Time when configured check was modified. + ModifiedOn *azuredevops.Time `json:"modifiedOn,omitempty"` + // Settings for the check configuration. + Settings interface{} `json:"settings,omitempty"` +} + +type CheckConfigurationRef struct { + // Check configuration id. + Id *int `json:"id,omitempty"` + // Resource on which check get configured. + Resource *Resource `json:"resource,omitempty"` + // Check configuration type + Type *CheckType `json:"type,omitempty"` + // The URL from which one can fetch the configured check. + Url *string `json:"url,omitempty"` +} + +type CheckRun struct { + ResultMessage *string `json:"resultMessage,omitempty"` + Status *CheckRunStatus `json:"status,omitempty"` + CheckConfigurationRef *CheckConfigurationRef `json:"checkConfigurationRef,omitempty"` + CompletedDate *azuredevops.Time `json:"completedDate,omitempty"` + CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` +} + +type CheckRunResult struct { + ResultMessage *string `json:"resultMessage,omitempty"` + Status *CheckRunStatus `json:"status,omitempty"` +} + +// [Flags] +type CheckRunStatus string + +type checkRunStatusValuesType struct { + None CheckRunStatus + Queued CheckRunStatus + Running CheckRunStatus + Approved CheckRunStatus + Rejected CheckRunStatus + Canceled CheckRunStatus +} + +var CheckRunStatusValues = checkRunStatusValuesType{ + None: "none", + Queued: "queued", + Running: "running", + Approved: "approved", + Rejected: "rejected", + Canceled: "canceled", +} + +type CheckSuite struct { + // Reference links. + Links interface{} `json:"_links,omitempty"` + // List of check runs associated with the given check suite request. + CheckRuns *[]CheckRun `json:"checkRuns,omitempty"` + // Completed date of the given check suite request + CompletedDate *azuredevops.Time `json:"completedDate,omitempty"` + // Evaluation context for the check suite request + Context interface{} `json:"context,omitempty"` + // Unique suite id generated by the pipeline orchestrator for the pipeline check runs request on the list of resources Pipeline orchestrator will used this identifier to map the check requests on a stage + Id *uuid.UUID `json:"id,omitempty"` + // Optional message for the given check suite request + Message *string `json:"message,omitempty"` + // Overall check runs status for the given suite request. This is check suite status + Status *CheckRunStatus `json:"status,omitempty"` +} + +type CheckSuiteRequest struct { + Context interface{} `json:"context,omitempty"` + Id *uuid.UUID `json:"id,omitempty"` + Resources *[]Resource `json:"resources,omitempty"` +} + +type CheckType struct { + // Gets or sets check type id. + Id *uuid.UUID `json:"id,omitempty"` + // Name of the check type. + Name *string `json:"name,omitempty"` +} + +type Resource struct { + // Id of the resource. + Id *string `json:"id,omitempty"` + // Type of the resource. + Type *string `json:"type,omitempty"` +} From a2d730fb424e4a44455f9eeaa545ea1bbe7f5401 Mon Sep 17 00:00:00 2001 From: Ted Chambers Date: Tue, 11 Aug 2020 11:54:17 -0400 Subject: [PATCH 2/4] update workflow to use later versions of actions --- .github/workflows/go.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ff7d702e..e0ac2de0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -5,17 +5,19 @@ jobs: build: name: Build runs-on: ubuntu-latest + strategy: + matrix: + go: [ '1.13', '1.14' ] steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v2 - - name: Set up Go 1.13 - uses: actions/setup-go@v1 + - name: Setup go + uses: actions/setup-go@v2 with: - go-version: 1.13 + go-version: ${{ matrix.go }} id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v1 - - name: Get dependencies run: | go get -v -t -d ./... From 3525b2140306763329b0c0ed74e7c3305e9fe12c Mon Sep 17 00:00:00 2001 From: Ted Chambers Date: Tue, 11 Aug 2020 12:02:12 -0400 Subject: [PATCH 3/4] test removal of dependency step, to see if it downloads on the fly --- .github/workflows/go.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index e0ac2de0..d4618863 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,14 +18,6 @@ jobs: go-version: ${{ matrix.go }} id: go - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi - - name: go build run: go build -v ./... From e684c7e5625484b04c1cf1ab2f7f1f071bb53728 Mon Sep 17 00:00:00 2001 From: Ted Chambers Date: Tue, 11 Aug 2020 12:03:59 -0400 Subject: [PATCH 4/4] Revert "test removal of dependency step, to see if it downloads on the fly" This reverts commit 3525b2140306763329b0c0ed74e7c3305e9fe12c. --- .github/workflows/go.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d4618863..e0ac2de0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,6 +18,14 @@ jobs: go-version: ${{ matrix.go }} id: go + - name: Get dependencies + run: | + go get -v -t -d ./... + if [ -f Gopkg.toml ]; then + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + dep ensure + fi + - name: go build run: go build -v ./...