diff --git a/profiles/preview/labservices/mgmt/ML/mlapi/models.go b/profiles/preview/labservices/mgmt/ML/mlapi/models.go new file mode 100644 index 000000000000..1af6bb891562 --- /dev/null +++ b/profiles/preview/labservices/mgmt/ML/mlapi/models.go @@ -0,0 +1,32 @@ +// +build go1.9 + +// Copyright 2018 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package mlapi + +import original "github.com/Azure/azure-sdk-for-go/services/labservices/mgmt/2018-10-15/ML/mlapi" + +type EnvironmentSettingsClientAPI = original.EnvironmentSettingsClientAPI +type EnvironmentsClientAPI = original.EnvironmentsClientAPI +type GalleryImagesClientAPI = original.GalleryImagesClientAPI +type GlobalUsersClientAPI = original.GlobalUsersClientAPI +type LabAccountsClientAPI = original.LabAccountsClientAPI +type LabsClientAPI = original.LabsClientAPI +type OperationsClientAPI = original.OperationsClientAPI +type ProviderOperationsClientAPI = original.ProviderOperationsClientAPI +type UsersClientAPI = original.UsersClientAPI diff --git a/profiles/preview/labservices/mgmt/ML/models.go b/profiles/preview/labservices/mgmt/ML/models.go new file mode 100644 index 000000000000..a33e772ea880 --- /dev/null +++ b/profiles/preview/labservices/mgmt/ML/models.go @@ -0,0 +1,314 @@ +// +build go1.9 + +// Copyright 2018 Microsoft Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package ml + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/labservices/mgmt/2018-10-15/ML" +) + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type AddRemove = original.AddRemove + +const ( + Add AddRemove = original.Add + Remove AddRemove = original.Remove +) + +type ConfigurationState = original.ConfigurationState + +const ( + Completed ConfigurationState = original.Completed + NotApplicable ConfigurationState = original.NotApplicable +) + +type LabUserAccessMode = original.LabUserAccessMode + +const ( + Open LabUserAccessMode = original.Open + Restricted LabUserAccessMode = original.Restricted +) + +type ManagedLabVMSize = original.ManagedLabVMSize + +const ( + Basic ManagedLabVMSize = original.Basic + Performance ManagedLabVMSize = original.Performance + Standard ManagedLabVMSize = original.Standard +) + +type PublishingState = original.PublishingState + +const ( + Draft PublishingState = original.Draft + Published PublishingState = original.Published + PublishFailed PublishingState = original.PublishFailed + Publishing PublishingState = original.Publishing + Scaling PublishingState = original.Scaling +) + +type AddUsersPayload = original.AddUsersPayload +type BaseClient = original.BaseClient +type CloudError = original.CloudError +type CloudErrorBody = original.CloudErrorBody +type CreateLabProperties = original.CreateLabProperties +type Environment = original.Environment +type EnvironmentDetails = original.EnvironmentDetails +type EnvironmentFragment = original.EnvironmentFragment +type EnvironmentOperationsPayload = original.EnvironmentOperationsPayload +type EnvironmentProperties = original.EnvironmentProperties +type EnvironmentPropertiesFragment = original.EnvironmentPropertiesFragment +type EnvironmentSetting = original.EnvironmentSetting +type EnvironmentSettingCreationParameters = original.EnvironmentSettingCreationParameters +type EnvironmentSettingFragment = original.EnvironmentSettingFragment +type EnvironmentSettingProperties = original.EnvironmentSettingProperties +type EnvironmentSettingPropertiesFragment = original.EnvironmentSettingPropertiesFragment +type EnvironmentSettingsClient = original.EnvironmentSettingsClient +type EnvironmentSettingsCreateOrUpdateFuture = original.EnvironmentSettingsCreateOrUpdateFuture +type EnvironmentSettingsDeleteFuture = original.EnvironmentSettingsDeleteFuture +type EnvironmentSettingsStartFuture = original.EnvironmentSettingsStartFuture +type EnvironmentSettingsStopFuture = original.EnvironmentSettingsStopFuture +type EnvironmentSize = original.EnvironmentSize +type EnvironmentSizeFragment = original.EnvironmentSizeFragment +type EnvironmentsClient = original.EnvironmentsClient +type EnvironmentsDeleteFuture = original.EnvironmentsDeleteFuture +type EnvironmentsResetPasswordFuture = original.EnvironmentsResetPasswordFuture +type EnvironmentsStartFuture = original.EnvironmentsStartFuture +type EnvironmentsStopFuture = original.EnvironmentsStopFuture +type GalleryImage = original.GalleryImage +type GalleryImageFragment = original.GalleryImageFragment +type GalleryImageProperties = original.GalleryImageProperties +type GalleryImagePropertiesFragment = original.GalleryImagePropertiesFragment +type GalleryImageReference = original.GalleryImageReference +type GalleryImageReferenceFragment = original.GalleryImageReferenceFragment +type GalleryImagesClient = original.GalleryImagesClient +type GetEnvironmentResponse = original.GetEnvironmentResponse +type GetPersonalPreferencesResponse = original.GetPersonalPreferencesResponse +type GetRegionalAvailabilityResponse = original.GetRegionalAvailabilityResponse +type GlobalUsersClient = original.GlobalUsersClient +type GlobalUsersResetPasswordFuture = original.GlobalUsersResetPasswordFuture +type GlobalUsersStartEnvironmentFuture = original.GlobalUsersStartEnvironmentFuture +type GlobalUsersStopEnvironmentFuture = original.GlobalUsersStopEnvironmentFuture +type Lab = original.Lab +type LabAccount = original.LabAccount +type LabAccountFragment = original.LabAccountFragment +type LabAccountProperties = original.LabAccountProperties +type LabAccountPropertiesFragment = original.LabAccountPropertiesFragment +type LabAccountsClient = original.LabAccountsClient +type LabAccountsDeleteFuture = original.LabAccountsDeleteFuture +type LabCreationParameters = original.LabCreationParameters +type LabDetails = original.LabDetails +type LabFragment = original.LabFragment +type LabProperties = original.LabProperties +type LabPropertiesFragment = original.LabPropertiesFragment +type LabsClient = original.LabsClient +type LabsDeleteFuture = original.LabsDeleteFuture +type LatestOperationResult = original.LatestOperationResult +type ListEnvironmentsPayload = original.ListEnvironmentsPayload +type ListEnvironmentsResponse = original.ListEnvironmentsResponse +type ListLabsResponse = original.ListLabsResponse +type NetworkInterface = original.NetworkInterface +type OperationBatchStatusPayload = original.OperationBatchStatusPayload +type OperationBatchStatusResponse = original.OperationBatchStatusResponse +type OperationBatchStatusResponseItem = original.OperationBatchStatusResponseItem +type OperationError = original.OperationError +type OperationMetadata = original.OperationMetadata +type OperationMetadataDisplay = original.OperationMetadataDisplay +type OperationResult = original.OperationResult +type OperationStatusPayload = original.OperationStatusPayload +type OperationStatusResponse = original.OperationStatusResponse +type OperationsClient = original.OperationsClient +type PersonalPerferencesOperationsPayload = original.PersonalPerferencesOperationsPayload +type ProviderOperationResult = original.ProviderOperationResult +type ProviderOperationResultIterator = original.ProviderOperationResultIterator +type ProviderOperationResultPage = original.ProviderOperationResultPage +type ProviderOperationsClient = original.ProviderOperationsClient +type PublishPayload = original.PublishPayload +type ReferenceVM = original.ReferenceVM +type ReferenceVMCreationParameters = original.ReferenceVMCreationParameters +type ReferenceVMFragment = original.ReferenceVMFragment +type RegionalAvailability = original.RegionalAvailability +type RegisterPayload = original.RegisterPayload +type ResetPasswordPayload = original.ResetPasswordPayload +type Resource = original.Resource +type ResourceSet = original.ResourceSet +type ResourceSetFragment = original.ResourceSetFragment +type ResourceSettingCreationParameters = original.ResourceSettingCreationParameters +type ResourceSettings = original.ResourceSettings +type ResourceSettingsFragment = original.ResourceSettingsFragment +type ResponseWithContinuationEnvironment = original.ResponseWithContinuationEnvironment +type ResponseWithContinuationEnvironmentIterator = original.ResponseWithContinuationEnvironmentIterator +type ResponseWithContinuationEnvironmentPage = original.ResponseWithContinuationEnvironmentPage +type ResponseWithContinuationEnvironmentSetting = original.ResponseWithContinuationEnvironmentSetting +type ResponseWithContinuationEnvironmentSettingIterator = original.ResponseWithContinuationEnvironmentSettingIterator +type ResponseWithContinuationEnvironmentSettingPage = original.ResponseWithContinuationEnvironmentSettingPage +type ResponseWithContinuationGalleryImage = original.ResponseWithContinuationGalleryImage +type ResponseWithContinuationGalleryImageIterator = original.ResponseWithContinuationGalleryImageIterator +type ResponseWithContinuationGalleryImagePage = original.ResponseWithContinuationGalleryImagePage +type ResponseWithContinuationLab = original.ResponseWithContinuationLab +type ResponseWithContinuationLabAccount = original.ResponseWithContinuationLabAccount +type ResponseWithContinuationLabAccountIterator = original.ResponseWithContinuationLabAccountIterator +type ResponseWithContinuationLabAccountPage = original.ResponseWithContinuationLabAccountPage +type ResponseWithContinuationLabIterator = original.ResponseWithContinuationLabIterator +type ResponseWithContinuationLabPage = original.ResponseWithContinuationLabPage +type ResponseWithContinuationUser = original.ResponseWithContinuationUser +type ResponseWithContinuationUserIterator = original.ResponseWithContinuationUserIterator +type ResponseWithContinuationUserPage = original.ResponseWithContinuationUserPage +type SizeAvailability = original.SizeAvailability +type SizeConfigurationProperties = original.SizeConfigurationProperties +type SizeConfigurationPropertiesFragment = original.SizeConfigurationPropertiesFragment +type SizeInfo = original.SizeInfo +type SizeInfoFragment = original.SizeInfoFragment +type User = original.User +type UserFragment = original.UserFragment +type UserProperties = original.UserProperties +type UserPropertiesFragment = original.UserPropertiesFragment +type UsersClient = original.UsersClient +type UsersDeleteFuture = original.UsersDeleteFuture +type VMStateDetails = original.VMStateDetails +type VirtualMachineDetails = original.VirtualMachineDetails + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewEnvironmentSettingsClient(subscriptionID string) EnvironmentSettingsClient { + return original.NewEnvironmentSettingsClient(subscriptionID) +} +func NewEnvironmentSettingsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentSettingsClient { + return original.NewEnvironmentSettingsClientWithBaseURI(baseURI, subscriptionID) +} +func NewEnvironmentsClient(subscriptionID string) EnvironmentsClient { + return original.NewEnvironmentsClient(subscriptionID) +} +func NewEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentsClient { + return original.NewEnvironmentsClientWithBaseURI(baseURI, subscriptionID) +} +func NewGalleryImagesClient(subscriptionID string) GalleryImagesClient { + return original.NewGalleryImagesClient(subscriptionID) +} +func NewGalleryImagesClientWithBaseURI(baseURI string, subscriptionID string) GalleryImagesClient { + return original.NewGalleryImagesClientWithBaseURI(baseURI, subscriptionID) +} +func NewGlobalUsersClient(subscriptionID string) GlobalUsersClient { + return original.NewGlobalUsersClient(subscriptionID) +} +func NewGlobalUsersClientWithBaseURI(baseURI string, subscriptionID string) GlobalUsersClient { + return original.NewGlobalUsersClientWithBaseURI(baseURI, subscriptionID) +} +func NewLabAccountsClient(subscriptionID string) LabAccountsClient { + return original.NewLabAccountsClient(subscriptionID) +} +func NewLabAccountsClientWithBaseURI(baseURI string, subscriptionID string) LabAccountsClient { + return original.NewLabAccountsClientWithBaseURI(baseURI, subscriptionID) +} +func NewLabsClient(subscriptionID string) LabsClient { + return original.NewLabsClient(subscriptionID) +} +func NewLabsClientWithBaseURI(baseURI string, subscriptionID string) LabsClient { + return original.NewLabsClientWithBaseURI(baseURI, subscriptionID) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewProviderOperationResultIterator(page ProviderOperationResultPage) ProviderOperationResultIterator { + return original.NewProviderOperationResultIterator(page) +} +func NewProviderOperationResultPage(getNextPage func(context.Context, ProviderOperationResult) (ProviderOperationResult, error)) ProviderOperationResultPage { + return original.NewProviderOperationResultPage(getNextPage) +} +func NewProviderOperationsClient(subscriptionID string) ProviderOperationsClient { + return original.NewProviderOperationsClient(subscriptionID) +} +func NewProviderOperationsClientWithBaseURI(baseURI string, subscriptionID string) ProviderOperationsClient { + return original.NewProviderOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewResponseWithContinuationEnvironmentIterator(page ResponseWithContinuationEnvironmentPage) ResponseWithContinuationEnvironmentIterator { + return original.NewResponseWithContinuationEnvironmentIterator(page) +} +func NewResponseWithContinuationEnvironmentPage(getNextPage func(context.Context, ResponseWithContinuationEnvironment) (ResponseWithContinuationEnvironment, error)) ResponseWithContinuationEnvironmentPage { + return original.NewResponseWithContinuationEnvironmentPage(getNextPage) +} +func NewResponseWithContinuationEnvironmentSettingIterator(page ResponseWithContinuationEnvironmentSettingPage) ResponseWithContinuationEnvironmentSettingIterator { + return original.NewResponseWithContinuationEnvironmentSettingIterator(page) +} +func NewResponseWithContinuationEnvironmentSettingPage(getNextPage func(context.Context, ResponseWithContinuationEnvironmentSetting) (ResponseWithContinuationEnvironmentSetting, error)) ResponseWithContinuationEnvironmentSettingPage { + return original.NewResponseWithContinuationEnvironmentSettingPage(getNextPage) +} +func NewResponseWithContinuationGalleryImageIterator(page ResponseWithContinuationGalleryImagePage) ResponseWithContinuationGalleryImageIterator { + return original.NewResponseWithContinuationGalleryImageIterator(page) +} +func NewResponseWithContinuationGalleryImagePage(getNextPage func(context.Context, ResponseWithContinuationGalleryImage) (ResponseWithContinuationGalleryImage, error)) ResponseWithContinuationGalleryImagePage { + return original.NewResponseWithContinuationGalleryImagePage(getNextPage) +} +func NewResponseWithContinuationLabAccountIterator(page ResponseWithContinuationLabAccountPage) ResponseWithContinuationLabAccountIterator { + return original.NewResponseWithContinuationLabAccountIterator(page) +} +func NewResponseWithContinuationLabAccountPage(getNextPage func(context.Context, ResponseWithContinuationLabAccount) (ResponseWithContinuationLabAccount, error)) ResponseWithContinuationLabAccountPage { + return original.NewResponseWithContinuationLabAccountPage(getNextPage) +} +func NewResponseWithContinuationLabIterator(page ResponseWithContinuationLabPage) ResponseWithContinuationLabIterator { + return original.NewResponseWithContinuationLabIterator(page) +} +func NewResponseWithContinuationLabPage(getNextPage func(context.Context, ResponseWithContinuationLab) (ResponseWithContinuationLab, error)) ResponseWithContinuationLabPage { + return original.NewResponseWithContinuationLabPage(getNextPage) +} +func NewResponseWithContinuationUserIterator(page ResponseWithContinuationUserPage) ResponseWithContinuationUserIterator { + return original.NewResponseWithContinuationUserIterator(page) +} +func NewResponseWithContinuationUserPage(getNextPage func(context.Context, ResponseWithContinuationUser) (ResponseWithContinuationUser, error)) ResponseWithContinuationUserPage { + return original.NewResponseWithContinuationUserPage(getNextPage) +} +func NewUsersClient(subscriptionID string) UsersClient { + return original.NewUsersClient(subscriptionID) +} +func NewUsersClientWithBaseURI(baseURI string, subscriptionID string) UsersClient { + return original.NewUsersClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func PossibleAddRemoveValues() []AddRemove { + return original.PossibleAddRemoveValues() +} +func PossibleConfigurationStateValues() []ConfigurationState { + return original.PossibleConfigurationStateValues() +} +func PossibleLabUserAccessModeValues() []LabUserAccessMode { + return original.PossibleLabUserAccessModeValues() +} +func PossibleManagedLabVMSizeValues() []ManagedLabVMSize { + return original.PossibleManagedLabVMSizeValues() +} +func PossiblePublishingStateValues() []PublishingState { + return original.PossiblePublishingStateValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/services/labservices/mgmt/2018-10-15/ML/client.go b/services/labservices/mgmt/2018-10-15/ML/client.go new file mode 100644 index 000000000000..f6964e1947f5 --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/client.go @@ -0,0 +1,51 @@ +// Package ml implements the Azure ARM Ml service API version 2018-10-15. +// +// The Managed Labs Client. +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Ml + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Ml. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/labservices/mgmt/2018-10-15/ML/environments.go b/services/labservices/mgmt/2018-10-15/ML/environments.go new file mode 100644 index 000000000000..33defd631ab4 --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/environments.go @@ -0,0 +1,863 @@ +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EnvironmentsClient is the the Managed Labs Client. +type EnvironmentsClient struct { + BaseClient +} + +// NewEnvironmentsClient creates an instance of the EnvironmentsClient client. +func NewEnvironmentsClient(subscriptionID string) EnvironmentsClient { + return NewEnvironmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEnvironmentsClientWithBaseURI creates an instance of the EnvironmentsClient client. +func NewEnvironmentsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentsClient { + return EnvironmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Claim claims the environment and assigns it to the user +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// environmentName - the name of the environment. +func (client EnvironmentsClient) Claim(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.Claim") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ClaimPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, environmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Claim", nil, "Failure preparing request") + return + } + + resp, err := client.ClaimSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Claim", resp, "Failure sending request") + return + } + + result, err = client.ClaimResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Claim", resp, "Failure responding to request") + } + + return +} + +// ClaimPreparer prepares the Claim request. +func (client EnvironmentsClient) ClaimPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/claim", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ClaimSender sends the Claim request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) ClaimSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ClaimResponder handles the response to the Claim request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) ClaimResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or replace an existing Environment. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// environmentName - the name of the environment. +// environment - represents an environment instance +func (client EnvironmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, environment Environment) (result Environment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: environment, + Constraints: []validation.Constraint{{Target: "environment.EnvironmentProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("ml.EnvironmentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EnvironmentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, environment Environment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}", pathParameters), + autorest.WithJSON(environment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) CreateOrUpdateResponder(resp *http.Response) (result Environment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete environment. This operation can take a while to complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// environmentName - the name of the environment. +func (client EnvironmentsClient) Delete(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (result EnvironmentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, environmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EnvironmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) DeleteSender(req *http.Request) (future EnvironmentsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get environment +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// environmentName - the name of the environment. +// expand - specify the $expand query. Example: 'properties($expand=networkInterface)' +func (client EnvironmentsClient) Get(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, expand string) (result Environment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client EnvironmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) GetResponder(resp *http.Response) (result Environment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list environments in a given environment setting. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// expand - specify the $expand query. Example: 'properties($expand=networkInterface)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client EnvironmentsClient) List(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationEnvironmentPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.List") + defer func() { + sc := -1 + if result.rwce.Response.Response != nil { + sc = result.rwce.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwce.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "List", resp, "Failure sending request") + return + } + + result.rwce, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client EnvironmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationEnvironment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EnvironmentsClient) listNextResults(ctx context.Context, lastResults ResponseWithContinuationEnvironment) (result ResponseWithContinuationEnvironment, err error) { + req, err := lastResults.responseWithContinuationEnvironmentPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EnvironmentsClient) ListComplete(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationEnvironmentIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, expand, filter, top, orderby) + return +} + +// ResetPassword resets the user password on an environment This operation can take a while to complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// environmentName - the name of the environment. +// resetPasswordPayload - represents the payload for resetting passwords. +func (client EnvironmentsClient) ResetPassword(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, resetPasswordPayload ResetPasswordPayload) (result EnvironmentsResetPasswordFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.ResetPassword") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resetPasswordPayload, + Constraints: []validation.Constraint{{Target: "resetPasswordPayload.EnvironmentID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("ml.EnvironmentsClient", "ResetPassword", err.Error()) + } + + req, err := client.ResetPasswordPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "ResetPassword", nil, "Failure preparing request") + return + } + + result, err = client.ResetPasswordSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "ResetPassword", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetPasswordPreparer prepares the ResetPassword request. +func (client EnvironmentsClient) ResetPasswordPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, resetPasswordPayload ResetPasswordPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/resetPassword", pathParameters), + autorest.WithJSON(resetPasswordPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetPasswordSender sends the ResetPassword request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) ResetPasswordSender(req *http.Request) (future EnvironmentsResetPasswordFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ResetPasswordResponder handles the response to the ResetPassword request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) ResetPasswordResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start starts an environment by starting all resources inside the environment. This operation can take a while to +// complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// environmentName - the name of the environment. +func (client EnvironmentsClient) Start(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (result EnvironmentsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.Start") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, environmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client EnvironmentsClient) StartPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) StartSender(req *http.Request) (future EnvironmentsStartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stops an environment by stopping all resources inside the environment This operation can take a while to +// complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// environmentName - the name of the environment. +func (client EnvironmentsClient) Stop(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (result EnvironmentsStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.Stop") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, environmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client EnvironmentsClient) StopPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) StopSender(req *http.Request) (future EnvironmentsStopFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update modify properties of environments. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// environmentName - the name of the environment. +// environment - represents an environment instance +func (client EnvironmentsClient) Update(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, environment EnvironmentFragment) (result Environment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, environment) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client EnvironmentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, environment EnvironmentFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentName": autorest.Encode("path", environmentName), + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/environments/{environmentName}", pathParameters), + autorest.WithJSON(environment), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client EnvironmentsClient) UpdateResponder(resp *http.Response) (result Environment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/labservices/mgmt/2018-10-15/ML/environmentsettings.go b/services/labservices/mgmt/2018-10-15/ML/environmentsettings.go new file mode 100644 index 000000000000..a9ae72d6f311 --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/environmentsettings.go @@ -0,0 +1,845 @@ +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// EnvironmentSettingsClient is the the Managed Labs Client. +type EnvironmentSettingsClient struct { + BaseClient +} + +// NewEnvironmentSettingsClient creates an instance of the EnvironmentSettingsClient client. +func NewEnvironmentSettingsClient(subscriptionID string) EnvironmentSettingsClient { + return NewEnvironmentSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEnvironmentSettingsClientWithBaseURI creates an instance of the EnvironmentSettingsClient client. +func NewEnvironmentSettingsClientWithBaseURI(baseURI string, subscriptionID string) EnvironmentSettingsClient { + return EnvironmentSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ClaimAny claims a random environment for a user in an environment settings +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +func (client EnvironmentSettingsClient) ClaimAny(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSettingsClient.ClaimAny") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ClaimAnyPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "ClaimAny", nil, "Failure preparing request") + return + } + + resp, err := client.ClaimAnySender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "ClaimAny", resp, "Failure sending request") + return + } + + result, err = client.ClaimAnyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "ClaimAny", resp, "Failure responding to request") + } + + return +} + +// ClaimAnyPreparer prepares the ClaimAny request. +func (client EnvironmentSettingsClient) ClaimAnyPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/claimAny", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ClaimAnySender sends the ClaimAny request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSettingsClient) ClaimAnySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ClaimAnyResponder handles the response to the ClaimAny request. The method always +// closes the http.Response Body. +func (client EnvironmentSettingsClient) ClaimAnyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or replace an existing Environment Setting. This operation can take a while to complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// environmentSetting - represents settings of an environment, from which environment instances would be +// created +func (client EnvironmentSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentSetting EnvironmentSetting) (result EnvironmentSettingsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSettingsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: environmentSetting, + Constraints: []validation.Constraint{{Target: "environmentSetting.EnvironmentSettingProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "environmentSetting.EnvironmentSettingProperties.ResourceSettings", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "environmentSetting.EnvironmentSettingProperties.ResourceSettings.ReferenceVM", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "environmentSetting.EnvironmentSettingProperties.ResourceSettings.ReferenceVM.UserName", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("ml.EnvironmentSettingsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EnvironmentSettingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentSetting EnvironmentSetting) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}", pathParameters), + autorest.WithJSON(environmentSetting), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSettingsClient) CreateOrUpdateSender(req *http.Request) (future EnvironmentSettingsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client EnvironmentSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result EnvironmentSetting, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete environment setting. This operation can take a while to complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +func (client EnvironmentSettingsClient) Delete(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (result EnvironmentSettingsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSettingsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EnvironmentSettingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSettingsClient) DeleteSender(req *http.Request) (future EnvironmentSettingsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EnvironmentSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get environment setting +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// expand - specify the $expand query. Example: 'properties($select=publishingState)' +func (client EnvironmentSettingsClient) Get(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, expand string) (result EnvironmentSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSettingsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client EnvironmentSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EnvironmentSettingsClient) GetResponder(resp *http.Response) (result EnvironmentSetting, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list environment setting in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=publishingState)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client EnvironmentSettingsClient) List(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationEnvironmentSettingPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSettingsClient.List") + defer func() { + sc := -1 + if result.rwces.Response.Response != nil { + sc = result.rwces.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labAccountName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwces.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "List", resp, "Failure sending request") + return + } + + result.rwces, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client EnvironmentSettingsClient) ListPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSettingsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EnvironmentSettingsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationEnvironmentSetting, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EnvironmentSettingsClient) listNextResults(ctx context.Context, lastResults ResponseWithContinuationEnvironmentSetting) (result ResponseWithContinuationEnvironmentSetting, err error) { + req, err := lastResults.responseWithContinuationEnvironmentSettingPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EnvironmentSettingsClient) ListComplete(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationEnvironmentSettingIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSettingsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, labAccountName, labName, expand, filter, top, orderby) + return +} + +// Publish provisions/deprovisions required resources for an environment setting based on current state of the +// lab/environment setting. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// publishPayload - payload for Publish operation on EnvironmentSetting. +func (client EnvironmentSettingsClient) Publish(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, publishPayload PublishPayload) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSettingsClient.Publish") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PublishPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, publishPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Publish", nil, "Failure preparing request") + return + } + + resp, err := client.PublishSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Publish", resp, "Failure sending request") + return + } + + result, err = client.PublishResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Publish", resp, "Failure responding to request") + } + + return +} + +// PublishPreparer prepares the Publish request. +func (client EnvironmentSettingsClient) PublishPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, publishPayload PublishPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/publish", pathParameters), + autorest.WithJSON(publishPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PublishSender sends the Publish request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSettingsClient) PublishSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// PublishResponder handles the response to the Publish request. The method always +// closes the http.Response Body. +func (client EnvironmentSettingsClient) PublishResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start starts a template by starting all resources inside the template. This operation can take a while to complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +func (client EnvironmentSettingsClient) Start(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (result EnvironmentSettingsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSettingsClient.Start") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client EnvironmentSettingsClient) StartPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSettingsClient) StartSender(req *http.Request) (future EnvironmentSettingsStartFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client EnvironmentSettingsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop starts a template by starting all resources inside the template. This operation can take a while to complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +func (client EnvironmentSettingsClient) Stop(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (result EnvironmentSettingsStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSettingsClient.Stop") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client EnvironmentSettingsClient) StopPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSettingsClient) StopSender(req *http.Request) (future EnvironmentSettingsStopFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client EnvironmentSettingsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update modify properties of environment setting. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// environmentSettingName - the name of the environment Setting. +// environmentSetting - represents settings of an environment, from which environment instances would be +// created +func (client EnvironmentSettingsClient) Update(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentSetting EnvironmentSettingFragment) (result EnvironmentSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnvironmentSettingsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, labAccountName, labName, environmentSettingName, environmentSetting) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client EnvironmentSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentSetting EnvironmentSettingFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "environmentSettingName": autorest.Encode("path", environmentSettingName), + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/environmentsettings/{environmentSettingName}", pathParameters), + autorest.WithJSON(environmentSetting), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client EnvironmentSettingsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client EnvironmentSettingsClient) UpdateResponder(resp *http.Response) (result EnvironmentSetting, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/labservices/mgmt/2018-10-15/ML/galleryimages.go b/services/labservices/mgmt/2018-10-15/ML/galleryimages.go new file mode 100644 index 000000000000..248e73893c37 --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/galleryimages.go @@ -0,0 +1,497 @@ +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// GalleryImagesClient is the the Managed Labs Client. +type GalleryImagesClient struct { + BaseClient +} + +// NewGalleryImagesClient creates an instance of the GalleryImagesClient client. +func NewGalleryImagesClient(subscriptionID string) GalleryImagesClient { + return NewGalleryImagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGalleryImagesClientWithBaseURI creates an instance of the GalleryImagesClient client. +func NewGalleryImagesClientWithBaseURI(baseURI string, subscriptionID string) GalleryImagesClient { + return GalleryImagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing Gallery Image. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// galleryImageName - the name of the gallery Image. +// galleryImage - represents an image from the Azure Marketplace +func (client GalleryImagesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string, galleryImage GalleryImage) (result GalleryImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labAccountName, galleryImageName, galleryImage) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GalleryImagesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string, galleryImage GalleryImage) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}", pathParameters), + autorest.WithJSON(galleryImage), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) CreateOrUpdateResponder(resp *http.Response) (result GalleryImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete gallery image. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// galleryImageName - the name of the gallery Image. +func (client GalleryImagesClient) Delete(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, labAccountName, galleryImageName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GalleryImagesClient) DeletePreparer(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get gallery image +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// galleryImageName - the name of the gallery Image. +// expand - specify the $expand query. Example: 'properties($select=author)' +func (client GalleryImagesClient) Get(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string, expand string) (result GalleryImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, labAccountName, galleryImageName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client GalleryImagesClient) GetPreparer(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) GetResponder(resp *http.Response) (result GalleryImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list gallery images in a given lab account. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// expand - specify the $expand query. Example: 'properties($select=author)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client GalleryImagesClient) List(ctx context.Context, resourceGroupName string, labAccountName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationGalleryImagePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.List") + defer func() { + sc := -1 + if result.rwcgi.Response.Response != nil { + sc = result.rwcgi.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labAccountName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcgi.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "List", resp, "Failure sending request") + return + } + + result.rwcgi, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client GalleryImagesClient) ListPreparer(ctx context.Context, resourceGroupName string, labAccountName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) ListResponder(resp *http.Response) (result ResponseWithContinuationGalleryImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client GalleryImagesClient) listNextResults(ctx context.Context, lastResults ResponseWithContinuationGalleryImage) (result ResponseWithContinuationGalleryImage, err error) { + req, err := lastResults.responseWithContinuationGalleryImagePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client GalleryImagesClient) ListComplete(ctx context.Context, resourceGroupName string, labAccountName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationGalleryImageIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, labAccountName, expand, filter, top, orderby) + return +} + +// Update modify properties of gallery images. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// galleryImageName - the name of the gallery Image. +// galleryImage - represents an image from the Azure Marketplace +func (client GalleryImagesClient) Update(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string, galleryImage GalleryImageFragment) (result GalleryImage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GalleryImagesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, labAccountName, galleryImageName, galleryImage) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GalleryImagesClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client GalleryImagesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string, galleryImage GalleryImageFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "galleryImageName": autorest.Encode("path", galleryImageName), + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}", pathParameters), + autorest.WithJSON(galleryImage), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client GalleryImagesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client GalleryImagesClient) UpdateResponder(resp *http.Response) (result GalleryImage, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/labservices/mgmt/2018-10-15/ML/globalusers.go b/services/labservices/mgmt/2018-10-15/ML/globalusers.go new file mode 100644 index 000000000000..f8ad11ea2e75 --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/globalusers.go @@ -0,0 +1,851 @@ +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// GlobalUsersClient is the the Managed Labs Client. +type GlobalUsersClient struct { + BaseClient +} + +// NewGlobalUsersClient creates an instance of the GlobalUsersClient client. +func NewGlobalUsersClient(subscriptionID string) GlobalUsersClient { + return NewGlobalUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGlobalUsersClientWithBaseURI creates an instance of the GlobalUsersClient client. +func NewGlobalUsersClientWithBaseURI(baseURI string, subscriptionID string) GlobalUsersClient { + return GlobalUsersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetEnvironment gets the virtual machine details +// Parameters: +// userName - the name of the user. +// environmentOperationsPayload - represents payload for any Environment operations like get, start, stop, +// connect +// expand - specify the $expand query. Example: 'properties($expand=environment)' +func (client GlobalUsersClient) GetEnvironment(ctx context.Context, userName string, environmentOperationsPayload EnvironmentOperationsPayload, expand string) (result GetEnvironmentResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalUsersClient.GetEnvironment") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: environmentOperationsPayload, + Constraints: []validation.Constraint{{Target: "environmentOperationsPayload.EnvironmentID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("ml.GlobalUsersClient", "GetEnvironment", err.Error()) + } + + req, err := client.GetEnvironmentPreparer(ctx, userName, environmentOperationsPayload, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetEnvironment", nil, "Failure preparing request") + return + } + + resp, err := client.GetEnvironmentSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetEnvironment", resp, "Failure sending request") + return + } + + result, err = client.GetEnvironmentResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetEnvironment", resp, "Failure responding to request") + } + + return +} + +// GetEnvironmentPreparer prepares the GetEnvironment request. +func (client GlobalUsersClient) GetEnvironmentPreparer(ctx context.Context, userName string, environmentOperationsPayload EnvironmentOperationsPayload, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.LabServices/users/{userName}/getEnvironment", pathParameters), + autorest.WithJSON(environmentOperationsPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetEnvironmentSender sends the GetEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalUsersClient) GetEnvironmentSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetEnvironmentResponder handles the response to the GetEnvironment request. The method always +// closes the http.Response Body. +func (client GlobalUsersClient) GetEnvironmentResponder(resp *http.Response) (result GetEnvironmentResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOperationBatchStatus get batch operation status +// Parameters: +// userName - the name of the user. +// operationBatchStatusPayload - payload to get the status of an operation +func (client GlobalUsersClient) GetOperationBatchStatus(ctx context.Context, userName string, operationBatchStatusPayload OperationBatchStatusPayload) (result OperationBatchStatusResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalUsersClient.GetOperationBatchStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: operationBatchStatusPayload, + Constraints: []validation.Constraint{{Target: "operationBatchStatusPayload.Urls", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("ml.GlobalUsersClient", "GetOperationBatchStatus", err.Error()) + } + + req, err := client.GetOperationBatchStatusPreparer(ctx, userName, operationBatchStatusPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetOperationBatchStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetOperationBatchStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetOperationBatchStatus", resp, "Failure sending request") + return + } + + result, err = client.GetOperationBatchStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetOperationBatchStatus", resp, "Failure responding to request") + } + + return +} + +// GetOperationBatchStatusPreparer prepares the GetOperationBatchStatus request. +func (client GlobalUsersClient) GetOperationBatchStatusPreparer(ctx context.Context, userName string, operationBatchStatusPayload OperationBatchStatusPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.LabServices/users/{userName}/getOperationBatchStatus", pathParameters), + autorest.WithJSON(operationBatchStatusPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOperationBatchStatusSender sends the GetOperationBatchStatus request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalUsersClient) GetOperationBatchStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetOperationBatchStatusResponder handles the response to the GetOperationBatchStatus request. The method always +// closes the http.Response Body. +func (client GlobalUsersClient) GetOperationBatchStatusResponder(resp *http.Response) (result OperationBatchStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOperationStatus gets the status of long running operation +// Parameters: +// userName - the name of the user. +// operationStatusPayload - payload to get the status of an operation +func (client GlobalUsersClient) GetOperationStatus(ctx context.Context, userName string, operationStatusPayload OperationStatusPayload) (result OperationStatusResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalUsersClient.GetOperationStatus") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: operationStatusPayload, + Constraints: []validation.Constraint{{Target: "operationStatusPayload.OperationURL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("ml.GlobalUsersClient", "GetOperationStatus", err.Error()) + } + + req, err := client.GetOperationStatusPreparer(ctx, userName, operationStatusPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetOperationStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetOperationStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetOperationStatus", resp, "Failure sending request") + return + } + + result, err = client.GetOperationStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetOperationStatus", resp, "Failure responding to request") + } + + return +} + +// GetOperationStatusPreparer prepares the GetOperationStatus request. +func (client GlobalUsersClient) GetOperationStatusPreparer(ctx context.Context, userName string, operationStatusPayload OperationStatusPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.LabServices/users/{userName}/getOperationStatus", pathParameters), + autorest.WithJSON(operationStatusPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOperationStatusSender sends the GetOperationStatus request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalUsersClient) GetOperationStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetOperationStatusResponder handles the response to the GetOperationStatus request. The method always +// closes the http.Response Body. +func (client GlobalUsersClient) GetOperationStatusResponder(resp *http.Response) (result OperationStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPersonalPreferences get personal preferences for a user +// Parameters: +// userName - the name of the user. +// personalPerferencesOperationsPayload - represents payload for any Environment operations like get, start, +// stop, connect +func (client GlobalUsersClient) GetPersonalPreferences(ctx context.Context, userName string, personalPerferencesOperationsPayload PersonalPerferencesOperationsPayload) (result GetPersonalPreferencesResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalUsersClient.GetPersonalPreferences") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPersonalPreferencesPreparer(ctx, userName, personalPerferencesOperationsPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetPersonalPreferences", nil, "Failure preparing request") + return + } + + resp, err := client.GetPersonalPreferencesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetPersonalPreferences", resp, "Failure sending request") + return + } + + result, err = client.GetPersonalPreferencesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "GetPersonalPreferences", resp, "Failure responding to request") + } + + return +} + +// GetPersonalPreferencesPreparer prepares the GetPersonalPreferences request. +func (client GlobalUsersClient) GetPersonalPreferencesPreparer(ctx context.Context, userName string, personalPerferencesOperationsPayload PersonalPerferencesOperationsPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.LabServices/users/{userName}/getPersonalPreferences", pathParameters), + autorest.WithJSON(personalPerferencesOperationsPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPersonalPreferencesSender sends the GetPersonalPreferences request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalUsersClient) GetPersonalPreferencesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetPersonalPreferencesResponder handles the response to the GetPersonalPreferences request. The method always +// closes the http.Response Body. +func (client GlobalUsersClient) GetPersonalPreferencesResponder(resp *http.Response) (result GetPersonalPreferencesResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListEnvironments list Environments for the user +// Parameters: +// userName - the name of the user. +// listEnvironmentsPayload - represents the payload to list environments owned by a user +func (client GlobalUsersClient) ListEnvironments(ctx context.Context, userName string, listEnvironmentsPayload ListEnvironmentsPayload) (result ListEnvironmentsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalUsersClient.ListEnvironments") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListEnvironmentsPreparer(ctx, userName, listEnvironmentsPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "ListEnvironments", nil, "Failure preparing request") + return + } + + resp, err := client.ListEnvironmentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "ListEnvironments", resp, "Failure sending request") + return + } + + result, err = client.ListEnvironmentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "ListEnvironments", resp, "Failure responding to request") + } + + return +} + +// ListEnvironmentsPreparer prepares the ListEnvironments request. +func (client GlobalUsersClient) ListEnvironmentsPreparer(ctx context.Context, userName string, listEnvironmentsPayload ListEnvironmentsPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.LabServices/users/{userName}/listEnvironments", pathParameters), + autorest.WithJSON(listEnvironmentsPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEnvironmentsSender sends the ListEnvironments request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalUsersClient) ListEnvironmentsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListEnvironmentsResponder handles the response to the ListEnvironments request. The method always +// closes the http.Response Body. +func (client GlobalUsersClient) ListEnvironmentsResponder(resp *http.Response) (result ListEnvironmentsResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListLabs list labs for the user. +// Parameters: +// userName - the name of the user. +func (client GlobalUsersClient) ListLabs(ctx context.Context, userName string) (result ListLabsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalUsersClient.ListLabs") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListLabsPreparer(ctx, userName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "ListLabs", nil, "Failure preparing request") + return + } + + resp, err := client.ListLabsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "ListLabs", resp, "Failure sending request") + return + } + + result, err = client.ListLabsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "ListLabs", resp, "Failure responding to request") + } + + return +} + +// ListLabsPreparer prepares the ListLabs request. +func (client GlobalUsersClient) ListLabsPreparer(ctx context.Context, userName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.LabServices/users/{userName}/listLabs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListLabsSender sends the ListLabs request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalUsersClient) ListLabsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListLabsResponder handles the response to the ListLabs request. The method always +// closes the http.Response Body. +func (client GlobalUsersClient) ListLabsResponder(resp *http.Response) (result ListLabsResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Register register a user to a managed lab +// Parameters: +// userName - the name of the user. +// registerPayload - represents payload for Register action. +func (client GlobalUsersClient) Register(ctx context.Context, userName string, registerPayload RegisterPayload) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalUsersClient.Register") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RegisterPreparer(ctx, userName, registerPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "Register", nil, "Failure preparing request") + return + } + + resp, err := client.RegisterSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "Register", resp, "Failure sending request") + return + } + + result, err = client.RegisterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "Register", resp, "Failure responding to request") + } + + return +} + +// RegisterPreparer prepares the Register request. +func (client GlobalUsersClient) RegisterPreparer(ctx context.Context, userName string, registerPayload RegisterPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.LabServices/users/{userName}/register", pathParameters), + autorest.WithJSON(registerPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegisterSender sends the Register request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalUsersClient) RegisterSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// RegisterResponder handles the response to the Register request. The method always +// closes the http.Response Body. +func (client GlobalUsersClient) RegisterResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetPassword resets the user password on an environment This operation can take a while to complete +// Parameters: +// userName - the name of the user. +// resetPasswordPayload - represents the payload for resetting passwords. +func (client GlobalUsersClient) ResetPassword(ctx context.Context, userName string, resetPasswordPayload ResetPasswordPayload) (result GlobalUsersResetPasswordFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalUsersClient.ResetPassword") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resetPasswordPayload, + Constraints: []validation.Constraint{{Target: "resetPasswordPayload.EnvironmentID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("ml.GlobalUsersClient", "ResetPassword", err.Error()) + } + + req, err := client.ResetPasswordPreparer(ctx, userName, resetPasswordPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "ResetPassword", nil, "Failure preparing request") + return + } + + result, err = client.ResetPasswordSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "ResetPassword", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetPasswordPreparer prepares the ResetPassword request. +func (client GlobalUsersClient) ResetPasswordPreparer(ctx context.Context, userName string, resetPasswordPayload ResetPasswordPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.LabServices/users/{userName}/resetPassword", pathParameters), + autorest.WithJSON(resetPasswordPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetPasswordSender sends the ResetPassword request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalUsersClient) ResetPasswordSender(req *http.Request) (future GlobalUsersResetPasswordFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// ResetPasswordResponder handles the response to the ResetPassword request. The method always +// closes the http.Response Body. +func (client GlobalUsersClient) ResetPasswordResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartEnvironment starts an environment by starting all resources inside the environment. This operation can take a +// while to complete +// Parameters: +// userName - the name of the user. +// environmentOperationsPayload - represents payload for any Environment operations like get, start, stop, +// connect +func (client GlobalUsersClient) StartEnvironment(ctx context.Context, userName string, environmentOperationsPayload EnvironmentOperationsPayload) (result GlobalUsersStartEnvironmentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalUsersClient.StartEnvironment") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: environmentOperationsPayload, + Constraints: []validation.Constraint{{Target: "environmentOperationsPayload.EnvironmentID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("ml.GlobalUsersClient", "StartEnvironment", err.Error()) + } + + req, err := client.StartEnvironmentPreparer(ctx, userName, environmentOperationsPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "StartEnvironment", nil, "Failure preparing request") + return + } + + result, err = client.StartEnvironmentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "StartEnvironment", result.Response(), "Failure sending request") + return + } + + return +} + +// StartEnvironmentPreparer prepares the StartEnvironment request. +func (client GlobalUsersClient) StartEnvironmentPreparer(ctx context.Context, userName string, environmentOperationsPayload EnvironmentOperationsPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.LabServices/users/{userName}/startEnvironment", pathParameters), + autorest.WithJSON(environmentOperationsPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartEnvironmentSender sends the StartEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalUsersClient) StartEnvironmentSender(req *http.Request) (future GlobalUsersStartEnvironmentFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StartEnvironmentResponder handles the response to the StartEnvironment request. The method always +// closes the http.Response Body. +func (client GlobalUsersClient) StartEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// StopEnvironment stops an environment by stopping all resources inside the environment This operation can take a +// while to complete +// Parameters: +// userName - the name of the user. +// environmentOperationsPayload - represents payload for any Environment operations like get, start, stop, +// connect +func (client GlobalUsersClient) StopEnvironment(ctx context.Context, userName string, environmentOperationsPayload EnvironmentOperationsPayload) (result GlobalUsersStopEnvironmentFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GlobalUsersClient.StopEnvironment") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: environmentOperationsPayload, + Constraints: []validation.Constraint{{Target: "environmentOperationsPayload.EnvironmentID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("ml.GlobalUsersClient", "StopEnvironment", err.Error()) + } + + req, err := client.StopEnvironmentPreparer(ctx, userName, environmentOperationsPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "StopEnvironment", nil, "Failure preparing request") + return + } + + result, err = client.StopEnvironmentSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersClient", "StopEnvironment", result.Response(), "Failure sending request") + return + } + + return +} + +// StopEnvironmentPreparer prepares the StopEnvironment request. +func (client GlobalUsersClient) StopEnvironmentPreparer(ctx context.Context, userName string, environmentOperationsPayload EnvironmentOperationsPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.LabServices/users/{userName}/stopEnvironment", pathParameters), + autorest.WithJSON(environmentOperationsPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopEnvironmentSender sends the StopEnvironment request. The method will close the +// http.Response Body if it receives an error. +func (client GlobalUsersClient) StopEnvironmentSender(req *http.Request) (future GlobalUsersStopEnvironmentFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// StopEnvironmentResponder handles the response to the StopEnvironment request. The method always +// closes the http.Response Body. +func (client GlobalUsersClient) StopEnvironmentResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/labservices/mgmt/2018-10-15/ML/labaccounts.go b/services/labservices/mgmt/2018-10-15/ML/labaccounts.go new file mode 100644 index 000000000000..ba61e549c2c9 --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/labaccounts.go @@ -0,0 +1,787 @@ +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LabAccountsClient is the the Managed Labs Client. +type LabAccountsClient struct { + BaseClient +} + +// NewLabAccountsClient creates an instance of the LabAccountsClient client. +func NewLabAccountsClient(subscriptionID string) LabAccountsClient { + return NewLabAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLabAccountsClientWithBaseURI creates an instance of the LabAccountsClient client. +func NewLabAccountsClientWithBaseURI(baseURI string, subscriptionID string) LabAccountsClient { + return LabAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateLab create a lab in a lab account. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// createLabProperties - properties for creating a managed lab and a default environment setting +func (client LabAccountsClient) CreateLab(ctx context.Context, resourceGroupName string, labAccountName string, createLabProperties CreateLabProperties) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabAccountsClient.CreateLab") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: createLabProperties, + Constraints: []validation.Constraint{{Target: "createLabProperties.EnvironmentSettingCreationParameters", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "createLabProperties.EnvironmentSettingCreationParameters.ResourceSettingCreationParameters", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "createLabProperties.EnvironmentSettingCreationParameters.ResourceSettingCreationParameters.GalleryImageResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "createLabProperties.EnvironmentSettingCreationParameters.ResourceSettingCreationParameters.ReferenceVMCreationParameters", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "createLabProperties.EnvironmentSettingCreationParameters.ResourceSettingCreationParameters.ReferenceVMCreationParameters.UserName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "createLabProperties.EnvironmentSettingCreationParameters.ResourceSettingCreationParameters.ReferenceVMCreationParameters.Password", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + {Target: "createLabProperties.LabCreationParameters", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "createLabProperties.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("ml.LabAccountsClient", "CreateLab", err.Error()) + } + + req, err := client.CreateLabPreparer(ctx, resourceGroupName, labAccountName, createLabProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "CreateLab", nil, "Failure preparing request") + return + } + + resp, err := client.CreateLabSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "CreateLab", resp, "Failure sending request") + return + } + + result, err = client.CreateLabResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "CreateLab", resp, "Failure responding to request") + } + + return +} + +// CreateLabPreparer prepares the CreateLab request. +func (client LabAccountsClient) CreateLabPreparer(ctx context.Context, resourceGroupName string, labAccountName string, createLabProperties CreateLabProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/createLab", pathParameters), + autorest.WithJSON(createLabProperties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateLabSender sends the CreateLab request. The method will close the +// http.Response Body if it receives an error. +func (client LabAccountsClient) CreateLabSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateLabResponder handles the response to the CreateLab request. The method always +// closes the http.Response Body. +func (client LabAccountsClient) CreateLabResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or replace an existing Lab Account. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labAccount - represents a lab account. +func (client LabAccountsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, labAccount LabAccount) (result LabAccount, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabAccountsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labAccountName, labAccount) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LabAccountsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labAccount LabAccount) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}", pathParameters), + autorest.WithJSON(labAccount), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LabAccountsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LabAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result LabAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete lab account. This operation can take a while to complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +func (client LabAccountsClient) Delete(ctx context.Context, resourceGroupName string, labAccountName string) (result LabAccountsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabAccountsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, labAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LabAccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LabAccountsClient) DeleteSender(req *http.Request) (future LabAccountsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LabAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get lab account +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// expand - specify the $expand query. Example: 'properties($expand=sizeConfiguration)' +func (client LabAccountsClient) Get(ctx context.Context, resourceGroupName string, labAccountName string, expand string) (result LabAccount, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabAccountsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, labAccountName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LabAccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, labAccountName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LabAccountsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LabAccountsClient) GetResponder(resp *http.Response) (result LabAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRegionalAvailability get regional availability information for each size category configured under a lab account +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +func (client LabAccountsClient) GetRegionalAvailability(ctx context.Context, resourceGroupName string, labAccountName string) (result GetRegionalAvailabilityResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabAccountsClient.GetRegionalAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetRegionalAvailabilityPreparer(ctx, resourceGroupName, labAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "GetRegionalAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.GetRegionalAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "GetRegionalAvailability", resp, "Failure sending request") + return + } + + result, err = client.GetRegionalAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "GetRegionalAvailability", resp, "Failure responding to request") + } + + return +} + +// GetRegionalAvailabilityPreparer prepares the GetRegionalAvailability request. +func (client LabAccountsClient) GetRegionalAvailabilityPreparer(ctx context.Context, resourceGroupName string, labAccountName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/getRegionalAvailability", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRegionalAvailabilitySender sends the GetRegionalAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client LabAccountsClient) GetRegionalAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetRegionalAvailabilityResponder handles the response to the GetRegionalAvailability request. The method always +// closes the http.Response Body. +func (client LabAccountsClient) GetRegionalAvailabilityResponder(resp *http.Response) (result GetRegionalAvailabilityResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list lab accounts in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// expand - specify the $expand query. Example: 'properties($expand=sizeConfiguration)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client LabAccountsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabAccountPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabAccountsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.rwcla.Response.Response != nil { + sc = result.rwcla.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.rwcla.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.rwcla, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client LabAccountsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client LabAccountsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client LabAccountsClient) ListByResourceGroupResponder(resp *http.Response) (result ResponseWithContinuationLabAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client LabAccountsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ResponseWithContinuationLabAccount) (result ResponseWithContinuationLabAccount, err error) { + req, err := lastResults.responseWithContinuationLabAccountPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "ml.LabAccountsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "ml.LabAccountsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client LabAccountsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabAccountIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabAccountsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, expand, filter, top, orderby) + return +} + +// ListBySubscription list lab accounts in a subscription. +// Parameters: +// expand - specify the $expand query. Example: 'properties($expand=sizeConfiguration)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client LabAccountsClient) ListBySubscription(ctx context.Context, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabAccountPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabAccountsClient.ListBySubscription") + defer func() { + sc := -1 + if result.rwcla.Response.Response != nil { + sc = result.rwcla.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.rwcla.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.rwcla, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "ListBySubscription", resp, "Failure responding to request") + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client LabAccountsClient) ListBySubscriptionPreparer(ctx context.Context, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/labaccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client LabAccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client LabAccountsClient) ListBySubscriptionResponder(resp *http.Response) (result ResponseWithContinuationLabAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client LabAccountsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ResponseWithContinuationLabAccount) (result ResponseWithContinuationLabAccount, err error) { + req, err := lastResults.responseWithContinuationLabAccountPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "ml.LabAccountsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "ml.LabAccountsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client LabAccountsClient) ListBySubscriptionComplete(ctx context.Context, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabAccountIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabAccountsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, expand, filter, top, orderby) + return +} + +// Update modify properties of lab accounts. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labAccount - represents a lab account. +func (client LabAccountsClient) Update(ctx context.Context, resourceGroupName string, labAccountName string, labAccount LabAccountFragment) (result LabAccount, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabAccountsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, labAccountName, labAccount) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client LabAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labAccount LabAccountFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}", pathParameters), + autorest.WithJSON(labAccount), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client LabAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client LabAccountsClient) UpdateResponder(resp *http.Response) (result LabAccount, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/labservices/mgmt/2018-10-15/ML/labs.go b/services/labservices/mgmt/2018-10-15/ML/labs.go new file mode 100644 index 000000000000..6b7f02f4e4ae --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/labs.go @@ -0,0 +1,663 @@ +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LabsClient is the the Managed Labs Client. +type LabsClient struct { + BaseClient +} + +// NewLabsClient creates an instance of the LabsClient client. +func NewLabsClient(subscriptionID string) LabsClient { + return NewLabsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLabsClientWithBaseURI creates an instance of the LabsClient client. +func NewLabsClientWithBaseURI(baseURI string, subscriptionID string) LabsClient { + return LabsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AddUsers add users to a lab +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// addUsersPayload - payload for Add Users operation on a Lab. +func (client LabsClient) AddUsers(ctx context.Context, resourceGroupName string, labAccountName string, labName string, addUsersPayload AddUsersPayload) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.AddUsers") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: addUsersPayload, + Constraints: []validation.Constraint{{Target: "addUsersPayload.EmailAddresses", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("ml.LabsClient", "AddUsers", err.Error()) + } + + req, err := client.AddUsersPreparer(ctx, resourceGroupName, labAccountName, labName, addUsersPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "AddUsers", nil, "Failure preparing request") + return + } + + resp, err := client.AddUsersSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "ml.LabsClient", "AddUsers", resp, "Failure sending request") + return + } + + result, err = client.AddUsersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "AddUsers", resp, "Failure responding to request") + } + + return +} + +// AddUsersPreparer prepares the AddUsers request. +func (client LabsClient) AddUsersPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, addUsersPayload AddUsersPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/addUsers", pathParameters), + autorest.WithJSON(addUsersPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddUsersSender sends the AddUsers request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) AddUsersSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// AddUsersResponder handles the response to the AddUsers request. The method always +// closes the http.Response Body. +func (client LabsClient) AddUsersResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// CreateOrUpdate create or replace an existing Lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// lab - represents a lab. +func (client LabsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, labName string, lab Lab) (result Lab, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labAccountName, labName, lab) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.LabsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LabsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, lab Lab) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}", pathParameters), + autorest.WithJSON(lab), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LabsClient) CreateOrUpdateResponder(resp *http.Response) (result Lab, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete lab. This operation can take a while to complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +func (client LabsClient) Delete(ctx context.Context, resourceGroupName string, labAccountName string, labName string) (result LabsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, labAccountName, labName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LabsClient) DeletePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) DeleteSender(req *http.Request) (future LabsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LabsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get lab +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=maxUsersInLab)' +func (client LabsClient) Get(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string) (result Lab, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, labAccountName, labName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client LabsClient) GetPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LabsClient) GetResponder(resp *http.Response) (result Lab, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list labs in a given lab account. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// expand - specify the $expand query. Example: 'properties($select=maxUsersInLab)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client LabsClient) List(ctx context.Context, resourceGroupName string, labAccountName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.List") + defer func() { + sc := -1 + if result.rwcl.Response.Response != nil { + sc = result.rwcl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labAccountName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.LabsClient", "List", resp, "Failure sending request") + return + } + + result.rwcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client LabsClient) ListPreparer(ctx context.Context, resourceGroupName string, labAccountName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LabsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationLab, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LabsClient) listNextResults(ctx context.Context, lastResults ResponseWithContinuationLab) (result ResponseWithContinuationLab, err error) { + req, err := lastResults.responseWithContinuationLabPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "ml.LabsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "ml.LabsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LabsClient) ListComplete(ctx context.Context, resourceGroupName string, labAccountName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationLabIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, labAccountName, expand, filter, top, orderby) + return +} + +// Register register to managed lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +func (client LabsClient) Register(ctx context.Context, resourceGroupName string, labAccountName string, labName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.Register") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RegisterPreparer(ctx, resourceGroupName, labAccountName, labName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Register", nil, "Failure preparing request") + return + } + + resp, err := client.RegisterSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Register", resp, "Failure sending request") + return + } + + result, err = client.RegisterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Register", resp, "Failure responding to request") + } + + return +} + +// RegisterPreparer prepares the Register request. +func (client LabsClient) RegisterPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/register", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegisterSender sends the Register request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) RegisterSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// RegisterResponder handles the response to the Register request. The method always +// closes the http.Response Body. +func (client LabsClient) RegisterResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update modify properties of labs. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// lab - represents a lab. +func (client LabsClient) Update(ctx context.Context, resourceGroupName string, labAccountName string, labName string, lab LabFragment) (result Lab, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LabsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, labAccountName, labName, lab) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client LabsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, lab LabFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}", pathParameters), + autorest.WithJSON(lab), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client LabsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client LabsClient) UpdateResponder(resp *http.Response) (result Lab, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/labservices/mgmt/2018-10-15/ML/mlapi/interfaces.go b/services/labservices/mgmt/2018-10-15/ML/mlapi/interfaces.go new file mode 100644 index 000000000000..b331af28391d --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/mlapi/interfaces.go @@ -0,0 +1,133 @@ +package mlapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/labservices/mgmt/2018-10-15/ml" + "github.com/Azure/go-autorest/autorest" +) + +// ProviderOperationsClientAPI contains the set of methods on the ProviderOperationsClient type. +type ProviderOperationsClientAPI interface { + List(ctx context.Context) (result ml.ProviderOperationResultPage, err error) +} + +var _ ProviderOperationsClientAPI = (*ml.ProviderOperationsClient)(nil) + +// GlobalUsersClientAPI contains the set of methods on the GlobalUsersClient type. +type GlobalUsersClientAPI interface { + GetEnvironment(ctx context.Context, userName string, environmentOperationsPayload ml.EnvironmentOperationsPayload, expand string) (result ml.GetEnvironmentResponse, err error) + GetOperationBatchStatus(ctx context.Context, userName string, operationBatchStatusPayload ml.OperationBatchStatusPayload) (result ml.OperationBatchStatusResponse, err error) + GetOperationStatus(ctx context.Context, userName string, operationStatusPayload ml.OperationStatusPayload) (result ml.OperationStatusResponse, err error) + GetPersonalPreferences(ctx context.Context, userName string, personalPerferencesOperationsPayload ml.PersonalPerferencesOperationsPayload) (result ml.GetPersonalPreferencesResponse, err error) + ListEnvironments(ctx context.Context, userName string, listEnvironmentsPayload ml.ListEnvironmentsPayload) (result ml.ListEnvironmentsResponse, err error) + ListLabs(ctx context.Context, userName string) (result ml.ListLabsResponse, err error) + Register(ctx context.Context, userName string, registerPayload ml.RegisterPayload) (result autorest.Response, err error) + ResetPassword(ctx context.Context, userName string, resetPasswordPayload ml.ResetPasswordPayload) (result ml.GlobalUsersResetPasswordFuture, err error) + StartEnvironment(ctx context.Context, userName string, environmentOperationsPayload ml.EnvironmentOperationsPayload) (result ml.GlobalUsersStartEnvironmentFuture, err error) + StopEnvironment(ctx context.Context, userName string, environmentOperationsPayload ml.EnvironmentOperationsPayload) (result ml.GlobalUsersStopEnvironmentFuture, err error) +} + +var _ GlobalUsersClientAPI = (*ml.GlobalUsersClient)(nil) + +// LabAccountsClientAPI contains the set of methods on the LabAccountsClient type. +type LabAccountsClientAPI interface { + CreateLab(ctx context.Context, resourceGroupName string, labAccountName string, createLabProperties ml.CreateLabProperties) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, labAccount ml.LabAccount) (result ml.LabAccount, err error) + Delete(ctx context.Context, resourceGroupName string, labAccountName string) (result ml.LabAccountsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, labAccountName string, expand string) (result ml.LabAccount, err error) + GetRegionalAvailability(ctx context.Context, resourceGroupName string, labAccountName string) (result ml.GetRegionalAvailabilityResponse, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string, filter string, top *int32, orderby string) (result ml.ResponseWithContinuationLabAccountPage, err error) + ListBySubscription(ctx context.Context, expand string, filter string, top *int32, orderby string) (result ml.ResponseWithContinuationLabAccountPage, err error) + Update(ctx context.Context, resourceGroupName string, labAccountName string, labAccount ml.LabAccountFragment) (result ml.LabAccount, err error) +} + +var _ LabAccountsClientAPI = (*ml.LabAccountsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + Get(ctx context.Context, locationName string, operationName string) (result ml.OperationResult, err error) +} + +var _ OperationsClientAPI = (*ml.OperationsClient)(nil) + +// GalleryImagesClientAPI contains the set of methods on the GalleryImagesClient type. +type GalleryImagesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string, galleryImage ml.GalleryImage) (result ml.GalleryImage, err error) + Delete(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string, expand string) (result ml.GalleryImage, err error) + List(ctx context.Context, resourceGroupName string, labAccountName string, expand string, filter string, top *int32, orderby string) (result ml.ResponseWithContinuationGalleryImagePage, err error) + Update(ctx context.Context, resourceGroupName string, labAccountName string, galleryImageName string, galleryImage ml.GalleryImageFragment) (result ml.GalleryImage, err error) +} + +var _ GalleryImagesClientAPI = (*ml.GalleryImagesClient)(nil) + +// LabsClientAPI contains the set of methods on the LabsClient type. +type LabsClientAPI interface { + AddUsers(ctx context.Context, resourceGroupName string, labAccountName string, labName string, addUsersPayload ml.AddUsersPayload) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, labName string, lab ml.Lab) (result ml.Lab, err error) + Delete(ctx context.Context, resourceGroupName string, labAccountName string, labName string) (result ml.LabsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string) (result ml.Lab, err error) + List(ctx context.Context, resourceGroupName string, labAccountName string, expand string, filter string, top *int32, orderby string) (result ml.ResponseWithContinuationLabPage, err error) + Register(ctx context.Context, resourceGroupName string, labAccountName string, labName string) (result autorest.Response, err error) + Update(ctx context.Context, resourceGroupName string, labAccountName string, labName string, lab ml.LabFragment) (result ml.Lab, err error) +} + +var _ LabsClientAPI = (*ml.LabsClient)(nil) + +// EnvironmentSettingsClientAPI contains the set of methods on the EnvironmentSettingsClient type. +type EnvironmentSettingsClientAPI interface { + ClaimAny(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentSetting ml.EnvironmentSetting) (result ml.EnvironmentSettingsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (result ml.EnvironmentSettingsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, expand string) (result ml.EnvironmentSetting, err error) + List(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string, filter string, top *int32, orderby string) (result ml.ResponseWithContinuationEnvironmentSettingPage, err error) + Publish(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, publishPayload ml.PublishPayload) (result autorest.Response, err error) + Start(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (result ml.EnvironmentSettingsStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string) (result ml.EnvironmentSettingsStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentSetting ml.EnvironmentSettingFragment) (result ml.EnvironmentSetting, err error) +} + +var _ EnvironmentSettingsClientAPI = (*ml.EnvironmentSettingsClient)(nil) + +// EnvironmentsClientAPI contains the set of methods on the EnvironmentsClient type. +type EnvironmentsClientAPI interface { + Claim(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (result autorest.Response, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, environment ml.Environment) (result ml.Environment, err error) + Delete(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (result ml.EnvironmentsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, expand string) (result ml.Environment, err error) + List(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, expand string, filter string, top *int32, orderby string) (result ml.ResponseWithContinuationEnvironmentPage, err error) + ResetPassword(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, resetPasswordPayload ml.ResetPasswordPayload) (result ml.EnvironmentsResetPasswordFuture, err error) + Start(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (result ml.EnvironmentsStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string) (result ml.EnvironmentsStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, labAccountName string, labName string, environmentSettingName string, environmentName string, environment ml.EnvironmentFragment) (result ml.Environment, err error) +} + +var _ EnvironmentsClientAPI = (*ml.EnvironmentsClient)(nil) + +// UsersClientAPI contains the set of methods on the UsersClient type. +type UsersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string, userParameter ml.User) (result ml.User, err error) + Delete(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string) (result ml.UsersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string, expand string) (result ml.User, err error) + List(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string, filter string, top *int32, orderby string) (result ml.ResponseWithContinuationUserPage, err error) + Update(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string, userParameter ml.UserFragment) (result ml.User, err error) +} + +var _ UsersClientAPI = (*ml.UsersClient)(nil) diff --git a/services/labservices/mgmt/2018-10-15/ML/models.go b/services/labservices/mgmt/2018-10-15/ML/models.go new file mode 100644 index 000000000000..d3c21191807a --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/models.go @@ -0,0 +1,3528 @@ +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "github.com/shopspring/decimal" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/labservices/mgmt/2018-10-15/ml" + +// AddRemove enumerates the values for add remove. +type AddRemove string + +const ( + // Add Indicates that a user is adding a favorite lab + Add AddRemove = "Add" + // Remove Indicates that a user is removing a favorite lab + Remove AddRemove = "Remove" +) + +// PossibleAddRemoveValues returns an array of possible values for the AddRemove const type. +func PossibleAddRemoveValues() []AddRemove { + return []AddRemove{Add, Remove} +} + +// ConfigurationState enumerates the values for configuration state. +type ConfigurationState string + +const ( + // Completed User is finished modifying the template. + Completed ConfigurationState = "Completed" + // NotApplicable User either hasn't started configuring their template + // or they haven't started the configuration process. + NotApplicable ConfigurationState = "NotApplicable" +) + +// PossibleConfigurationStateValues returns an array of possible values for the ConfigurationState const type. +func PossibleConfigurationStateValues() []ConfigurationState { + return []ConfigurationState{Completed, NotApplicable} +} + +// LabUserAccessMode enumerates the values for lab user access mode. +type LabUserAccessMode string + +const ( + // Open Any user can register with the lab and access its VMs. + Open LabUserAccessMode = "Open" + // Restricted Only users registered with the lab can access VMs. + Restricted LabUserAccessMode = "Restricted" +) + +// PossibleLabUserAccessModeValues returns an array of possible values for the LabUserAccessMode const type. +func PossibleLabUserAccessModeValues() []LabUserAccessMode { + return []LabUserAccessMode{Open, Restricted} +} + +// ManagedLabVMSize enumerates the values for managed lab vm size. +type ManagedLabVMSize string + +const ( + // Basic The base VM size + Basic ManagedLabVMSize = "Basic" + // Performance The most performant VM size + Performance ManagedLabVMSize = "Performance" + // Standard The standard or default VM size + Standard ManagedLabVMSize = "Standard" +) + +// PossibleManagedLabVMSizeValues returns an array of possible values for the ManagedLabVMSize const type. +func PossibleManagedLabVMSizeValues() []ManagedLabVMSize { + return []ManagedLabVMSize{Basic, Performance, Standard} +} + +// PublishingState enumerates the values for publishing state. +type PublishingState string + +const ( + // Draft Initial state of an environment setting. + Draft PublishingState = "Draft" + // Published All resources are currently provisioned. + Published PublishingState = "Published" + // PublishFailed Failed to provision all the necessary resources. + PublishFailed PublishingState = "PublishFailed" + // Publishing Currently provisioning resources. + Publishing PublishingState = "Publishing" + // Scaling Currently provisioning resources without recreating VM image. + Scaling PublishingState = "Scaling" +) + +// PossiblePublishingStateValues returns an array of possible values for the PublishingState const type. +func PossiblePublishingStateValues() []PublishingState { + return []PublishingState{Draft, Published, PublishFailed, Publishing, Scaling} +} + +// AddUsersPayload payload for Add Users operation on a Lab. +type AddUsersPayload struct { + // EmailAddresses - List of user emails addresses to add to the lab. + EmailAddresses *[]string `json:"emailAddresses,omitempty"` +} + +// CloudError error from a REST request. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody body of an error from a REST request. +type CloudErrorBody struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` + // Details - Inner errors. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CreateLabProperties properties for creating a managed lab and a default environment setting +type CreateLabProperties struct { + // EnvironmentSettingCreationParameters - Settings related to creating an environment setting + EnvironmentSettingCreationParameters *EnvironmentSettingCreationParameters `json:"environmentSettingCreationParameters,omitempty"` + // LabCreationParameters - Settings related to creating a lab + LabCreationParameters *LabCreationParameters `json:"labCreationParameters,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Location - The location of the resource + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CreateLabProperties. +func (clp CreateLabProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if clp.EnvironmentSettingCreationParameters != nil { + objectMap["environmentSettingCreationParameters"] = clp.EnvironmentSettingCreationParameters + } + if clp.LabCreationParameters != nil { + objectMap["labCreationParameters"] = clp.LabCreationParameters + } + if clp.Name != nil { + objectMap["name"] = clp.Name + } + if clp.Location != nil { + objectMap["location"] = clp.Location + } + if clp.Tags != nil { + objectMap["tags"] = clp.Tags + } + return json.Marshal(objectMap) +} + +// Environment represents an environment instance +type Environment struct { + autorest.Response `json:"-"` + // EnvironmentProperties - The properties of the Environment resource + *EnvironmentProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Environment. +func (e Environment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.EnvironmentProperties != nil { + objectMap["properties"] = e.EnvironmentProperties + } + if e.ID != nil { + objectMap["id"] = e.ID + } + if e.Name != nil { + objectMap["name"] = e.Name + } + if e.Type != nil { + objectMap["type"] = e.Type + } + if e.Location != nil { + objectMap["location"] = e.Location + } + if e.Tags != nil { + objectMap["tags"] = e.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Environment struct. +func (e *Environment) 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 environmentProperties EnvironmentProperties + err = json.Unmarshal(*v, &environmentProperties) + if err != nil { + return err + } + e.EnvironmentProperties = &environmentProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + e.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + e.Tags = tags + } + } + } + + return nil +} + +// EnvironmentDetails this represents the details about a User's environment and its state. +type EnvironmentDetails struct { + // Name - Name of the Environment + Name *string `json:"name,omitempty"` + // Description - Description of the Environment + Description *string `json:"description,omitempty"` + // ID - Resource Id of the environment + ID *string `json:"id,omitempty"` + // ProvisioningState - The provisioning state of the environment. This also includes LabIsFull and NotYetProvisioned status. + ProvisioningState *string `json:"provisioningState,omitempty"` + // VirtualMachineDetails - Details of backing DTL virtual machine with compute and network details. + VirtualMachineDetails *VirtualMachineDetails `json:"virtualMachineDetails,omitempty"` + // LatestOperationResult - The details of the latest operation. ex: status, error + LatestOperationResult *LatestOperationResult `json:"latestOperationResult,omitempty"` + // EnvironmentState - Publishing state of the environment setting Possible values are Creating, Created, Failed + EnvironmentState *string `json:"environmentState,omitempty"` + // TotalUsage - How long the environment has been used by a lab user + TotalUsage *string `json:"totalUsage,omitempty"` + // PasswordLastReset - When the password was last reset on the environment. + PasswordLastReset *date.Time `json:"passwordLastReset,omitempty"` +} + +// EnvironmentFragment represents an environment instance +type EnvironmentFragment struct { + // EnvironmentPropertiesFragment - The properties of the Environment resource + *EnvironmentPropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for EnvironmentFragment. +func (ef EnvironmentFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ef.EnvironmentPropertiesFragment != nil { + objectMap["properties"] = ef.EnvironmentPropertiesFragment + } + if ef.ID != nil { + objectMap["id"] = ef.ID + } + if ef.Name != nil { + objectMap["name"] = ef.Name + } + if ef.Type != nil { + objectMap["type"] = ef.Type + } + if ef.Location != nil { + objectMap["location"] = ef.Location + } + if ef.Tags != nil { + objectMap["tags"] = ef.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EnvironmentFragment struct. +func (ef *EnvironmentFragment) 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 environmentPropertiesFragment EnvironmentPropertiesFragment + err = json.Unmarshal(*v, &environmentPropertiesFragment) + if err != nil { + return err + } + ef.EnvironmentPropertiesFragment = &environmentPropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ef.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ef.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ef.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ef.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ef.Tags = tags + } + } + } + + return nil +} + +// EnvironmentOperationsPayload represents payload for any Environment operations like get, start, stop, +// connect +type EnvironmentOperationsPayload struct { + // EnvironmentID - The resourceId of the environment + EnvironmentID *string `json:"environmentId,omitempty"` +} + +// EnvironmentProperties properties of an environment +type EnvironmentProperties struct { + // ResourceSets - The set of a VM and the setting id it was created for + ResourceSets *ResourceSet `json:"resourceSets,omitempty"` + // ClaimedByUserObjectID - The AAD object Id of the user who has claimed the environment + ClaimedByUserObjectID *string `json:"claimedByUserObjectId,omitempty"` + // ClaimedByUserPrincipalID - The user principal Id of the user who has claimed the environment + ClaimedByUserPrincipalID *string `json:"claimedByUserPrincipalId,omitempty"` + // ClaimedByUserName - The name or email address of the user who has claimed the environment + ClaimedByUserName *string `json:"claimedByUserName,omitempty"` + // IsClaimed - Is the environment claimed or not + IsClaimed *bool `json:"isClaimed,omitempty"` + // LastKnownPowerState - Last known power state of the environment + LastKnownPowerState *string `json:"lastKnownPowerState,omitempty"` + // NetworkInterface - Network details of the environment + NetworkInterface *NetworkInterface `json:"networkInterface,omitempty"` + // TotalUsage - How long the environment has been used by a lab user + TotalUsage *string `json:"totalUsage,omitempty"` + // PasswordLastReset - When the password was last reset on the environment. + PasswordLastReset *date.Time `json:"passwordLastReset,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + // LatestOperationResult - The details of the latest operation. ex: status, error + LatestOperationResult *LatestOperationResult `json:"latestOperationResult,omitempty"` +} + +// EnvironmentPropertiesFragment properties of an environment +type EnvironmentPropertiesFragment struct { + // ResourceSets - The set of a VM and the setting id it was created for + ResourceSets *ResourceSetFragment `json:"resourceSets,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// EnvironmentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EnvironmentsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EnvironmentsDeleteFuture) Result(client EnvironmentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.EnvironmentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// EnvironmentSetting represents settings of an environment, from which environment instances would be +// created +type EnvironmentSetting struct { + autorest.Response `json:"-"` + // EnvironmentSettingProperties - The properties of the Environment Setting resource + *EnvironmentSettingProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for EnvironmentSetting. +func (es EnvironmentSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if es.EnvironmentSettingProperties != nil { + objectMap["properties"] = es.EnvironmentSettingProperties + } + if es.ID != nil { + objectMap["id"] = es.ID + } + if es.Name != nil { + objectMap["name"] = es.Name + } + if es.Type != nil { + objectMap["type"] = es.Type + } + if es.Location != nil { + objectMap["location"] = es.Location + } + if es.Tags != nil { + objectMap["tags"] = es.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EnvironmentSetting struct. +func (es *EnvironmentSetting) 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 environmentSettingProperties EnvironmentSettingProperties + err = json.Unmarshal(*v, &environmentSettingProperties) + if err != nil { + return err + } + es.EnvironmentSettingProperties = &environmentSettingProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + es.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + es.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + es.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + es.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + es.Tags = tags + } + } + } + + return nil +} + +// EnvironmentSettingCreationParameters settings related to creating an environment setting +type EnvironmentSettingCreationParameters struct { + // ResourceSettingCreationParameters - The resource specific settings + ResourceSettingCreationParameters *ResourceSettingCreationParameters `json:"resourceSettingCreationParameters,omitempty"` +} + +// EnvironmentSettingFragment represents settings of an environment, from which environment instances would +// be created +type EnvironmentSettingFragment struct { + // EnvironmentSettingPropertiesFragment - The properties of the Environment Setting resource + *EnvironmentSettingPropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for EnvironmentSettingFragment. +func (esf EnvironmentSettingFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if esf.EnvironmentSettingPropertiesFragment != nil { + objectMap["properties"] = esf.EnvironmentSettingPropertiesFragment + } + if esf.ID != nil { + objectMap["id"] = esf.ID + } + if esf.Name != nil { + objectMap["name"] = esf.Name + } + if esf.Type != nil { + objectMap["type"] = esf.Type + } + if esf.Location != nil { + objectMap["location"] = esf.Location + } + if esf.Tags != nil { + objectMap["tags"] = esf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EnvironmentSettingFragment struct. +func (esf *EnvironmentSettingFragment) 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 environmentSettingPropertiesFragment EnvironmentSettingPropertiesFragment + err = json.Unmarshal(*v, &environmentSettingPropertiesFragment) + if err != nil { + return err + } + esf.EnvironmentSettingPropertiesFragment = &environmentSettingPropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + esf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + esf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + esf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + esf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + esf.Tags = tags + } + } + } + + return nil +} + +// EnvironmentSettingProperties properties of an environment setting +type EnvironmentSettingProperties struct { + // PublishingState - Describes the readiness of this environment setting. Possible values include: 'Draft', 'Publishing', 'Published', 'PublishFailed', 'Scaling' + PublishingState PublishingState `json:"publishingState,omitempty"` + // ConfigurationState - Describes the user's progress in configuring their environment setting. Possible values include: 'NotApplicable', 'Completed' + ConfigurationState ConfigurationState `json:"configurationState,omitempty"` + // Description - Describes the environment and its resource settings + Description *string `json:"description,omitempty"` + // Title - Brief title describing the environment and its resource settings + Title *string `json:"title,omitempty"` + // ResourceSettings - The resource specific settings + ResourceSettings *ResourceSettings `json:"resourceSettings,omitempty"` + // LastChanged - Time when the template VM was last changed. + LastChanged *date.Time `json:"lastChanged,omitempty"` + // LastPublished - Time when the template VM was last sent for publishing. + LastPublished *date.Time `json:"lastPublished,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + // LatestOperationResult - The details of the latest operation. ex: status, error + LatestOperationResult *LatestOperationResult `json:"latestOperationResult,omitempty"` +} + +// EnvironmentSettingPropertiesFragment properties of an environment setting +type EnvironmentSettingPropertiesFragment struct { + // ConfigurationState - Describes the user's progress in configuring their environment setting. Possible values include: 'NotApplicable', 'Completed' + ConfigurationState ConfigurationState `json:"configurationState,omitempty"` + // Description - Describes the environment and its resource settings + Description *string `json:"description,omitempty"` + // Title - Brief title describing the environment and its resource settings + Title *string `json:"title,omitempty"` + // ResourceSettings - The resource specific settings + ResourceSettings *ResourceSettingsFragment `json:"resourceSettings,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// EnvironmentSettingsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EnvironmentSettingsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EnvironmentSettingsCreateOrUpdateFuture) Result(client EnvironmentSettingsClient) (es EnvironmentSetting, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.EnvironmentSettingsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.CreateOrUpdateResponder(es.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") + } + } + return +} + +// EnvironmentSettingsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EnvironmentSettingsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EnvironmentSettingsDeleteFuture) Result(client EnvironmentSettingsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.EnvironmentSettingsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// EnvironmentSettingsStartFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EnvironmentSettingsStartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EnvironmentSettingsStartFuture) Result(client EnvironmentSettingsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.EnvironmentSettingsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// EnvironmentSettingsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EnvironmentSettingsStopFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EnvironmentSettingsStopFuture) Result(client EnvironmentSettingsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentSettingsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.EnvironmentSettingsStopFuture") + return + } + ar.Response = future.Response() + return +} + +// EnvironmentSize represents a size category supported by this Lab Account (small, medium or large) +type EnvironmentSize struct { + // Name - The size category. Possible values include: 'Basic', 'Standard', 'Performance' + Name ManagedLabVMSize `json:"name,omitempty"` + // VMSizes - Represents a set of compute sizes that can serve this given size type + VMSizes *[]SizeInfo `json:"vmSizes,omitempty"` + // MaxPrice - The pay-as-you-go dollar price per hour this size will cost. It does not include discounts and may not reflect the actual price the size will cost. This is the maximum price of all prices within this tier. + MaxPrice *decimal.Decimal `json:"maxPrice,omitempty"` + // MinNumberOfCores - The number of cores a VM of this size has. This is the minimum number of cores within this tier. + MinNumberOfCores *int32 `json:"minNumberOfCores,omitempty"` + // MinMemory - The amount of memory available (in GB). This is the minimum amount of memory within this tier. + MinMemory *float64 `json:"minMemory,omitempty"` +} + +// EnvironmentSizeFragment represents a size category supported by this Lab Account (small, medium or +// large) +type EnvironmentSizeFragment struct { + // Name - The size category. Possible values include: 'Basic', 'Standard', 'Performance' + Name ManagedLabVMSize `json:"name,omitempty"` + // VMSizes - Represents a set of compute sizes that can serve this given size type + VMSizes *[]SizeInfoFragment `json:"vmSizes,omitempty"` +} + +// EnvironmentsResetPasswordFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EnvironmentsResetPasswordFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EnvironmentsResetPasswordFuture) Result(client EnvironmentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsResetPasswordFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.EnvironmentsResetPasswordFuture") + return + } + ar.Response = future.Response() + return +} + +// EnvironmentsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EnvironmentsStartFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EnvironmentsStartFuture) Result(client EnvironmentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.EnvironmentsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// EnvironmentsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EnvironmentsStopFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *EnvironmentsStopFuture) Result(client EnvironmentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.EnvironmentsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.EnvironmentsStopFuture") + return + } + ar.Response = future.Response() + return +} + +// GalleryImage represents an image from the Azure Marketplace +type GalleryImage struct { + autorest.Response `json:"-"` + // GalleryImageProperties - The gallery image properties + *GalleryImageProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for GalleryImage. +func (gi GalleryImage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gi.GalleryImageProperties != nil { + objectMap["properties"] = gi.GalleryImageProperties + } + if gi.ID != nil { + objectMap["id"] = gi.ID + } + if gi.Name != nil { + objectMap["name"] = gi.Name + } + if gi.Type != nil { + objectMap["type"] = gi.Type + } + if gi.Location != nil { + objectMap["location"] = gi.Location + } + if gi.Tags != nil { + objectMap["tags"] = gi.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GalleryImage struct. +func (gi *GalleryImage) 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 galleryImageProperties GalleryImageProperties + err = json.Unmarshal(*v, &galleryImageProperties) + if err != nil { + return err + } + gi.GalleryImageProperties = &galleryImageProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gi.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + gi.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + gi.Tags = tags + } + } + } + + return nil +} + +// GalleryImageFragment represents an image from the Azure Marketplace +type GalleryImageFragment struct { + // GalleryImagePropertiesFragment - The gallery image properties + *GalleryImagePropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for GalleryImageFragment. +func (gifVar GalleryImageFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gifVar.GalleryImagePropertiesFragment != nil { + objectMap["properties"] = gifVar.GalleryImagePropertiesFragment + } + if gifVar.ID != nil { + objectMap["id"] = gifVar.ID + } + if gifVar.Name != nil { + objectMap["name"] = gifVar.Name + } + if gifVar.Type != nil { + objectMap["type"] = gifVar.Type + } + if gifVar.Location != nil { + objectMap["location"] = gifVar.Location + } + if gifVar.Tags != nil { + objectMap["tags"] = gifVar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GalleryImageFragment struct. +func (gifVar *GalleryImageFragment) 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 galleryImagePropertiesFragment GalleryImagePropertiesFragment + err = json.Unmarshal(*v, &galleryImagePropertiesFragment) + if err != nil { + return err + } + gifVar.GalleryImagePropertiesFragment = &galleryImagePropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gifVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gifVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gifVar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + gifVar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + gifVar.Tags = tags + } + } + } + + return nil +} + +// GalleryImageProperties the gallery image properties +type GalleryImageProperties struct { + // Author - The author of the gallery image. + Author *string `json:"author,omitempty"` + // CreatedDate - The creation date of the gallery image. + CreatedDate *date.Time `json:"createdDate,omitempty"` + // Description - The description of the gallery image. + Description *string `json:"description,omitempty"` + // ImageReference - The image reference of the gallery image. + ImageReference *GalleryImageReference `json:"imageReference,omitempty"` + // Icon - The icon of the gallery image. + Icon *string `json:"icon,omitempty"` + // IsEnabled - Indicates whether this gallery image is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // IsOverride - Indicates whether this gallery has been overridden for this lab account + IsOverride *bool `json:"isOverride,omitempty"` + // PlanID - The third party plan that applies to this image + PlanID *string `json:"planId,omitempty"` + // IsPlanAuthorized - Indicates if the plan has been authorized for programmatic deployment. + IsPlanAuthorized *bool `json:"isPlanAuthorized,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + // LatestOperationResult - The details of the latest operation. ex: status, error + LatestOperationResult *LatestOperationResult `json:"latestOperationResult,omitempty"` +} + +// GalleryImagePropertiesFragment the gallery image properties +type GalleryImagePropertiesFragment struct { + // IsEnabled - Indicates whether this gallery image is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // IsOverride - Indicates whether this gallery has been overridden for this lab account + IsOverride *bool `json:"isOverride,omitempty"` + // IsPlanAuthorized - Indicates if the plan has been authorized for programmatic deployment. + IsPlanAuthorized *bool `json:"isPlanAuthorized,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// GalleryImageReference the reference information for an Azure Marketplace image. +type GalleryImageReference struct { + // Offer - The offer of the gallery image. + Offer *string `json:"offer,omitempty"` + // Publisher - The publisher of the gallery image. + Publisher *string `json:"publisher,omitempty"` + // Sku - The SKU of the gallery image. + Sku *string `json:"sku,omitempty"` + // OsType - The OS type of the gallery image. + OsType *string `json:"osType,omitempty"` + // Version - The version of the gallery image. + Version *string `json:"version,omitempty"` +} + +// GalleryImageReferenceFragment the reference information for an Azure Marketplace image. +type GalleryImageReferenceFragment struct { + // Offer - The offer of the gallery image. + Offer *string `json:"offer,omitempty"` + // Publisher - The publisher of the gallery image. + Publisher *string `json:"publisher,omitempty"` + // Sku - The SKU of the gallery image. + Sku *string `json:"sku,omitempty"` + // OsType - The OS type of the gallery image. + OsType *string `json:"osType,omitempty"` + // Version - The version of the gallery image. + Version *string `json:"version,omitempty"` +} + +// GetEnvironmentResponse represents the environments details +type GetEnvironmentResponse struct { + autorest.Response `json:"-"` + // Environment - Details of the environment + Environment *EnvironmentDetails `json:"environment,omitempty"` +} + +// GetPersonalPreferencesResponse represents the PersonalPreferences for the user +type GetPersonalPreferencesResponse struct { + autorest.Response `json:"-"` + // ID - Id to be used by the cache orchestrator + ID *string `json:"id,omitempty"` + // FavoriteLabResourceIds - Array of favorite lab resource ids + FavoriteLabResourceIds *[]string `json:"favoriteLabResourceIds,omitempty"` +} + +// GetRegionalAvailabilityResponse the response model from the GetRegionalAvailability action +type GetRegionalAvailabilityResponse struct { + autorest.Response `json:"-"` + // RegionalAvailability - Availability information for different size categories per region + RegionalAvailability *[]RegionalAvailability `json:"regionalAvailability,omitempty"` +} + +// GlobalUsersResetPasswordFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GlobalUsersResetPasswordFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GlobalUsersResetPasswordFuture) Result(client GlobalUsersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersResetPasswordFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.GlobalUsersResetPasswordFuture") + return + } + ar.Response = future.Response() + return +} + +// GlobalUsersStartEnvironmentFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GlobalUsersStartEnvironmentFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GlobalUsersStartEnvironmentFuture) Result(client GlobalUsersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersStartEnvironmentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.GlobalUsersStartEnvironmentFuture") + return + } + ar.Response = future.Response() + return +} + +// GlobalUsersStopEnvironmentFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GlobalUsersStopEnvironmentFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *GlobalUsersStopEnvironmentFuture) Result(client GlobalUsersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.GlobalUsersStopEnvironmentFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.GlobalUsersStopEnvironmentFuture") + return + } + ar.Response = future.Response() + return +} + +// Lab represents a lab. +type Lab struct { + autorest.Response `json:"-"` + // LabProperties - The properties of the resource. + *LabProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Lab. +func (l Lab) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if l.LabProperties != nil { + objectMap["properties"] = l.LabProperties + } + if l.ID != nil { + objectMap["id"] = l.ID + } + if l.Name != nil { + objectMap["name"] = l.Name + } + if l.Type != nil { + objectMap["type"] = l.Type + } + if l.Location != nil { + objectMap["location"] = l.Location + } + if l.Tags != nil { + objectMap["tags"] = l.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Lab struct. +func (l *Lab) 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 labProperties LabProperties + err = json.Unmarshal(*v, &labProperties) + if err != nil { + return err + } + l.LabProperties = &labProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + l.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + l.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + l.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + l.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + l.Tags = tags + } + } + } + + return nil +} + +// LabAccount represents a lab account. +type LabAccount struct { + autorest.Response `json:"-"` + // LabAccountProperties - The properties of the resource. + *LabAccountProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LabAccount. +func (la LabAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if la.LabAccountProperties != nil { + objectMap["properties"] = la.LabAccountProperties + } + if la.ID != nil { + objectMap["id"] = la.ID + } + if la.Name != nil { + objectMap["name"] = la.Name + } + if la.Type != nil { + objectMap["type"] = la.Type + } + if la.Location != nil { + objectMap["location"] = la.Location + } + if la.Tags != nil { + objectMap["tags"] = la.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LabAccount struct. +func (la *LabAccount) 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 labAccountProperties LabAccountProperties + err = json.Unmarshal(*v, &labAccountProperties) + if err != nil { + return err + } + la.LabAccountProperties = &labAccountProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + la.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + la.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + la.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + la.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + la.Tags = tags + } + } + } + + return nil +} + +// LabAccountFragment represents a lab account. +type LabAccountFragment struct { + // LabAccountPropertiesFragment - The properties of the resource. + *LabAccountPropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LabAccountFragment. +func (laf LabAccountFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if laf.LabAccountPropertiesFragment != nil { + objectMap["properties"] = laf.LabAccountPropertiesFragment + } + if laf.ID != nil { + objectMap["id"] = laf.ID + } + if laf.Name != nil { + objectMap["name"] = laf.Name + } + if laf.Type != nil { + objectMap["type"] = laf.Type + } + if laf.Location != nil { + objectMap["location"] = laf.Location + } + if laf.Tags != nil { + objectMap["tags"] = laf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LabAccountFragment struct. +func (laf *LabAccountFragment) 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 labAccountPropertiesFragment LabAccountPropertiesFragment + err = json.Unmarshal(*v, &labAccountPropertiesFragment) + if err != nil { + return err + } + laf.LabAccountPropertiesFragment = &labAccountPropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + laf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + laf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + laf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + laf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + laf.Tags = tags + } + } + } + + return nil +} + +// LabAccountProperties properties of a Lab Account. +type LabAccountProperties struct { + // SizeConfiguration - Represents the size configuration under the lab account + SizeConfiguration *SizeConfigurationProperties `json:"sizeConfiguration,omitempty"` + // EnabledRegionSelection - Represents if region selection is enabled + EnabledRegionSelection *bool `json:"enabledRegionSelection,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + // LatestOperationResult - The details of the latest operation. ex: status, error + LatestOperationResult *LatestOperationResult `json:"latestOperationResult,omitempty"` +} + +// LabAccountPropertiesFragment properties of a Lab Account. +type LabAccountPropertiesFragment struct { + // EnabledRegionSelection - Represents if region selection is enabled + EnabledRegionSelection *bool `json:"enabledRegionSelection,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabAccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type LabAccountsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *LabAccountsDeleteFuture) Result(client LabAccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabAccountsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.LabAccountsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LabCreationParameters settings related to creating a lab +type LabCreationParameters struct { + // MaxUsersInLab - Maximum number of users allowed in the lab. + MaxUsersInLab *int32 `json:"maxUsersInLab,omitempty"` +} + +// LabDetails this represents the details about a lab that the User is in, and its state. +type LabDetails struct { + // Name - Name of the lab + Name *string `json:"name,omitempty"` + // ProvisioningState - The provisioning state of the lab. + ProvisioningState *string `json:"provisioningState,omitempty"` + // ID - The Id of the lab. + ID *string `json:"id,omitempty"` + // UsageQuota - The maximum duration a user can use a VM in this lab. + UsageQuota *string `json:"usageQuota,omitempty"` +} + +// LabFragment represents a lab. +type LabFragment struct { + // LabPropertiesFragment - The properties of the resource. + *LabPropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LabFragment. +func (lf LabFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lf.LabPropertiesFragment != nil { + objectMap["properties"] = lf.LabPropertiesFragment + } + if lf.ID != nil { + objectMap["id"] = lf.ID + } + if lf.Name != nil { + objectMap["name"] = lf.Name + } + if lf.Type != nil { + objectMap["type"] = lf.Type + } + if lf.Location != nil { + objectMap["location"] = lf.Location + } + if lf.Tags != nil { + objectMap["tags"] = lf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LabFragment struct. +func (lf *LabFragment) 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 labPropertiesFragment LabPropertiesFragment + err = json.Unmarshal(*v, &labPropertiesFragment) + if err != nil { + return err + } + lf.LabPropertiesFragment = &labPropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lf.Tags = tags + } + } + } + + return nil +} + +// LabProperties properties of a Lab. +type LabProperties struct { + // MaxUsersInLab - Maximum number of users allowed in the lab. + MaxUsersInLab *int32 `json:"maxUsersInLab,omitempty"` + // UserQuota - Maximum value MaxUsersInLab can be set to, as specified by the service + UserQuota *int32 `json:"userQuota,omitempty"` + // InvitationCode - Invitation code that users can use to join a lab. + InvitationCode *string `json:"invitationCode,omitempty"` + // CreatedByObjectID - Object id of the user that created the lab. + CreatedByObjectID *string `json:"createdByObjectId,omitempty"` + // UsageQuota - Maximum duration a user can use an environment for in the lab. + UsageQuota *string `json:"usageQuota,omitempty"` + // UserAccessMode - Lab user access mode (open to all vs. restricted to those listed on the lab). Possible values include: 'Restricted', 'Open' + UserAccessMode LabUserAccessMode `json:"userAccessMode,omitempty"` + // CreatedByUserPrincipalName - Lab creator name + CreatedByUserPrincipalName *string `json:"createdByUserPrincipalName,omitempty"` + // CreatedDate - Creation date for the lab + CreatedDate *date.Time `json:"createdDate,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + // LatestOperationResult - The details of the latest operation. ex: status, error + LatestOperationResult *LatestOperationResult `json:"latestOperationResult,omitempty"` +} + +// LabPropertiesFragment properties of a Lab. +type LabPropertiesFragment struct { + // MaxUsersInLab - Maximum number of users allowed in the lab. + MaxUsersInLab *int32 `json:"maxUsersInLab,omitempty"` + // UsageQuota - Maximum duration a user can use an environment for in the lab. + UsageQuota *string `json:"usageQuota,omitempty"` + // UserAccessMode - Lab user access mode (open to all vs. restricted to those listed on the lab). Possible values include: 'Restricted', 'Open' + UserAccessMode LabUserAccessMode `json:"userAccessMode,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// LabsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type LabsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *LabsDeleteFuture) Result(client LabsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.LabsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.LabsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LatestOperationResult details of the status of an operation. +type LatestOperationResult struct { + // Status - The current status of the operation. + Status *string `json:"status,omitempty"` + // ErrorCode - Error code on failure. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - The error message. + ErrorMessage *string `json:"errorMessage,omitempty"` + // RequestURI - Request URI of the operation. + RequestURI *string `json:"requestUri,omitempty"` + // HTTPMethod - The HttpMethod - PUT/POST/DELETE for the operation. + HTTPMethod *string `json:"httpMethod,omitempty"` + // OperationURL - The URL to use to check long-running operation status + OperationURL *string `json:"operationUrl,omitempty"` +} + +// ListEnvironmentsPayload represents the payload to list environments owned by a user +type ListEnvironmentsPayload struct { + // LabID - The resource Id of the lab + LabID *string `json:"labId,omitempty"` +} + +// ListEnvironmentsResponse represents the list of environments owned by a user +type ListEnvironmentsResponse struct { + autorest.Response `json:"-"` + // Environments - List of all the evironments + Environments *[]EnvironmentDetails `json:"environments,omitempty"` +} + +// ListLabsResponse lists the labs owned by a user +type ListLabsResponse struct { + autorest.Response `json:"-"` + // Labs - List of all the labs + Labs *[]LabDetails `json:"labs,omitempty"` +} + +// NetworkInterface network details of the environment +type NetworkInterface struct { + // PrivateIPAddress - PrivateIp address of the Compute VM + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + // SSHAuthority - Connection information for Linux + SSHAuthority *string `json:"sshAuthority,omitempty"` + // RdpAuthority - Connection information for Windows + RdpAuthority *string `json:"rdpAuthority,omitempty"` + // Username - Username of the VM + Username *string `json:"username,omitempty"` +} + +// OperationBatchStatusPayload payload to get the status of an operation +type OperationBatchStatusPayload struct { + // Urls - The operation url of long running operation + Urls *[]string `json:"urls,omitempty"` +} + +// OperationBatchStatusResponse status Details of the long running operation for an environment +type OperationBatchStatusResponse struct { + autorest.Response `json:"-"` + // Items - Gets a collection of items that contain the operation url and status. + Items *[]OperationBatchStatusResponseItem `json:"items,omitempty"` +} + +// OperationBatchStatusResponseItem represents the status of an operation that used the batch API. +type OperationBatchStatusResponseItem struct { + // OperationURL - status of the long running operation for an environment + OperationURL *string `json:"operationUrl,omitempty"` + // Status - status of the long running operation for an environment + Status *string `json:"status,omitempty"` +} + +// OperationError error details for the operation in case of a failure. +type OperationError struct { + // Code - The error code of the operation error. + Code *string `json:"code,omitempty"` + // Message - The error message of the operation error. + Message *string `json:"message,omitempty"` +} + +// OperationMetadata the REST API operation supported by ManagedLab ResourceProvider. +type OperationMetadata struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - The object that describes the operations + Display *OperationMetadataDisplay `json:"display,omitempty"` +} + +// OperationMetadataDisplay the object that describes the operations +type OperationMetadataDisplay struct { + // Provider - Friendly name of the resource provider + Provider *string `json:"provider,omitempty"` + // Resource - Resource type on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: read, write, delete, listKeys/action, etc. + Operation *string `json:"operation,omitempty"` + // Description - Friendly name of the operation + Description *string `json:"description,omitempty"` +} + +// OperationResult an Operation Result +type OperationResult struct { + autorest.Response `json:"-"` + // Status - The operation status. + Status *string `json:"status,omitempty"` + // Error - Error details for the operation in case of a failure. + Error *OperationError `json:"error,omitempty"` +} + +// OperationStatusPayload payload to get the status of an operation +type OperationStatusPayload struct { + // OperationURL - The operation url of long running operation + OperationURL *string `json:"operationUrl,omitempty"` +} + +// OperationStatusResponse status Details of the long running operation for an environment +type OperationStatusResponse struct { + autorest.Response `json:"-"` + // Status - status of the long running operation for an environment + Status *string `json:"status,omitempty"` +} + +// PersonalPerferencesOperationsPayload represents payload for any Environment operations like get, start, +// stop, connect +type PersonalPerferencesOperationsPayload struct { + // LabAccountResourceID - Resource Id of the lab account + LabAccountResourceID *string `json:"labAccountResourceId,omitempty"` + // AddRemove - Enum indicating if user is adding or removing a favorite lab. Possible values include: 'Add', 'Remove' + AddRemove AddRemove `json:"addRemove,omitempty"` + // LabResourceID - Resource Id of the lab to add/remove from the favorites list + LabResourceID *string `json:"labResourceId,omitempty"` +} + +// ProviderOperationResult result of the request to list REST API operations +type ProviderOperationResult struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the resource provider. + Value *[]OperationMetadata `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ProviderOperationResultIterator provides access to a complete listing of OperationMetadata values. +type ProviderOperationResultIterator struct { + i int + page ProviderOperationResultPage +} + +// 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 *ProviderOperationResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationResultIterator.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 *ProviderOperationResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProviderOperationResultIterator) 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 ProviderOperationResultIterator) Response() ProviderOperationResult { + 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 ProviderOperationResultIterator) Value() OperationMetadata { + if !iter.page.NotDone() { + return OperationMetadata{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProviderOperationResultIterator type. +func NewProviderOperationResultIterator(page ProviderOperationResultPage) ProviderOperationResultIterator { + return ProviderOperationResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (por ProviderOperationResult) IsEmpty() bool { + return por.Value == nil || len(*por.Value) == 0 +} + +// providerOperationResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (por ProviderOperationResult) providerOperationResultPreparer(ctx context.Context) (*http.Request, error) { + if por.NextLink == nil || len(to.String(por.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(por.NextLink))) +} + +// ProviderOperationResultPage contains a page of OperationMetadata values. +type ProviderOperationResultPage struct { + fn func(context.Context, ProviderOperationResult) (ProviderOperationResult, error) + por ProviderOperationResult +} + +// 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 *ProviderOperationResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.por) + if err != nil { + return err + } + page.por = next + 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 *ProviderOperationResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProviderOperationResultPage) NotDone() bool { + return !page.por.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProviderOperationResultPage) Response() ProviderOperationResult { + return page.por +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProviderOperationResultPage) Values() []OperationMetadata { + if page.por.IsEmpty() { + return nil + } + return *page.por.Value +} + +// Creates a new instance of the ProviderOperationResultPage type. +func NewProviderOperationResultPage(getNextPage func(context.Context, ProviderOperationResult) (ProviderOperationResult, error)) ProviderOperationResultPage { + return ProviderOperationResultPage{fn: getNextPage} +} + +// PublishPayload payload for Publish operation on EnvironmentSetting. +type PublishPayload struct { + // UseExistingImage - Whether to use existing VM custom image when publishing. + UseExistingImage *bool `json:"useExistingImage,omitempty"` +} + +// ReferenceVM details of a Reference Vm +type ReferenceVM struct { + // UserName - The username of the virtual machine + UserName *string `json:"userName,omitempty"` + // Password - The password of the virtual machine. This will be set to null in GET resource API + Password *string `json:"password,omitempty"` + // VMStateDetails - The state details for the reference virtual machine. + VMStateDetails *VMStateDetails `json:"vmStateDetails,omitempty"` + // VMResourceID - VM resource Id for the environment + VMResourceID *string `json:"vmResourceId,omitempty"` +} + +// ReferenceVMCreationParameters creation parameters for Reference Vm +type ReferenceVMCreationParameters struct { + // UserName - The username of the virtual machine + UserName *string `json:"userName,omitempty"` + // Password - The password of the virtual machine. + Password *string `json:"password,omitempty"` +} + +// ReferenceVMFragment details of a Reference Vm +type ReferenceVMFragment struct { + // UserName - The username of the virtual machine + UserName *string `json:"userName,omitempty"` + // Password - The password of the virtual machine. This will be set to null in GET resource API + Password *string `json:"password,omitempty"` +} + +// RegionalAvailability the availability information of sizes across regions +type RegionalAvailability struct { + // Region - Corresponding region + Region *string `json:"region,omitempty"` + // SizeAvailabilities - List of all the size information for the region + SizeAvailabilities *[]SizeAvailability `json:"sizeAvailabilities,omitempty"` +} + +// RegisterPayload represents payload for Register action. +type RegisterPayload struct { + // RegistrationCode - The registration code of the lab. + RegistrationCode *string `json:"registrationCode,omitempty"` +} + +// ResetPasswordPayload represents the payload for resetting passwords. +type ResetPasswordPayload struct { + // EnvironmentID - The resourceId of the environment + EnvironmentID *string `json:"environmentId,omitempty"` + // Username - The username for which the password will be reset. + Username *string `json:"username,omitempty"` + // Password - The password to assign to the user specified in + Password *string `json:"password,omitempty"` +} + +// Resource an Azure resource. +type Resource struct { + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + 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.ID != nil { + objectMap["id"] = r.ID + } + if r.Name != nil { + objectMap["name"] = r.Name + } + if r.Type != nil { + objectMap["type"] = r.Type + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResourceSet represents a VM and the setting Id it was created for. +type ResourceSet struct { + // VMResourceID - VM resource Id for the environment + VMResourceID *string `json:"vmResourceId,omitempty"` + // ResourceSettingID - resourceSettingId for the environment + ResourceSettingID *string `json:"resourceSettingId,omitempty"` +} + +// ResourceSetFragment represents a VM and the setting Id it was created for. +type ResourceSetFragment struct { + // VMResourceID - VM resource Id for the environment + VMResourceID *string `json:"vmResourceId,omitempty"` + // ResourceSettingID - resourceSettingId for the environment + ResourceSettingID *string `json:"resourceSettingId,omitempty"` +} + +// ResourceSettingCreationParameters represents resource specific settings +type ResourceSettingCreationParameters struct { + // Location - The location where the virtual machine will live + Location *string `json:"location,omitempty"` + // Name - The name of the resource setting + Name *string `json:"name,omitempty"` + // GalleryImageResourceID - The resource id of the gallery image used for creating the virtual machine + GalleryImageResourceID *string `json:"galleryImageResourceId,omitempty"` + // Size - The size of the virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + Size ManagedLabVMSize `json:"size,omitempty"` + // ReferenceVMCreationParameters - Creation parameters for Reference Vm + ReferenceVMCreationParameters *ReferenceVMCreationParameters `json:"referenceVmCreationParameters,omitempty"` +} + +// ResourceSettings represents resource specific settings +type ResourceSettings struct { + // ID - The unique id of the resource setting + ID *string `json:"id,omitempty"` + // GalleryImageResourceID - The resource id of the gallery image used for creating the virtual machine + GalleryImageResourceID *string `json:"galleryImageResourceId,omitempty"` + // ImageName - The name of the image used to created the environment setting + ImageName *string `json:"imageName,omitempty"` + // Size - The size of the virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + Size ManagedLabVMSize `json:"size,omitempty"` + // Cores - The translated compute cores of the virtual machine + Cores *int32 `json:"cores,omitempty"` + // ReferenceVM - Details specific to Reference Vm + ReferenceVM *ReferenceVM `json:"referenceVm,omitempty"` +} + +// ResourceSettingsFragment represents resource specific settings +type ResourceSettingsFragment struct { + // GalleryImageResourceID - The resource id of the gallery image used for creating the virtual machine + GalleryImageResourceID *string `json:"galleryImageResourceId,omitempty"` + // Size - The size of the virtual machine. Possible values include: 'Basic', 'Standard', 'Performance' + Size ManagedLabVMSize `json:"size,omitempty"` + // ReferenceVM - Details specific to Reference Vm + ReferenceVM *ReferenceVMFragment `json:"referenceVm,omitempty"` +} + +// ResponseWithContinuationEnvironment the response of a list operation. +type ResponseWithContinuationEnvironment struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]Environment `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationEnvironmentIterator provides access to a complete listing of Environment values. +type ResponseWithContinuationEnvironmentIterator struct { + i int + page ResponseWithContinuationEnvironmentPage +} + +// 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 *ResponseWithContinuationEnvironmentIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationEnvironmentIterator.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 *ResponseWithContinuationEnvironmentIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResponseWithContinuationEnvironmentIterator) 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 ResponseWithContinuationEnvironmentIterator) Response() ResponseWithContinuationEnvironment { + 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 ResponseWithContinuationEnvironmentIterator) Value() Environment { + if !iter.page.NotDone() { + return Environment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResponseWithContinuationEnvironmentIterator type. +func NewResponseWithContinuationEnvironmentIterator(page ResponseWithContinuationEnvironmentPage) ResponseWithContinuationEnvironmentIterator { + return ResponseWithContinuationEnvironmentIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcE ResponseWithContinuationEnvironment) IsEmpty() bool { + return rwcE.Value == nil || len(*rwcE.Value) == 0 +} + +// responseWithContinuationEnvironmentPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcE ResponseWithContinuationEnvironment) responseWithContinuationEnvironmentPreparer(ctx context.Context) (*http.Request, error) { + if rwcE.NextLink == nil || len(to.String(rwcE.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcE.NextLink))) +} + +// ResponseWithContinuationEnvironmentPage contains a page of Environment values. +type ResponseWithContinuationEnvironmentPage struct { + fn func(context.Context, ResponseWithContinuationEnvironment) (ResponseWithContinuationEnvironment, error) + rwce ResponseWithContinuationEnvironment +} + +// 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 *ResponseWithContinuationEnvironmentPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationEnvironmentPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.rwce) + if err != nil { + return err + } + page.rwce = next + 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 *ResponseWithContinuationEnvironmentPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationEnvironmentPage) NotDone() bool { + return !page.rwce.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationEnvironmentPage) Response() ResponseWithContinuationEnvironment { + return page.rwce +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationEnvironmentPage) Values() []Environment { + if page.rwce.IsEmpty() { + return nil + } + return *page.rwce.Value +} + +// Creates a new instance of the ResponseWithContinuationEnvironmentPage type. +func NewResponseWithContinuationEnvironmentPage(getNextPage func(context.Context, ResponseWithContinuationEnvironment) (ResponseWithContinuationEnvironment, error)) ResponseWithContinuationEnvironmentPage { + return ResponseWithContinuationEnvironmentPage{fn: getNextPage} +} + +// ResponseWithContinuationEnvironmentSetting the response of a list operation. +type ResponseWithContinuationEnvironmentSetting struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]EnvironmentSetting `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationEnvironmentSettingIterator provides access to a complete listing of +// EnvironmentSetting values. +type ResponseWithContinuationEnvironmentSettingIterator struct { + i int + page ResponseWithContinuationEnvironmentSettingPage +} + +// 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 *ResponseWithContinuationEnvironmentSettingIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationEnvironmentSettingIterator.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 *ResponseWithContinuationEnvironmentSettingIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResponseWithContinuationEnvironmentSettingIterator) 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 ResponseWithContinuationEnvironmentSettingIterator) Response() ResponseWithContinuationEnvironmentSetting { + 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 ResponseWithContinuationEnvironmentSettingIterator) Value() EnvironmentSetting { + if !iter.page.NotDone() { + return EnvironmentSetting{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResponseWithContinuationEnvironmentSettingIterator type. +func NewResponseWithContinuationEnvironmentSettingIterator(page ResponseWithContinuationEnvironmentSettingPage) ResponseWithContinuationEnvironmentSettingIterator { + return ResponseWithContinuationEnvironmentSettingIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcEs ResponseWithContinuationEnvironmentSetting) IsEmpty() bool { + return rwcEs.Value == nil || len(*rwcEs.Value) == 0 +} + +// responseWithContinuationEnvironmentSettingPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcEs ResponseWithContinuationEnvironmentSetting) responseWithContinuationEnvironmentSettingPreparer(ctx context.Context) (*http.Request, error) { + if rwcEs.NextLink == nil || len(to.String(rwcEs.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcEs.NextLink))) +} + +// ResponseWithContinuationEnvironmentSettingPage contains a page of EnvironmentSetting values. +type ResponseWithContinuationEnvironmentSettingPage struct { + fn func(context.Context, ResponseWithContinuationEnvironmentSetting) (ResponseWithContinuationEnvironmentSetting, error) + rwces ResponseWithContinuationEnvironmentSetting +} + +// 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 *ResponseWithContinuationEnvironmentSettingPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationEnvironmentSettingPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.rwces) + if err != nil { + return err + } + page.rwces = next + 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 *ResponseWithContinuationEnvironmentSettingPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationEnvironmentSettingPage) NotDone() bool { + return !page.rwces.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationEnvironmentSettingPage) Response() ResponseWithContinuationEnvironmentSetting { + return page.rwces +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationEnvironmentSettingPage) Values() []EnvironmentSetting { + if page.rwces.IsEmpty() { + return nil + } + return *page.rwces.Value +} + +// Creates a new instance of the ResponseWithContinuationEnvironmentSettingPage type. +func NewResponseWithContinuationEnvironmentSettingPage(getNextPage func(context.Context, ResponseWithContinuationEnvironmentSetting) (ResponseWithContinuationEnvironmentSetting, error)) ResponseWithContinuationEnvironmentSettingPage { + return ResponseWithContinuationEnvironmentSettingPage{fn: getNextPage} +} + +// ResponseWithContinuationGalleryImage the response of a list operation. +type ResponseWithContinuationGalleryImage struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]GalleryImage `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationGalleryImageIterator provides access to a complete listing of GalleryImage +// values. +type ResponseWithContinuationGalleryImageIterator struct { + i int + page ResponseWithContinuationGalleryImagePage +} + +// 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 *ResponseWithContinuationGalleryImageIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationGalleryImageIterator.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 *ResponseWithContinuationGalleryImageIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResponseWithContinuationGalleryImageIterator) 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 ResponseWithContinuationGalleryImageIterator) Response() ResponseWithContinuationGalleryImage { + 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 ResponseWithContinuationGalleryImageIterator) Value() GalleryImage { + if !iter.page.NotDone() { + return GalleryImage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResponseWithContinuationGalleryImageIterator type. +func NewResponseWithContinuationGalleryImageIterator(page ResponseWithContinuationGalleryImagePage) ResponseWithContinuationGalleryImageIterator { + return ResponseWithContinuationGalleryImageIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcGi ResponseWithContinuationGalleryImage) IsEmpty() bool { + return rwcGi.Value == nil || len(*rwcGi.Value) == 0 +} + +// responseWithContinuationGalleryImagePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcGi ResponseWithContinuationGalleryImage) responseWithContinuationGalleryImagePreparer(ctx context.Context) (*http.Request, error) { + if rwcGi.NextLink == nil || len(to.String(rwcGi.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcGi.NextLink))) +} + +// ResponseWithContinuationGalleryImagePage contains a page of GalleryImage values. +type ResponseWithContinuationGalleryImagePage struct { + fn func(context.Context, ResponseWithContinuationGalleryImage) (ResponseWithContinuationGalleryImage, error) + rwcgi ResponseWithContinuationGalleryImage +} + +// 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 *ResponseWithContinuationGalleryImagePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationGalleryImagePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.rwcgi) + if err != nil { + return err + } + page.rwcgi = next + 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 *ResponseWithContinuationGalleryImagePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationGalleryImagePage) NotDone() bool { + return !page.rwcgi.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationGalleryImagePage) Response() ResponseWithContinuationGalleryImage { + return page.rwcgi +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationGalleryImagePage) Values() []GalleryImage { + if page.rwcgi.IsEmpty() { + return nil + } + return *page.rwcgi.Value +} + +// Creates a new instance of the ResponseWithContinuationGalleryImagePage type. +func NewResponseWithContinuationGalleryImagePage(getNextPage func(context.Context, ResponseWithContinuationGalleryImage) (ResponseWithContinuationGalleryImage, error)) ResponseWithContinuationGalleryImagePage { + return ResponseWithContinuationGalleryImagePage{fn: getNextPage} +} + +// ResponseWithContinuationLab the response of a list operation. +type ResponseWithContinuationLab struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]Lab `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationLabAccount the response of a list operation. +type ResponseWithContinuationLabAccount struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]LabAccount `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationLabAccountIterator provides access to a complete listing of LabAccount values. +type ResponseWithContinuationLabAccountIterator struct { + i int + page ResponseWithContinuationLabAccountPage +} + +// 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 *ResponseWithContinuationLabAccountIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationLabAccountIterator.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 *ResponseWithContinuationLabAccountIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResponseWithContinuationLabAccountIterator) 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 ResponseWithContinuationLabAccountIterator) Response() ResponseWithContinuationLabAccount { + 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 ResponseWithContinuationLabAccountIterator) Value() LabAccount { + if !iter.page.NotDone() { + return LabAccount{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResponseWithContinuationLabAccountIterator type. +func NewResponseWithContinuationLabAccountIterator(page ResponseWithContinuationLabAccountPage) ResponseWithContinuationLabAccountIterator { + return ResponseWithContinuationLabAccountIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcLa ResponseWithContinuationLabAccount) IsEmpty() bool { + return rwcLa.Value == nil || len(*rwcLa.Value) == 0 +} + +// responseWithContinuationLabAccountPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcLa ResponseWithContinuationLabAccount) responseWithContinuationLabAccountPreparer(ctx context.Context) (*http.Request, error) { + if rwcLa.NextLink == nil || len(to.String(rwcLa.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcLa.NextLink))) +} + +// ResponseWithContinuationLabAccountPage contains a page of LabAccount values. +type ResponseWithContinuationLabAccountPage struct { + fn func(context.Context, ResponseWithContinuationLabAccount) (ResponseWithContinuationLabAccount, error) + rwcla ResponseWithContinuationLabAccount +} + +// 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 *ResponseWithContinuationLabAccountPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationLabAccountPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.rwcla) + if err != nil { + return err + } + page.rwcla = next + 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 *ResponseWithContinuationLabAccountPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationLabAccountPage) NotDone() bool { + return !page.rwcla.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationLabAccountPage) Response() ResponseWithContinuationLabAccount { + return page.rwcla +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationLabAccountPage) Values() []LabAccount { + if page.rwcla.IsEmpty() { + return nil + } + return *page.rwcla.Value +} + +// Creates a new instance of the ResponseWithContinuationLabAccountPage type. +func NewResponseWithContinuationLabAccountPage(getNextPage func(context.Context, ResponseWithContinuationLabAccount) (ResponseWithContinuationLabAccount, error)) ResponseWithContinuationLabAccountPage { + return ResponseWithContinuationLabAccountPage{fn: getNextPage} +} + +// ResponseWithContinuationLabIterator provides access to a complete listing of Lab values. +type ResponseWithContinuationLabIterator struct { + i int + page ResponseWithContinuationLabPage +} + +// 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 *ResponseWithContinuationLabIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationLabIterator.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 *ResponseWithContinuationLabIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResponseWithContinuationLabIterator) 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 ResponseWithContinuationLabIterator) Response() ResponseWithContinuationLab { + 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 ResponseWithContinuationLabIterator) Value() Lab { + if !iter.page.NotDone() { + return Lab{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResponseWithContinuationLabIterator type. +func NewResponseWithContinuationLabIterator(page ResponseWithContinuationLabPage) ResponseWithContinuationLabIterator { + return ResponseWithContinuationLabIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcL ResponseWithContinuationLab) IsEmpty() bool { + return rwcL.Value == nil || len(*rwcL.Value) == 0 +} + +// responseWithContinuationLabPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcL ResponseWithContinuationLab) responseWithContinuationLabPreparer(ctx context.Context) (*http.Request, error) { + if rwcL.NextLink == nil || len(to.String(rwcL.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcL.NextLink))) +} + +// ResponseWithContinuationLabPage contains a page of Lab values. +type ResponseWithContinuationLabPage struct { + fn func(context.Context, ResponseWithContinuationLab) (ResponseWithContinuationLab, error) + rwcl ResponseWithContinuationLab +} + +// 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 *ResponseWithContinuationLabPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationLabPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.rwcl) + if err != nil { + return err + } + page.rwcl = next + 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 *ResponseWithContinuationLabPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationLabPage) NotDone() bool { + return !page.rwcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationLabPage) Response() ResponseWithContinuationLab { + return page.rwcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationLabPage) Values() []Lab { + if page.rwcl.IsEmpty() { + return nil + } + return *page.rwcl.Value +} + +// Creates a new instance of the ResponseWithContinuationLabPage type. +func NewResponseWithContinuationLabPage(getNextPage func(context.Context, ResponseWithContinuationLab) (ResponseWithContinuationLab, error)) ResponseWithContinuationLabPage { + return ResponseWithContinuationLabPage{fn: getNextPage} +} + +// ResponseWithContinuationUser the response of a list operation. +type ResponseWithContinuationUser struct { + autorest.Response `json:"-"` + // Value - Results of the list operation. + Value *[]User `json:"value,omitempty"` + // NextLink - Link for next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResponseWithContinuationUserIterator provides access to a complete listing of User values. +type ResponseWithContinuationUserIterator struct { + i int + page ResponseWithContinuationUserPage +} + +// 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 *ResponseWithContinuationUserIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationUserIterator.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 *ResponseWithContinuationUserIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResponseWithContinuationUserIterator) 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 ResponseWithContinuationUserIterator) Response() ResponseWithContinuationUser { + 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 ResponseWithContinuationUserIterator) Value() User { + if !iter.page.NotDone() { + return User{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResponseWithContinuationUserIterator type. +func NewResponseWithContinuationUserIterator(page ResponseWithContinuationUserPage) ResponseWithContinuationUserIterator { + return ResponseWithContinuationUserIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rwcU ResponseWithContinuationUser) IsEmpty() bool { + return rwcU.Value == nil || len(*rwcU.Value) == 0 +} + +// responseWithContinuationUserPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rwcU ResponseWithContinuationUser) responseWithContinuationUserPreparer(ctx context.Context) (*http.Request, error) { + if rwcU.NextLink == nil || len(to.String(rwcU.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rwcU.NextLink))) +} + +// ResponseWithContinuationUserPage contains a page of User values. +type ResponseWithContinuationUserPage struct { + fn func(context.Context, ResponseWithContinuationUser) (ResponseWithContinuationUser, error) + rwcu ResponseWithContinuationUser +} + +// 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 *ResponseWithContinuationUserPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResponseWithContinuationUserPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.rwcu) + if err != nil { + return err + } + page.rwcu = next + 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 *ResponseWithContinuationUserPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResponseWithContinuationUserPage) NotDone() bool { + return !page.rwcu.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResponseWithContinuationUserPage) Response() ResponseWithContinuationUser { + return page.rwcu +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResponseWithContinuationUserPage) Values() []User { + if page.rwcu.IsEmpty() { + return nil + } + return *page.rwcu.Value +} + +// Creates a new instance of the ResponseWithContinuationUserPage type. +func NewResponseWithContinuationUserPage(getNextPage func(context.Context, ResponseWithContinuationUser) (ResponseWithContinuationUser, error)) ResponseWithContinuationUserPage { + return ResponseWithContinuationUserPage{fn: getNextPage} +} + +// SizeAvailability represents the size information +type SizeAvailability struct { + // SizeCategory - The category of the size (Basic, Standard, Performance). Possible values include: 'Basic', 'Standard', 'Performance' + SizeCategory ManagedLabVMSize `json:"sizeCategory,omitempty"` + // IsAvailable - Whether or not this size category is available + IsAvailable *bool `json:"isAvailable,omitempty"` +} + +// SizeConfigurationProperties represents the size configuration under the lab account +type SizeConfigurationProperties struct { + // EnvironmentSizes - Represents a list of size categories supported by this Lab Account (Small, Medium, Large) + EnvironmentSizes *[]EnvironmentSize `json:"environmentSizes,omitempty"` +} + +// SizeConfigurationPropertiesFragment represents the size configuration under the lab account +type SizeConfigurationPropertiesFragment struct { + // EnvironmentSizes - Represents a list of size categories supported by this Lab Account (Small, Medium, Large) + EnvironmentSizes *[]EnvironmentSizeFragment `json:"environmentSizes,omitempty"` +} + +// SizeInfo contains detailed information about a size +type SizeInfo struct { + // ComputeSize - Represents the actual compute size, e.g. Standard_A2_v2. + ComputeSize *string `json:"computeSize,omitempty"` + // Price - The pay-as-you-go price per hour this size will cost. It does not include discounts and may not reflect the actual price the size will cost. + Price *decimal.Decimal `json:"price,omitempty"` + // NumberOfCores - The number of cores a VM of this size has. + NumberOfCores *int32 `json:"numberOfCores,omitempty"` + // Memory - The amount of memory available (in GB). + Memory *float64 `json:"memory,omitempty"` +} + +// SizeInfoFragment contains detailed information about a size +type SizeInfoFragment struct { + // ComputeSize - Represents the actual compute size, e.g. Standard_A2_v2. + ComputeSize *string `json:"computeSize,omitempty"` + // Price - The pay-as-you-go price per hour this size will cost. It does not include discounts and may not reflect the actual price the size will cost. + Price *decimal.Decimal `json:"price,omitempty"` + // NumberOfCores - The number of cores a VM of this size has. + NumberOfCores *int32 `json:"numberOfCores,omitempty"` + // Memory - The amount of memory available (in GB). + Memory *float64 `json:"memory,omitempty"` +} + +// User the User registered to a lab +type User struct { + autorest.Response `json:"-"` + // UserProperties - These are the properties for the user registered under a lab. + *UserProperties `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for User. +func (u User) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if u.UserProperties != nil { + objectMap["properties"] = u.UserProperties + } + if u.ID != nil { + objectMap["id"] = u.ID + } + if u.Name != nil { + objectMap["name"] = u.Name + } + if u.Type != nil { + objectMap["type"] = u.Type + } + if u.Location != nil { + objectMap["location"] = u.Location + } + if u.Tags != nil { + objectMap["tags"] = u.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for User struct. +func (u *User) 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 userProperties UserProperties + err = json.Unmarshal(*v, &userProperties) + if err != nil { + return err + } + u.UserProperties = &userProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + u.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + u.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + u.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + u.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + u.Tags = tags + } + } + } + + return nil +} + +// UserFragment the User registered to a lab +type UserFragment struct { + // UserPropertiesFragment - These are the properties for the user registered under a lab. + *UserPropertiesFragment `json:"properties,omitempty"` + // ID - The identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for UserFragment. +func (uf UserFragment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if uf.UserPropertiesFragment != nil { + objectMap["properties"] = uf.UserPropertiesFragment + } + if uf.ID != nil { + objectMap["id"] = uf.ID + } + if uf.Name != nil { + objectMap["name"] = uf.Name + } + if uf.Type != nil { + objectMap["type"] = uf.Type + } + if uf.Location != nil { + objectMap["location"] = uf.Location + } + if uf.Tags != nil { + objectMap["tags"] = uf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for UserFragment struct. +func (uf *UserFragment) 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 userPropertiesFragment UserPropertiesFragment + err = json.Unmarshal(*v, &userPropertiesFragment) + if err != nil { + return err + } + uf.UserPropertiesFragment = &userPropertiesFragment + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + uf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + uf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + uf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + uf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + uf.Tags = tags + } + } + } + + return nil +} + +// UserProperties lab User properties +type UserProperties struct { + // Email - The user email address, as it was specified during registration. + Email *string `json:"email,omitempty"` + // FamilyName - The user family name, as it was specified during registration. + FamilyName *string `json:"familyName,omitempty"` + // GivenName - The user given name, as it was specified during registration. + GivenName *string `json:"givenName,omitempty"` + // TenantID - The user tenant ID, as it was specified during registration. + TenantID *string `json:"tenantId,omitempty"` + // TotalUsage - How long the user has used his VMs in this lab + TotalUsage *string `json:"totalUsage,omitempty"` + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` + // LatestOperationResult - The details of the latest operation. ex: status, error + LatestOperationResult *LatestOperationResult `json:"latestOperationResult,omitempty"` +} + +// UserPropertiesFragment lab User properties +type UserPropertiesFragment struct { + // ProvisioningState - The provisioning status of the resource. + ProvisioningState *string `json:"provisioningState,omitempty"` + // UniqueIdentifier - The unique immutable identifier of a resource (Guid). + UniqueIdentifier *string `json:"uniqueIdentifier,omitempty"` +} + +// UsersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type UsersDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *UsersDeleteFuture) Result(client UsersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("ml.UsersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineDetails details of the backing virtual machine. +type VirtualMachineDetails struct { + // ProvisioningState - Provisioning state of the Dtl VM + ProvisioningState *string `json:"provisioningState,omitempty"` + // RdpAuthority - Connection information for Windows + RdpAuthority *string `json:"rdpAuthority,omitempty"` + // SSHAuthority - Connection information for Linux + SSHAuthority *string `json:"sshAuthority,omitempty"` + // PrivateIPAddress - PrivateIp address of the compute VM + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + // UserName - Compute VM login user name + UserName *string `json:"userName,omitempty"` + // LastKnownPowerState - Last known compute power state captured in DTL + LastKnownPowerState *string `json:"lastKnownPowerState,omitempty"` +} + +// VMStateDetails details about the state of the reference virtual machine. +type VMStateDetails struct { + // RdpAuthority - The RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). + RdpAuthority *string `json:"rdpAuthority,omitempty"` + // SSHAuthority - The SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. + SSHAuthority *string `json:"sshAuthority,omitempty"` + // PowerState - The power state of the reference virtual machine. + PowerState *string `json:"powerState,omitempty"` + // LastKnownPowerState - Last known compute power state captured in DTL + LastKnownPowerState *string `json:"lastKnownPowerState,omitempty"` +} diff --git a/services/labservices/mgmt/2018-10-15/ML/operations.go b/services/labservices/mgmt/2018-10-15/ML/operations.go new file mode 100644 index 000000000000..92ebc275b6dc --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/operations.go @@ -0,0 +1,118 @@ +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the Managed Labs Client. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get operation +// Parameters: +// locationName - the name of the location. +// operationName - the name of the operation. +func (client OperationsClient) Get(ctx context.Context, locationName string, operationName string) (result OperationResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, locationName, operationName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.OperationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.OperationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.OperationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationsClient) GetPreparer(ctx context.Context, locationName string, operationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "operationName": autorest.Encode("path", operationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{locationName}/operations/{operationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OperationsClient) GetResponder(resp *http.Response) (result OperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/labservices/mgmt/2018-10-15/ML/provideroperations.go b/services/labservices/mgmt/2018-10-15/ML/provideroperations.go new file mode 100644 index 000000000000..a87af532de62 --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/provideroperations.go @@ -0,0 +1,147 @@ +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProviderOperationsClient is the the Managed Labs Client. +type ProviderOperationsClient struct { + BaseClient +} + +// NewProviderOperationsClient creates an instance of the ProviderOperationsClient client. +func NewProviderOperationsClient(subscriptionID string) ProviderOperationsClient { + return NewProviderOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProviderOperationsClientWithBaseURI creates an instance of the ProviderOperationsClient client. +func NewProviderOperationsClientWithBaseURI(baseURI string, subscriptionID string) ProviderOperationsClient { + return ProviderOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List result of the request to list REST API operations +func (client ProviderOperationsClient) List(ctx context.Context) (result ProviderOperationResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsClient.List") + defer func() { + sc := -1 + if result.por.Response.Response != nil { + sc = result.por.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.ProviderOperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.por.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.ProviderOperationsClient", "List", resp, "Failure sending request") + return + } + + result.por, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.ProviderOperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ProviderOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.LabServices/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderOperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProviderOperationsClient) ListResponder(resp *http.Response) (result ProviderOperationResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ProviderOperationsClient) listNextResults(ctx context.Context, lastResults ProviderOperationResult) (result ProviderOperationResult, err error) { + req, err := lastResults.providerOperationResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "ml.ProviderOperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "ml.ProviderOperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.ProviderOperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProviderOperationsClient) ListComplete(ctx context.Context) (result ProviderOperationResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/labservices/mgmt/2018-10-15/ML/users.go b/services/labservices/mgmt/2018-10-15/ML/users.go new file mode 100644 index 000000000000..2a17621fcee6 --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/users.go @@ -0,0 +1,507 @@ +package ml + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// UsersClient is the the Managed Labs Client. +type UsersClient struct { + BaseClient +} + +// NewUsersClient creates an instance of the UsersClient client. +func NewUsersClient(subscriptionID string) UsersClient { + return NewUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsersClientWithBaseURI creates an instance of the UsersClient client. +func NewUsersClientWithBaseURI(baseURI string, subscriptionID string) UsersClient { + return UsersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or replace an existing User. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// userName - the name of the user. +// userParameter - the User registered to a lab +func (client UsersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string, userParameter User) (result User, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, labAccountName, labName, userName, userParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.UsersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client UsersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string, userParameter User) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}", pathParameters), + autorest.WithJSON(userParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client UsersClient) CreateOrUpdateResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete user. This operation can take a while to complete +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// userName - the name of the user. +func (client UsersClient) Delete(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string) (result UsersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, labAccountName, labName, userName) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client UsersClient) DeletePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) DeleteSender(req *http.Request) (future UsersDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client UsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get user +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// userName - the name of the user. +// expand - specify the $expand query. Example: 'properties($select=email)' +func (client UsersClient) Get(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string, expand string) (result User, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, labAccountName, labName, userName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.UsersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client UsersClient) GetPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client UsersClient) GetResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list users in a given lab. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// expand - specify the $expand query. Example: 'properties($select=email)' +// filter - the filter to apply to the operation. +// top - the maximum number of resources to return from the operation. +// orderby - the ordering expression for the results, using OData notation. +func (client UsersClient) List(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationUserPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.List") + defer func() { + sc := -1 + if result.rwcu.Response.Response != nil { + sc = result.rwcu.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, labAccountName, labName, expand, filter, top, orderby) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rwcu.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.UsersClient", "List", resp, "Failure sending request") + return + } + + result.rwcu, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsersClient) ListPreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string, filter string, top *int32, orderby string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsersClient) ListResponder(resp *http.Response) (result ResponseWithContinuationUser, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client UsersClient) listNextResults(ctx context.Context, lastResults ResponseWithContinuationUser) (result ResponseWithContinuationUser, err error) { + req, err := lastResults.responseWithContinuationUserPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "ml.UsersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "ml.UsersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsersClient) ListComplete(ctx context.Context, resourceGroupName string, labAccountName string, labName string, expand string, filter string, top *int32, orderby string) (result ResponseWithContinuationUserIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, labAccountName, labName, expand, filter, top, orderby) + return +} + +// Update modify properties of users. +// Parameters: +// resourceGroupName - the name of the resource group. +// labAccountName - the name of the lab Account. +// labName - the name of the lab. +// userName - the name of the user. +// userParameter - the User registered to a lab +func (client UsersClient) Update(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string, userParameter UserFragment) (result User, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, labAccountName, labName, userName, userParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "ml.UsersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "ml.UsersClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client UsersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, labAccountName string, labName string, userName string, userParameter UserFragment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "labAccountName": autorest.Encode("path", labAccountName), + "labName": autorest.Encode("path", labName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "userName": autorest.Encode("path", userName), + } + + const APIVersion = "2018-10-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}", pathParameters), + autorest.WithJSON(userParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client UsersClient) UpdateResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/labservices/mgmt/2018-10-15/ML/version.go b/services/labservices/mgmt/2018-10-15/ML/version.go new file mode 100644 index 000000000000..9641c85a97c1 --- /dev/null +++ b/services/labservices/mgmt/2018-10-15/ML/version.go @@ -0,0 +1,30 @@ +package ml + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " ml/2018-10-15" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}