Skip to content

Commit 938b429

Browse files
authored
Merge pull request #129 from microsoft/users/pnechvatal/v71
Initial version of API 7.1 clients
2 parents 92acad3 + 7905a9a commit 938b429

File tree

141 files changed

+90230
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+90230
-2
lines changed

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
go: [ '1.13', '1.14', '1.17' ]
11-
dir: [ './azuredevops', './azuredevops/v6']
10+
go: [ '1.13', '1.14', '1.18' ]
11+
dir: [ './azuredevops', './azuredevops/v6', './azuredevops/v7']
1212
steps:
1313
- name: Check out code into the Go module directory
1414
uses: actions/checkout@v2

azuredevops/v7/accounts/client.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// --------------------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT License.
4+
// --------------------------------------------------------------------------------------------
5+
// Generated file, DO NOT EDIT
6+
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
// --------------------------------------------------------------------------------------------
8+
9+
package accounts
10+
11+
import (
12+
"context"
13+
"github.com/google/uuid"
14+
"github.com/microsoft/azure-devops-go-api/azuredevops/v7"
15+
"net/http"
16+
"net/url"
17+
)
18+
19+
var ResourceAreaId, _ = uuid.Parse("0d55247a-1c47-4462-9b1f-5e2125590ee6")
20+
21+
type Client interface {
22+
// [Preview API] Get a list of accounts for a specific owner or a specific member. One of the following parameters is required: ownerId, memberId.
23+
GetAccounts(context.Context, GetAccountsArgs) (*[]Account, error)
24+
}
25+
26+
type ClientImpl struct {
27+
Client azuredevops.Client
28+
}
29+
30+
func NewClient(ctx context.Context, connection *azuredevops.Connection) (Client, error) {
31+
client, err := connection.GetClientByResourceAreaId(ctx, ResourceAreaId)
32+
if err != nil {
33+
return nil, err
34+
}
35+
return &ClientImpl{
36+
Client: *client,
37+
}, nil
38+
}
39+
40+
// [Preview API] Get a list of accounts for a specific owner or a specific member. One of the following parameters is required: ownerId, memberId.
41+
func (client *ClientImpl) GetAccounts(ctx context.Context, args GetAccountsArgs) (*[]Account, error) {
42+
queryParams := url.Values{}
43+
if args.OwnerId != nil {
44+
queryParams.Add("ownerId", (*args.OwnerId).String())
45+
}
46+
if args.MemberId != nil {
47+
queryParams.Add("memberId", (*args.MemberId).String())
48+
}
49+
if args.Properties != nil {
50+
queryParams.Add("properties", *args.Properties)
51+
}
52+
locationId, _ := uuid.Parse("229a6a53-b428-4ffb-a835-e8f36b5b4b1e")
53+
resp, err := client.Client.Send(ctx, http.MethodGet, locationId, "7.1-preview.1", nil, queryParams, nil, "", "application/json", nil)
54+
if err != nil {
55+
return nil, err
56+
}
57+
58+
var responseValue []Account
59+
err = client.Client.UnmarshalCollectionBody(resp, &responseValue)
60+
return &responseValue, err
61+
}
62+
63+
// Arguments for the GetAccounts function
64+
type GetAccountsArgs struct {
65+
// (optional) ID for the owner of the accounts.
66+
OwnerId *uuid.UUID
67+
// (optional) ID for a member of the accounts.
68+
MemberId *uuid.UUID
69+
// (optional)
70+
Properties *string
71+
}

azuredevops/v7/accounts/models.go

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
// --------------------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT License.
4+
// --------------------------------------------------------------------------------------------
5+
// Generated file, DO NOT EDIT
6+
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
// --------------------------------------------------------------------------------------------
8+
9+
package accounts
10+
11+
import (
12+
"github.com/google/uuid"
13+
"github.com/microsoft/azure-devops-go-api/azuredevops/v7"
14+
)
15+
16+
type Account struct {
17+
// Identifier for an Account
18+
AccountId *uuid.UUID `json:"accountId,omitempty"`
19+
// Name for an account
20+
AccountName *string `json:"accountName,omitempty"`
21+
// Owner of account
22+
AccountOwner *uuid.UUID `json:"accountOwner,omitempty"`
23+
// Current account status
24+
AccountStatus *AccountStatus `json:"accountStatus,omitempty"`
25+
// Type of account: Personal, Organization
26+
AccountType *AccountType `json:"accountType,omitempty"`
27+
// Uri for an account
28+
AccountUri *string `json:"accountUri,omitempty"`
29+
// Who created the account
30+
CreatedBy *uuid.UUID `json:"createdBy,omitempty"`
31+
// Date account was created
32+
CreatedDate *azuredevops.Time `json:"createdDate,omitempty"`
33+
HasMoved *bool `json:"hasMoved,omitempty"`
34+
// Identity of last person to update the account
35+
LastUpdatedBy *uuid.UUID `json:"lastUpdatedBy,omitempty"`
36+
// Date account was last updated
37+
LastUpdatedDate *azuredevops.Time `json:"lastUpdatedDate,omitempty"`
38+
// Namespace for an account
39+
NamespaceId *uuid.UUID `json:"namespaceId,omitempty"`
40+
NewCollectionId *uuid.UUID `json:"newCollectionId,omitempty"`
41+
// Organization that created the account
42+
OrganizationName *string `json:"organizationName,omitempty"`
43+
// Extended properties
44+
Properties interface{} `json:"properties,omitempty"`
45+
// Reason for current status
46+
StatusReason *string `json:"statusReason,omitempty"`
47+
}
48+
49+
type AccountCreateInfoInternal struct {
50+
AccountName *string `json:"accountName,omitempty"`
51+
Creator *uuid.UUID `json:"creator,omitempty"`
52+
Organization *string `json:"organization,omitempty"`
53+
Preferences *AccountPreferencesInternal `json:"preferences,omitempty"`
54+
Properties interface{} `json:"properties,omitempty"`
55+
ServiceDefinitions *[]azuredevops.KeyValuePair `json:"serviceDefinitions,omitempty"`
56+
}
57+
58+
type AccountPreferencesInternal struct {
59+
Culture interface{} `json:"culture,omitempty"`
60+
Language interface{} `json:"language,omitempty"`
61+
TimeZone interface{} `json:"timeZone,omitempty"`
62+
}
63+
64+
type AccountStatus string
65+
66+
type accountStatusValuesType struct {
67+
None AccountStatus
68+
Enabled AccountStatus
69+
Disabled AccountStatus
70+
Deleted AccountStatus
71+
Moved AccountStatus
72+
}
73+
74+
var AccountStatusValues = accountStatusValuesType{
75+
None: "none",
76+
// This hosting account is active and assigned to a customer.
77+
Enabled: "enabled",
78+
// This hosting account is disabled.
79+
Disabled: "disabled",
80+
// This account is part of deletion batch and scheduled for deletion.
81+
Deleted: "deleted",
82+
// This account is not mastered locally and has physically moved.
83+
Moved: "moved",
84+
}
85+
86+
type AccountType string
87+
88+
type accountTypeValuesType struct {
89+
Personal AccountType
90+
Organization AccountType
91+
}
92+
93+
var AccountTypeValues = accountTypeValuesType{
94+
Personal: "personal",
95+
Organization: "organization",
96+
}
97+
98+
type AccountUserStatus string
99+
100+
type accountUserStatusValuesType struct {
101+
None AccountUserStatus
102+
Active AccountUserStatus
103+
Disabled AccountUserStatus
104+
Deleted AccountUserStatus
105+
Pending AccountUserStatus
106+
Expired AccountUserStatus
107+
PendingDisabled AccountUserStatus
108+
}
109+
110+
var AccountUserStatusValues = accountUserStatusValuesType{
111+
None: "none",
112+
// User has signed in at least once to the VSTS account
113+
Active: "active",
114+
// User cannot sign in; primarily used by admin to temporarily remove a user due to absence or license reallocation
115+
Disabled: "disabled",
116+
// User is removed from the VSTS account by the VSTS account admin
117+
Deleted: "deleted",
118+
// User is invited to join the VSTS account by the VSTS account admin, but has not signed up/signed in yet
119+
Pending: "pending",
120+
// User can sign in; primarily used when license is in expired state and we give a grace period
121+
Expired: "expired",
122+
// User is disabled; if reenabled, they will still be in the Pending state
123+
PendingDisabled: "pendingDisabled",
124+
}
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
// --------------------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// Licensed under the MIT License.
4+
// --------------------------------------------------------------------------------------------
5+
// Generated file, DO NOT EDIT
6+
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
// --------------------------------------------------------------------------------------------
8+
9+
package aexlicensingrule
10+
11+
import (
12+
"github.com/microsoft/azure-devops-go-api/azuredevops/v7"
13+
"github.com/microsoft/azure-devops-go-api/azuredevops/v7/licensing"
14+
"github.com/microsoft/azure-devops-go-api/azuredevops/v7/operations"
15+
)
16+
17+
type ApplicationStatus struct {
18+
Extensions *[]ExtensionApplicationStatus `json:"extensions,omitempty"`
19+
IsTruncated *bool `json:"isTruncated,omitempty"`
20+
Licenses *[]LicenseApplicationStatus `json:"licenses,omitempty"`
21+
Option *RuleOption `json:"option,omitempty"`
22+
Status *operations.OperationStatus `json:"status,omitempty"`
23+
}
24+
25+
type ExtensionApplicationStatus struct {
26+
Assigned *int `json:"assigned,omitempty"`
27+
Failed *int `json:"failed,omitempty"`
28+
InsufficientResources *int `json:"insufficientResources,omitempty"`
29+
ExtensionId *string `json:"extensionId,omitempty"`
30+
Incompatible *int `json:"incompatible,omitempty"`
31+
Unassigned *int `json:"unassigned,omitempty"`
32+
}
33+
34+
// Represents an Extension Rule
35+
type ExtensionRule struct {
36+
// Extension Id
37+
ExtensionId *string `json:"extensionId,omitempty"`
38+
// Status of the group rule (applied, missing licenses, etc)
39+
Status *GroupLicensingRuleStatus `json:"status,omitempty"`
40+
}
41+
42+
// Batching of subjects to lookup using the Graph API
43+
type GraphSubjectLookup struct {
44+
LookupKeys *[]GraphSubjectLookupKey `json:"lookupKeys,omitempty"`
45+
}
46+
47+
type GraphSubjectLookupKey struct {
48+
Descriptor *string `json:"descriptor,omitempty"`
49+
}
50+
51+
// Represents a GroupLicensingRule
52+
type GroupLicensingRule struct {
53+
// Extension Rules
54+
ExtensionRules *[]ExtensionRule `json:"extensionRules,omitempty"`
55+
// License Rule
56+
LicenseRule *LicenseRule `json:"licenseRule,omitempty"`
57+
// SubjectDescriptor for the rule
58+
SubjectDescriptor *string `json:"subjectDescriptor,omitempty"`
59+
}
60+
61+
type GroupLicensingRuleStatus string
62+
63+
type groupLicensingRuleStatusValuesType struct {
64+
ApplyPending GroupLicensingRuleStatus
65+
Applied GroupLicensingRuleStatus
66+
Incompatible GroupLicensingRuleStatus
67+
UnableToApply GroupLicensingRuleStatus
68+
}
69+
70+
var GroupLicensingRuleStatusValues = groupLicensingRuleStatusValuesType{
71+
// Rule is created or updated, but apply is pending
72+
ApplyPending: "applyPending",
73+
// Rule is applied
74+
Applied: "applied",
75+
// The group rule was incompatible
76+
Incompatible: "incompatible",
77+
// Rule failed to apply unexpectedly and should be retried
78+
UnableToApply: "unableToApply",
79+
}
80+
81+
// Represents an GroupLicensingRuleUpdate Model
82+
type GroupLicensingRuleUpdate struct {
83+
// Extensions to Add
84+
ExtensionsToAdd *[]string `json:"extensionsToAdd,omitempty"`
85+
// Extensions to Remove
86+
ExtensionsToRemove *[]string `json:"extensionsToRemove,omitempty"`
87+
// New License
88+
License *licensing.License `json:"license,omitempty"`
89+
// SubjectDescriptor for the rule
90+
SubjectDescriptor *string `json:"subjectDescriptor,omitempty"`
91+
}
92+
93+
type LicenseApplicationStatus struct {
94+
Assigned *int `json:"assigned,omitempty"`
95+
Failed *int `json:"failed,omitempty"`
96+
InsufficientResources *int `json:"insufficientResources,omitempty"`
97+
AccountUserLicense *licensing.AccountUserLicense `json:"accountUserLicense,omitempty"`
98+
License *licensing.License `json:"license,omitempty"`
99+
}
100+
101+
// Represents a License Rule
102+
type LicenseRule struct {
103+
// The last time the rule was executed (regardless of whether any changes were made)
104+
LastExecuted *azuredevops.Time `json:"lastExecuted,omitempty"`
105+
// Lasted updated timestamp of the licensing rule
106+
LastUpdated *azuredevops.Time `json:"lastUpdated,omitempty"`
107+
// License
108+
License *licensing.License `json:"license,omitempty"`
109+
// Status of the group rule (applied, missing licenses, etc)
110+
Status *GroupLicensingRuleStatus `json:"status,omitempty"`
111+
}
112+
113+
type LicensingApplicationStatus struct {
114+
Assigned *int `json:"assigned,omitempty"`
115+
Failed *int `json:"failed,omitempty"`
116+
InsufficientResources *int `json:"insufficientResources,omitempty"`
117+
}
118+
119+
type RuleOption string
120+
121+
type ruleOptionValuesType struct {
122+
ApplyGroupRule RuleOption
123+
TestApplyGroupRule RuleOption
124+
}
125+
126+
var RuleOptionValues = ruleOptionValuesType{
127+
ApplyGroupRule: "applyGroupRule",
128+
TestApplyGroupRule: "testApplyGroupRule",
129+
}

0 commit comments

Comments
 (0)