1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171
|
package experimentation
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/machinelearning/mgmt/2017-05-01-preview/experimentation"
// Account an object that represents a machine learning team account.
type Account struct {
autorest.Response `json:"-"`
// AccountProperties - The properties of the machine learning team account.
*AccountProperties `json:"properties,omitempty"`
// ID - READ-ONLY; The resource ID.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the resource.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of the resource.
Type *string `json:"type,omitempty"`
// Location - The location of the resource. This cannot be changed after the resource is created.
Location *string `json:"location,omitempty"`
// Tags - The tags of the resource.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Account.
func (a Account) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if a.AccountProperties != nil {
objectMap["properties"] = a.AccountProperties
}
if a.Location != nil {
objectMap["location"] = a.Location
}
if a.Tags != nil {
objectMap["tags"] = a.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Account struct.
func (a *Account) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var accountProperties AccountProperties
err = json.Unmarshal(*v, &accountProperties)
if err != nil {
return err
}
a.AccountProperties = &accountProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
a.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
a.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
a.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
a.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
a.Tags = tags
}
}
}
return nil
}
// AccountListResult the result of a request to list machine learning team accounts.
type AccountListResult struct {
autorest.Response `json:"-"`
// Value - The list of machine learning team accounts. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning team accounts.
Value *[]Account `json:"value,omitempty"`
// NextLink - The URI that can be used to request the next list of machine learning team accounts.
NextLink *string `json:"nextLink,omitempty"`
}
// AccountListResultIterator provides access to a complete listing of Account values.
type AccountListResultIterator struct {
i int
page AccountListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *AccountListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *AccountListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter AccountListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter AccountListResultIterator) Response() AccountListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter AccountListResultIterator) Value() Account {
if !iter.page.NotDone() {
return Account{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the AccountListResultIterator type.
func NewAccountListResultIterator(page AccountListResultPage) AccountListResultIterator {
return AccountListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (alr AccountListResult) IsEmpty() bool {
return alr.Value == nil || len(*alr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (alr AccountListResult) hasNextLink() bool {
return alr.NextLink != nil && len(*alr.NextLink) != 0
}
// accountListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (alr AccountListResult) accountListResultPreparer(ctx context.Context) (*http.Request, error) {
if !alr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(alr.NextLink)))
}
// AccountListResultPage contains a page of Account values.
type AccountListResultPage struct {
fn func(context.Context, AccountListResult) (AccountListResult, error)
alr AccountListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *AccountListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AccountListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.alr)
if err != nil {
return err
}
page.alr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *AccountListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page AccountListResultPage) NotDone() bool {
return !page.alr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page AccountListResultPage) Response() AccountListResult {
return page.alr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page AccountListResultPage) Values() []Account {
if page.alr.IsEmpty() {
return nil
}
return *page.alr.Value
}
// Creates a new instance of the AccountListResultPage type.
func NewAccountListResultPage(cur AccountListResult, getNextPage func(context.Context, AccountListResult) (AccountListResult, error)) AccountListResultPage {
return AccountListResultPage{
fn: getNextPage,
alr: cur,
}
}
// AccountProperties the properties of a machine learning team account.
type AccountProperties struct {
// VsoAccountID - The fully qualified arm id of the vso account to be used for this team account.
VsoAccountID *string `json:"vsoAccountId,omitempty"`
// AccountID - READ-ONLY; The immutable id associated with this team account.
AccountID *string `json:"accountId,omitempty"`
// Description - The description of this workspace.
Description *string `json:"description,omitempty"`
// FriendlyName - The friendly name for this workspace. This will be the workspace name in the arm id when the workspace object gets created
FriendlyName *string `json:"friendlyName,omitempty"`
// KeyVaultID - The fully qualified arm id of the user key vault.
KeyVaultID *string `json:"keyVaultId,omitempty"`
// Seats - The no of users/seats who can access this team account. This property defines the charge on the team account.
Seats *string `json:"seats,omitempty"`
// DiscoveryURI - READ-ONLY; The uri for this machine learning team account.
DiscoveryURI *string `json:"discoveryUri,omitempty"`
// CreationDate - READ-ONLY; The creation date of the machine learning team account in ISO8601 format.
CreationDate *date.Time `json:"creationDate,omitempty"`
// StorageAccount - The properties of the storage account for the machine learning team account.
StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"`
// ProvisioningState - READ-ONLY; The current deployment state of team account resource. The provisioningState is to indicate states for resource provisioning. Possible values include: 'Creating', 'Succeeded', 'Updating', 'Deleting', 'Failed'
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountProperties.
func (ap AccountProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if ap.VsoAccountID != nil {
objectMap["vsoAccountId"] = ap.VsoAccountID
}
if ap.Description != nil {
objectMap["description"] = ap.Description
}
if ap.FriendlyName != nil {
objectMap["friendlyName"] = ap.FriendlyName
}
if ap.KeyVaultID != nil {
objectMap["keyVaultId"] = ap.KeyVaultID
}
if ap.Seats != nil {
objectMap["seats"] = ap.Seats
}
if ap.StorageAccount != nil {
objectMap["storageAccount"] = ap.StorageAccount
}
return json.Marshal(objectMap)
}
// AccountPropertiesUpdateParameters the parameters for updating the properties of a machine learning team
// account.
type AccountPropertiesUpdateParameters struct {
// Description - The description of this workspace.
Description *string `json:"description,omitempty"`
// FriendlyName - The friendly name for this workspace. This will be the workspace name in the arm id when the workspace object gets created
FriendlyName *string `json:"friendlyName,omitempty"`
// Seats - The no of users/seats who can access this team account. This property defines the charge on the team account.
Seats *string `json:"seats,omitempty"`
// StorageAccountKey - The key for storage account associated with this team account
StorageAccountKey *string `json:"storageAccountKey,omitempty"`
}
// AccountUpdateParameters the parameters for updating a machine learning team account.
type AccountUpdateParameters struct {
// Tags - The resource tags for the machine learning team account.
Tags map[string]*string `json:"tags"`
// AccountPropertiesUpdateParameters - The properties that the machine learning team account will be updated with.
*AccountPropertiesUpdateParameters `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountUpdateParameters.
func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if aup.Tags != nil {
objectMap["tags"] = aup.Tags
}
if aup.AccountPropertiesUpdateParameters != nil {
objectMap["properties"] = aup.AccountPropertiesUpdateParameters
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct.
func (aup *AccountUpdateParameters) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
aup.Tags = tags
}
case "properties":
if v != nil {
var accountPropertiesUpdateParameters AccountPropertiesUpdateParameters
err = json.Unmarshal(*v, &accountPropertiesUpdateParameters)
if err != nil {
return err
}
aup.AccountPropertiesUpdateParameters = &accountPropertiesUpdateParameters
}
}
}
return nil
}
// ErrorResponse the error response send when an operation fails.
type ErrorResponse struct {
// Code - error code
Code *string `json:"code,omitempty"`
// Message - error message
Message *string `json:"message,omitempty"`
}
// Operation azure Machine Learning team account REST API operation
type Operation struct {
// Name - Operation name: {provider}/{resource}/{operation}
Name *string `json:"name,omitempty"`
// Display - Display name of operation
Display *OperationDisplay `json:"display,omitempty"`
}
// OperationDisplay display name of operation
type OperationDisplay struct {
// Provider - The resource provider name: Microsoft.MachineLearningExperimentation
Provider *string `json:"provider,omitempty"`
// Resource - The resource on which the operation is performed.
Resource *string `json:"resource,omitempty"`
// Operation - The operation that users can perform.
Operation *string `json:"operation,omitempty"`
// Description - The description for the operation.
Description *string `json:"description,omitempty"`
}
// OperationListResult an array of operations supported by the resource provider.
type OperationListResult struct {
autorest.Response `json:"-"`
// Value - List of AML team account operations supported by the AML team account resource provider.
Value *[]Operation `json:"value,omitempty"`
}
// Project an object that represents a machine learning project.
type Project struct {
autorest.Response `json:"-"`
// ProjectProperties - The properties of the Project.
*ProjectProperties `json:"properties,omitempty"`
// ID - READ-ONLY; The resource ID.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the resource.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of the resource.
Type *string `json:"type,omitempty"`
// Location - The location of the resource. This cannot be changed after the resource is created.
Location *string `json:"location,omitempty"`
// Tags - The tags of the resource.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Project.
func (p Project) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if p.ProjectProperties != nil {
objectMap["properties"] = p.ProjectProperties
}
if p.Location != nil {
objectMap["location"] = p.Location
}
if p.Tags != nil {
objectMap["tags"] = p.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Project struct.
func (p *Project) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var projectProperties ProjectProperties
err = json.Unmarshal(*v, &projectProperties)
if err != nil {
return err
}
p.ProjectProperties = &projectProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
p.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
p.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
p.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
p.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
p.Tags = tags
}
}
}
return nil
}
// ProjectListResult the result of a request to list projects.
type ProjectListResult struct {
autorest.Response `json:"-"`
// Value - The list of projects. Since this list may be incomplete, the nextLink field should be used to request the next list of projects.
Value *[]Project `json:"value,omitempty"`
// NextLink - The URI that can be used to request the next list of projects.
NextLink *string `json:"nextLink,omitempty"`
}
// ProjectListResultIterator provides access to a complete listing of Project values.
type ProjectListResultIterator struct {
i int
page ProjectListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *ProjectListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ProjectListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *ProjectListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter ProjectListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter ProjectListResultIterator) Response() ProjectListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter ProjectListResultIterator) Value() Project {
if !iter.page.NotDone() {
return Project{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the ProjectListResultIterator type.
func NewProjectListResultIterator(page ProjectListResultPage) ProjectListResultIterator {
return ProjectListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (plr ProjectListResult) IsEmpty() bool {
return plr.Value == nil || len(*plr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (plr ProjectListResult) hasNextLink() bool {
return plr.NextLink != nil && len(*plr.NextLink) != 0
}
// projectListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (plr ProjectListResult) projectListResultPreparer(ctx context.Context) (*http.Request, error) {
if !plr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(plr.NextLink)))
}
// ProjectListResultPage contains a page of Project values.
type ProjectListResultPage struct {
fn func(context.Context, ProjectListResult) (ProjectListResult, error)
plr ProjectListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *ProjectListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/ProjectListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.plr)
if err != nil {
return err
}
page.plr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *ProjectListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page ProjectListResultPage) NotDone() bool {
return !page.plr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page ProjectListResultPage) Response() ProjectListResult {
return page.plr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page ProjectListResultPage) Values() []Project {
if page.plr.IsEmpty() {
return nil
}
return *page.plr.Value
}
// Creates a new instance of the ProjectListResultPage type.
func NewProjectListResultPage(cur ProjectListResult, getNextPage func(context.Context, ProjectListResult) (ProjectListResult, error)) ProjectListResultPage {
return ProjectListResultPage{
fn: getNextPage,
plr: cur,
}
}
// ProjectProperties the properties of a machine learning project.
type ProjectProperties struct {
// Description - The description of this project.
Description *string `json:"description,omitempty"`
// AccountID - READ-ONLY; The immutable id of the team account which contains this project.
AccountID *string `json:"accountId,omitempty"`
// WorkspaceID - READ-ONLY; The immutable id of the workspace which contains this project.
WorkspaceID *string `json:"workspaceId,omitempty"`
// ProjectID - READ-ONLY; The immutable id of this project.
ProjectID *string `json:"projectId,omitempty"`
// Gitrepo - The reference to git repo for this project.
Gitrepo *string `json:"gitrepo,omitempty"`
// FriendlyName - The friendly name for this project.
FriendlyName *string `json:"friendlyName,omitempty"`
// CreationDate - READ-ONLY; The creation date of the project in ISO8601 format.
CreationDate *date.Time `json:"creationDate,omitempty"`
// ProvisioningState - READ-ONLY; The current deployment state of project resource. The provisioningState is to indicate states for resource provisioning. Possible values include: 'Creating', 'Succeeded', 'Updating', 'Deleting', 'Failed'
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
}
// MarshalJSON is the custom marshaler for ProjectProperties.
func (pp ProjectProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if pp.Description != nil {
objectMap["description"] = pp.Description
}
if pp.Gitrepo != nil {
objectMap["gitrepo"] = pp.Gitrepo
}
if pp.FriendlyName != nil {
objectMap["friendlyName"] = pp.FriendlyName
}
return json.Marshal(objectMap)
}
// ProjectPropertiesUpdateParameters the parameters for updating the properties of a project.
type ProjectPropertiesUpdateParameters struct {
// FriendlyName - The friendly name for this project.
FriendlyName *string `json:"friendlyName,omitempty"`
// Description - The description of this project.
Description *string `json:"description,omitempty"`
// Gitrepo - The reference to git repo for this project.
Gitrepo *string `json:"gitrepo,omitempty"`
}
// ProjectUpdateParameters the parameters for updating a machine learning project.
type ProjectUpdateParameters struct {
// Tags - The resource tags for the machine learning project.
Tags map[string]*string `json:"tags"`
// ProjectPropertiesUpdateParameters - The properties that the project will be updated with.
*ProjectPropertiesUpdateParameters `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for ProjectUpdateParameters.
func (pup ProjectUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if pup.Tags != nil {
objectMap["tags"] = pup.Tags
}
if pup.ProjectPropertiesUpdateParameters != nil {
objectMap["properties"] = pup.ProjectPropertiesUpdateParameters
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for ProjectUpdateParameters struct.
func (pup *ProjectUpdateParameters) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
pup.Tags = tags
}
case "properties":
if v != nil {
var projectPropertiesUpdateParameters ProjectPropertiesUpdateParameters
err = json.Unmarshal(*v, &projectPropertiesUpdateParameters)
if err != nil {
return err
}
pup.ProjectPropertiesUpdateParameters = &projectPropertiesUpdateParameters
}
}
}
return nil
}
// Resource an Azure resource.
type Resource struct {
// ID - READ-ONLY; The resource ID.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the resource.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of the resource.
Type *string `json:"type,omitempty"`
// Location - The location of the resource. This cannot be changed after the resource is created.
Location *string `json:"location,omitempty"`
// Tags - The tags of the resource.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Resource.
func (r Resource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if r.Location != nil {
objectMap["location"] = r.Location
}
if r.Tags != nil {
objectMap["tags"] = r.Tags
}
return json.Marshal(objectMap)
}
// StorageAccountProperties the properties of a storage account for a machine learning team account.
type StorageAccountProperties struct {
// StorageAccountID - The fully qualified arm Id of the storage account.
StorageAccountID *string `json:"storageAccountId,omitempty"`
// AccessKey - The access key to the storage account.
AccessKey *string `json:"accessKey,omitempty"`
}
// Workspace an object that represents a machine learning team account workspace.
type Workspace struct {
autorest.Response `json:"-"`
// WorkspaceProperties - The properties of the machine learning team account workspace.
*WorkspaceProperties `json:"properties,omitempty"`
// ID - READ-ONLY; The resource ID.
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; The name of the resource.
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; The type of the resource.
Type *string `json:"type,omitempty"`
// Location - The location of the resource. This cannot be changed after the resource is created.
Location *string `json:"location,omitempty"`
// Tags - The tags of the resource.
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Workspace.
func (w Workspace) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if w.WorkspaceProperties != nil {
objectMap["properties"] = w.WorkspaceProperties
}
if w.Location != nil {
objectMap["location"] = w.Location
}
if w.Tags != nil {
objectMap["tags"] = w.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Workspace struct.
func (w *Workspace) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var workspaceProperties WorkspaceProperties
err = json.Unmarshal(*v, &workspaceProperties)
if err != nil {
return err
}
w.WorkspaceProperties = &workspaceProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
w.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
w.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
w.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
w.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
w.Tags = tags
}
}
}
return nil
}
// WorkspaceListResult the result of a request to list machine learning team account workspaces.
type WorkspaceListResult struct {
autorest.Response `json:"-"`
// Value - The list of machine learning team account workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning team accounts.
Value *[]Workspace `json:"value,omitempty"`
// NextLink - The URI that can be used to request the next list of machine learning workspaces.
NextLink *string `json:"nextLink,omitempty"`
}
// WorkspaceListResultIterator provides access to a complete listing of Workspace values.
type WorkspaceListResultIterator struct {
i int
page WorkspaceListResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *WorkspaceListResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *WorkspaceListResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter WorkspaceListResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter WorkspaceListResultIterator) Response() WorkspaceListResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter WorkspaceListResultIterator) Value() Workspace {
if !iter.page.NotDone() {
return Workspace{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the WorkspaceListResultIterator type.
func NewWorkspaceListResultIterator(page WorkspaceListResultPage) WorkspaceListResultIterator {
return WorkspaceListResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (wlr WorkspaceListResult) IsEmpty() bool {
return wlr.Value == nil || len(*wlr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (wlr WorkspaceListResult) hasNextLink() bool {
return wlr.NextLink != nil && len(*wlr.NextLink) != 0
}
// workspaceListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (wlr WorkspaceListResult) workspaceListResultPreparer(ctx context.Context) (*http.Request, error) {
if !wlr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(wlr.NextLink)))
}
// WorkspaceListResultPage contains a page of Workspace values.
type WorkspaceListResultPage struct {
fn func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)
wlr WorkspaceListResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *WorkspaceListResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.wlr)
if err != nil {
return err
}
page.wlr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *WorkspaceListResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page WorkspaceListResultPage) NotDone() bool {
return !page.wlr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page WorkspaceListResultPage) Response() WorkspaceListResult {
return page.wlr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page WorkspaceListResultPage) Values() []Workspace {
if page.wlr.IsEmpty() {
return nil
}
return *page.wlr.Value
}
// Creates a new instance of the WorkspaceListResultPage type.
func NewWorkspaceListResultPage(cur WorkspaceListResult, getNextPage func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)) WorkspaceListResultPage {
return WorkspaceListResultPage{
fn: getNextPage,
wlr: cur,
}
}
// WorkspaceProperties the properties of a machine learning team account workspace.
type WorkspaceProperties struct {
// Description - The description of this workspace.
Description *string `json:"description,omitempty"`
// AccountID - READ-ONLY; The immutable id of the team account which contains this workspace.
AccountID *string `json:"accountId,omitempty"`
// WorkspaceID - READ-ONLY; The immutable id of this workspace.
WorkspaceID *string `json:"workspaceId,omitempty"`
// FriendlyName - The friendly name for this workspace. This will be the workspace name in the arm id when the workspace object gets created
FriendlyName *string `json:"friendlyName,omitempty"`
// CreationDate - READ-ONLY; The creation date of the machine learning workspace in ISO8601 format.
CreationDate *date.Time `json:"creationDate,omitempty"`
// ProvisioningState - READ-ONLY; The current deployment state of team account workspace resource. The provisioningState is to indicate states for resource provisioning. Possible values include: 'Creating', 'Succeeded', 'Updating', 'Deleting', 'Failed'
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
}
// MarshalJSON is the custom marshaler for WorkspaceProperties.
func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if wp.Description != nil {
objectMap["description"] = wp.Description
}
if wp.FriendlyName != nil {
objectMap["friendlyName"] = wp.FriendlyName
}
return json.Marshal(objectMap)
}
// WorkspacePropertiesUpdateParameters the parameters for updating the properties of a machine learning
// team account workspace.
type WorkspacePropertiesUpdateParameters struct {
// FriendlyName - Friendly name of this workspace.
FriendlyName *string `json:"friendlyName,omitempty"`
// Description - Description for this workspace.
Description *string `json:"description,omitempty"`
}
// WorkspaceUpdateParameters the parameters for updating a machine learning team account workspace.
type WorkspaceUpdateParameters struct {
// Tags - The resource tags for the machine learning team account workspace.
Tags map[string]*string `json:"tags"`
// WorkspacePropertiesUpdateParameters - The properties that the machine learning workspace will be updated with.
*WorkspacePropertiesUpdateParameters `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for WorkspaceUpdateParameters.
func (wup WorkspaceUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if wup.Tags != nil {
objectMap["tags"] = wup.Tags
}
if wup.WorkspacePropertiesUpdateParameters != nil {
objectMap["properties"] = wup.WorkspacePropertiesUpdateParameters
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for WorkspaceUpdateParameters struct.
func (wup *WorkspaceUpdateParameters) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
wup.Tags = tags
}
case "properties":
if v != nil {
var workspacePropertiesUpdateParameters WorkspacePropertiesUpdateParameters
err = json.Unmarshal(*v, &workspacePropertiesUpdateParameters)
if err != nil {
return err
}
wup.WorkspacePropertiesUpdateParameters = &workspacePropertiesUpdateParameters
}
}
}
return nil
}
|