-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from microsoft/dev
Merge dev to master for 5.1 version
- Loading branch information
Showing
136 changed files
with
83,458 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Set the default behavior (used when a rule below doesn't match) | ||
* text=auto | ||
|
||
# Go files | ||
*.go text eol=lf | ||
*.mod text eol=lf | ||
*.sum text eol=lf | ||
|
||
# Some Windows-specific files should always be CRLF | ||
*.bat text eol=crlf | ||
|
||
# Shell scripts | ||
*.sh text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Go | ||
on: [push] | ||
jobs: | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Set up Go 1.13 | ||
uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.13 | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v1 | ||
|
||
- 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 ./... | ||
|
||
- name: go fmt | ||
run: go fmt ./... | ||
|
||
- name: go vet | ||
run: go vet ./... | ||
|
||
- name: go test | ||
run: go test ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ | |
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Go | ||
# Build your Go project. | ||
# Add steps that test, save build artifacts, deploy, and more: | ||
# https://docs.microsoft.com/azure/devops/pipelines/languages/go | ||
|
||
trigger: | ||
- master | ||
- dev | ||
|
||
pool: | ||
vmImage: 'ubuntu-latest' | ||
|
||
variables: | ||
GOBIN: '$(GOPATH)/bin' # Go binaries path | ||
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path | ||
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code | ||
|
||
steps: | ||
- script: | | ||
printenv | sort | ||
displayName: 'Log Environment Variables' | ||
|
||
- script: | | ||
mkdir -p '$(GOBIN)' | ||
mkdir -p '$(GOPATH)/pkg' | ||
mkdir -p '$(modulePath)' | ||
shopt -s extglob | ||
shopt -s dotglob | ||
mv !(gopath) '$(modulePath)' | ||
echo '##vso[task.prependpath]$(GOBIN)' | ||
echo '##vso[task.prependpath]$(GOROOT)/bin' | ||
displayName: 'Set up the Go workspace' | ||
|
||
- script: | | ||
go version | ||
go get -v -t -d ./... | ||
if [ -f Gopkg.toml ]; then | ||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh | ||
dep ensure | ||
fi | ||
go build -v ./... | ||
workingDirectory: '$(modulePath)' | ||
displayName: 'Get dependencies, then build' | ||
|
||
- script: | | ||
go test ./... | ||
workingDirectory: '$(modulePath)' | ||
displayName: 'Run unit tests' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// -------------------------------------------------------------------------------------------- | ||
// 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 accounts | ||
|
||
import ( | ||
"context" | ||
"github.com/google/uuid" | ||
"github.com/microsoft/azure-devops-go-api/azuredevops" | ||
"net/http" | ||
"net/url" | ||
) | ||
|
||
var ResourceAreaId, _ = uuid.Parse("0d55247a-1c47-4462-9b1f-5e2125590ee6") | ||
|
||
type Client interface { | ||
// Get a list of accounts for a specific owner or a specific member. | ||
GetAccounts(context.Context, GetAccountsArgs) (*[]Account, 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 | ||
} | ||
|
||
// Get a list of accounts for a specific owner or a specific member. | ||
func (client *ClientImpl) GetAccounts(ctx context.Context, args GetAccountsArgs) (*[]Account, error) { | ||
queryParams := url.Values{} | ||
if args.OwnerId != nil { | ||
queryParams.Add("ownerId", (*args.OwnerId).String()) | ||
} | ||
if args.MemberId != nil { | ||
queryParams.Add("memberId", (*args.MemberId).String()) | ||
} | ||
if args.Properties != nil { | ||
queryParams.Add("properties", *args.Properties) | ||
} | ||
locationId, _ := uuid.Parse("229a6a53-b428-4ffb-a835-e8f36b5b4b1e") | ||
resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "5.1", nil, queryParams, nil, "", "application/json", nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var responseValue []Account | ||
err = client.Client.UnmarshalCollectionBody(resp, &responseValue) | ||
return &responseValue, err | ||
} | ||
|
||
// Arguments for the GetAccounts function | ||
type GetAccountsArgs struct { | ||
// (optional) ID for the owner of the accounts. | ||
OwnerId *uuid.UUID | ||
// (optional) ID for a member of the accounts. | ||
MemberId *uuid.UUID | ||
// (optional) | ||
Properties *string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
// -------------------------------------------------------------------------------------------- | ||
// 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 accounts | ||
|
||
import ( | ||
"github.com/google/uuid" | ||
"github.com/microsoft/azure-devops-go-api/azuredevops" | ||
) | ||
|
||
type Account struct { | ||
// Identifier for an Account | ||
AccountId *uuid.UUID `json:"accountId,omitempty"` | ||
// Name for an account | ||
AccountName *string `json:"accountName,omitempty"` | ||
// Owner of account | ||
AccountOwner *uuid.UUID `json:"accountOwner,omitempty"` | ||
// Current account status | ||
AccountStatus *AccountStatus `json:"accountStatus,omitempty"` | ||
// Type of account: Personal, Organization | ||
AccountType *AccountType `json:"accountType,omitempty"` | ||
// Uri for an account | ||
AccountUri *string `json:"accountUri,omitempty"` | ||
// Who created the account | ||
CreatedBy *uuid.UUID `json:"createdBy,omitempty"` | ||
// Date account was created | ||
CreatedDate *azuredevops.Time `json:"createdDate,omitempty"` | ||
HasMoved *bool `json:"hasMoved,omitempty"` | ||
// Identity of last person to update the account | ||
LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"` | ||
// Date account was last updated | ||
LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"` | ||
// Namespace for an account | ||
NamespaceId *uuid.UUID `json:"namespaceId,omitempty"` | ||
NewCollectionId *uuid.UUID `json:"newCollectionId,omitempty"` | ||
// Organization that created the account | ||
OrganizationName *string `json:"organizationName,omitempty"` | ||
// Extended properties | ||
Properties interface{} `json:"properties,omitempty"` | ||
// Reason for current status | ||
StatusReason *string `json:"statusReason,omitempty"` | ||
} | ||
|
||
type AccountCreateInfoInternal struct { | ||
AccountName *string `json:"accountName,omitempty"` | ||
Creator *uuid.UUID `json:"creator,omitempty"` | ||
Organization *string `json:"organization,omitempty"` | ||
Preferences *AccountPreferencesInternal `json:"preferences,omitempty"` | ||
Properties interface{} `json:"properties,omitempty"` | ||
ServiceDefinitions *[]azuredevops.KeyValuePair `json:"serviceDefinitions,omitempty"` | ||
} | ||
|
||
type AccountPreferencesInternal struct { | ||
Culture interface{} `json:"culture,omitempty"` | ||
Language interface{} `json:"language,omitempty"` | ||
TimeZone interface{} `json:"timeZone,omitempty"` | ||
} | ||
|
||
type AccountStatus string | ||
|
||
type accountStatusValuesType struct { | ||
None AccountStatus | ||
Enabled AccountStatus | ||
Disabled AccountStatus | ||
Deleted AccountStatus | ||
Moved AccountStatus | ||
} | ||
|
||
var AccountStatusValues = accountStatusValuesType{ | ||
None: "none", | ||
// This hosting account is active and assigned to a customer. | ||
Enabled: "enabled", | ||
// This hosting account is disabled. | ||
Disabled: "disabled", | ||
// This account is part of deletion batch and scheduled for deletion. | ||
Deleted: "deleted", | ||
// This account is not mastered locally and has physically moved. | ||
Moved: "moved", | ||
} | ||
|
||
type AccountType string | ||
|
||
type accountTypeValuesType struct { | ||
Personal AccountType | ||
Organization AccountType | ||
} | ||
|
||
var AccountTypeValues = accountTypeValuesType{ | ||
Personal: "personal", | ||
Organization: "organization", | ||
} | ||
|
||
type AccountUserStatus string | ||
|
||
type accountUserStatusValuesType struct { | ||
None AccountUserStatus | ||
Active AccountUserStatus | ||
Disabled AccountUserStatus | ||
Deleted AccountUserStatus | ||
Pending AccountUserStatus | ||
Expired AccountUserStatus | ||
PendingDisabled AccountUserStatus | ||
} | ||
|
||
var AccountUserStatusValues = accountUserStatusValuesType{ | ||
None: "none", | ||
// User has signed in at least once to the VSTS account | ||
Active: "active", | ||
// User cannot sign in; primarily used by admin to temporarily remove a user due to absence or license reallocation | ||
Disabled: "disabled", | ||
// User is removed from the VSTS account by the VSTS account admin | ||
Deleted: "deleted", | ||
// User is invited to join the VSTS account by the VSTS account admin, but has not signed up/signed in yet | ||
Pending: "pending", | ||
// User can sign in; primarily used when license is in expired state and we give a grace period | ||
Expired: "expired", | ||
// User is disabled; if reenabled, they will still be in the Pending state | ||
PendingDisabled: "pendingDisabled", | ||
} |
Oops, something went wrong.