diff --git a/sdk/resourcemanager/testbase/armtestbase/CHANGELOG.md b/sdk/resourcemanager/testbase/armtestbase/CHANGELOG.md index 269c410e11da..0b30338d8279 100644 --- a/sdk/resourcemanager/testbase/armtestbase/CHANGELOG.md +++ b/sdk/resourcemanager/testbase/armtestbase/CHANGELOG.md @@ -1,5 +1,234 @@ # Release History +## 0.7.0 (2023-11-08) +### Breaking Changes + +- Type of `ErrorResponse.Error` has been changed from `*ErrorDefinition` to `*ErrorDetail` +- Type of `Operation.Origin` has been changed from `*string` to `*Origin` +- Struct `ErrorDefinition` has been removed +- Field `Etag` of struct `AccountResource` has been removed +- Field `Properties` of struct `Operation` has been removed +- Field `Etag` of struct `PackageResource` has been removed +- Field `Etag` of struct `TrackedResource` has been removed + +### Features Added + +- New value `ActionFlowDrivenCustom` added to enum type `Action` +- New value `OsUpdateTypeInplaceUpgrade` added to enum type `OsUpdateType` +- New value `TestTypeFlowDrivenTest` added to enum type `TestType` +- New value `TypeInplaceUpgrade` added to enum type `Type` +- New enum type `ActionType` with values `ActionTypeInternal` +- New enum type `ApplicationType` with values `ApplicationTypeWinget` +- New enum type `Architecture` with values `ArchitectureArm64`, `ArchitectureX64`, `ArchitectureX86` +- New enum type `CredentialType` with values `CredentialTypeIntuneAccount` +- New enum type `DraftPackageSourceType` with values `DraftPackageSourceTypeGalleryApp`, `DraftPackageSourceTypeIntuneEnrollment`, `DraftPackageSourceTypeIntuneWin`, `DraftPackageSourceTypeNative`, `DraftPackageSourceTypeTestBasePackage` +- New enum type `Engagements` with values `EngagementsMAPP`, `EngagementsMVI`, `EngagementsMVP`, `EngagementsOther`, `EngagementsSUVP` +- New enum type `ExtractFileType` with values `ExtractFileTypeIntuneWinPackage`, `ExtractFileTypeTestBasePackage` +- New enum type `FileUploadResourceType` with values `FileUploadResourceTypePackage`, `FileUploadResourceTypeVHD` +- New enum type `FreeHourBalanceName` with values `FreeHourBalanceNameSubscriptionLevel`, `FreeHourBalanceNameTenantLevel` +- New enum type `FreeHourStatus` with values `FreeHourStatusEnabled`, `FreeHourStatusSuspended` +- New enum type `FreeHourType` with values `FreeHourTypePermanent`, `FreeHourTypeTemporary` +- New enum type `ImageArchitecture` with values `ImageArchitectureX64` +- New enum type `ImageOSState` with values `ImageOSStateGeneralized`, `ImageOSStateSpecialized` +- New enum type `ImageSecurityType` with values `ImageSecurityTypeStandard`, `ImageSecurityTypeTrustedLaunch` +- New enum type `ImageSource` with values `ImageSourceUnknown`, `ImageSourceVHD` +- New enum type `ImageStatus` with values `ImageStatusFailed`, `ImageStatusReady`, `ImageStatusUnknown`, `ImageStatusValidating` +- New enum type `InteropExecutionMode` with values `InteropExecutionModeFirstPartyApp`, `InteropExecutionModeFirstPartyAppWithTests` +- New enum type `IntuneExtractStatus` with values `IntuneExtractStatusExtractFailed`, `IntuneExtractStatusNoDependencyApp`, `IntuneExtractStatusReady`, `IntuneExtractStatusUploadFailed`, `IntuneExtractStatusUploading` +- New enum type `OrderBy` with values `OrderByPopularity`, `OrderByRelevance` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `OsProductState` with values `OsProductStateActive`, `OsProductStateDisabled` +- New enum type `PackageStudioTabs` with values `PackageStudioTabsBasicsTab`, `PackageStudioTabsConfigureTestTab`, `PackageStudioTabsEditPackageTab`, `PackageStudioTabsReviewAndCreateTab`, `PackageStudioTabsTagsTab`, `PackageStudioTabsTestMatrixTab`, `PackageStudioTabsUnspecified` +- New enum type `RequestStatus` with values `RequestStatusApproved`, `RequestStatusDeclined`, `RequestStatusInReview` +- New enum type `RequestTypes` with values `RequestTypesPreReleaseAccess` +- New enum type `SystemAssignedServiceIdentityType` with values `SystemAssignedServiceIdentityTypeNone`, `SystemAssignedServiceIdentityTypeSystemAssigned` +- New enum type `VHDStatus` with values `VHDStatusFailed`, `VHDStatusOccupied`, `VHDStatusReady`, `VHDStatusUnknown`, `VHDStatusVerifying` +- New enum type `VerificationStatus` with values `VerificationStatusFailed`, `VerificationStatusPassed` +- New function `NewActionRequestsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ActionRequestsClient, error)` +- New function `*ActionRequestsClient.Delete(context.Context, string, string, string, *ActionRequestsClientDeleteOptions) (ActionRequestsClientDeleteResponse, error)` +- New function `*ActionRequestsClient.Get(context.Context, string, string, string, *ActionRequestsClientGetOptions) (ActionRequestsClientGetResponse, error)` +- New function `*ActionRequestsClient.NewListPager(string, string, *ActionRequestsClientListOptions) *runtime.Pager[ActionRequestsClientListResponse]` +- New function `*ActionRequestsClient.Put(context.Context, string, string, string, *ActionRequestsClientPutOptions) (ActionRequestsClientPutResponse, error)` +- New function `NewAvailableInplaceUpgradeOSClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AvailableInplaceUpgradeOSClient, error)` +- New function `*AvailableInplaceUpgradeOSClient.Get(context.Context, string, string, string, *AvailableInplaceUpgradeOSClientGetOptions) (AvailableInplaceUpgradeOSClientGetResponse, error)` +- New function `*AvailableInplaceUpgradeOSClient.NewListPager(string, string, OsUpdateType, *AvailableInplaceUpgradeOSClientListOptions) *runtime.Pager[AvailableInplaceUpgradeOSClientListResponse]` +- New function `NewBillingHubServiceClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BillingHubServiceClient, error)` +- New function `*BillingHubServiceClient.GetFreeHourBalance(context.Context, string, string, *BillingHubServiceClientGetFreeHourBalanceOptions) (BillingHubServiceClientGetFreeHourBalanceResponse, error)` +- New function `*BillingHubServiceClient.GetUsage(context.Context, string, string, *BillingHubServiceClientGetUsageOptions) (BillingHubServiceClientGetUsageResponse, error)` +- New function `NewChatSessionClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ChatSessionClient, error)` +- New function `*ChatSessionClient.BeginChat(context.Context, string, string, string, ChatRequest, *ChatSessionClientBeginChatOptions) (*runtime.Poller[ChatSessionClientChatResponse], error)` +- New function `NewChatSessionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ChatSessionsClient, error)` +- New function `*ChatSessionsClient.Get(context.Context, string, string, string, *ChatSessionsClientGetOptions) (ChatSessionsClientGetResponse, error)` +- New function `*ChatSessionsClient.NewListPager(string, string, *ChatSessionsClientListOptions) *runtime.Pager[ChatSessionsClientListResponse]` +- New function `*ClientFactory.NewActionRequestsClient() *ActionRequestsClient` +- New function `*ClientFactory.NewAvailableInplaceUpgradeOSClient() *AvailableInplaceUpgradeOSClient` +- New function `*ClientFactory.NewBillingHubServiceClient() *BillingHubServiceClient` +- New function `*ClientFactory.NewChatSessionClient() *ChatSessionClient` +- New function `*ClientFactory.NewChatSessionsClient() *ChatSessionsClient` +- New function `*ClientFactory.NewCredentialClient() *CredentialClient` +- New function `*ClientFactory.NewCredentialsClient() *CredentialsClient` +- New function `*ClientFactory.NewCustomImagesClient() *CustomImagesClient` +- New function `*ClientFactory.NewDraftPackagesClient() *DraftPackagesClient` +- New function `*ClientFactory.NewFeatureUpdateSupportedOsesClient() *FeatureUpdateSupportedOsesClient` +- New function `*ClientFactory.NewFirstPartyAppsClient() *FirstPartyAppsClient` +- New function `*ClientFactory.NewFreeHourBalancesClient() *FreeHourBalancesClient` +- New function `*ClientFactory.NewGalleryAppSKUsClient() *GalleryAppSKUsClient` +- New function `*ClientFactory.NewGalleryAppsClient() *GalleryAppsClient` +- New function `*ClientFactory.NewImageDefinitionsClient() *ImageDefinitionsClient` +- New function `*ClientFactory.NewVHDsClient() *VHDsClient` +- New function `NewCredentialClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CredentialClient, error)` +- New function `*CredentialClient.Get(context.Context, string, string, string, *CredentialClientGetOptions) (CredentialClientGetResponse, error)` +- New function `*CredentialClient.NewListByTestBaseAccountPager(string, string, *CredentialClientListByTestBaseAccountOptions) *runtime.Pager[CredentialClientListByTestBaseAccountResponse]` +- New function `*CredentialProperties.GetCredentialProperties() *CredentialProperties` +- New function `NewCredentialsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CredentialsClient, error)` +- New function `*CredentialsClient.Create(context.Context, string, string, string, CredentialResource, *CredentialsClientCreateOptions) (CredentialsClientCreateResponse, error)` +- New function `*CredentialsClient.Delete(context.Context, string, string, string, *CredentialsClientDeleteOptions) (CredentialsClientDeleteResponse, error)` +- New function `*CredentialsClient.Update(context.Context, string, string, string, CredentialResource, *CredentialsClientUpdateOptions) (CredentialsClientUpdateResponse, error)` +- New function `NewCustomImagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CustomImagesClient, error)` +- New function `*CustomImagesClient.CheckImageNameAvailability(context.Context, string, string, ImageNameCheckAvailabilityParameters, *CustomImagesClientCheckImageNameAvailabilityOptions) (CustomImagesClientCheckImageNameAvailabilityResponse, error)` +- New function `*CustomImagesClient.BeginCreate(context.Context, string, string, string, CustomImageResource, *CustomImagesClientBeginCreateOptions) (*runtime.Poller[CustomImagesClientCreateResponse], error)` +- New function `*CustomImagesClient.BeginDelete(context.Context, string, string, string, *CustomImagesClientBeginDeleteOptions) (*runtime.Poller[CustomImagesClientDeleteResponse], error)` +- New function `*CustomImagesClient.Get(context.Context, string, string, string, *CustomImagesClientGetOptions) (CustomImagesClientGetResponse, error)` +- New function `*CustomImagesClient.NewListByTestBaseAccountPager(string, string, *CustomImagesClientListByTestBaseAccountOptions) *runtime.Pager[CustomImagesClientListByTestBaseAccountResponse]` +- New function `NewDraftPackagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DraftPackagesClient, error)` +- New function `*DraftPackagesClient.BeginCopyFromPackage(context.Context, string, string, string, CopyFromPackageOperationParameters, *DraftPackagesClientBeginCopyFromPackageOptions) (*runtime.Poller[DraftPackagesClientCopyFromPackageResponse], error)` +- New function `*DraftPackagesClient.Create(context.Context, string, string, string, DraftPackageResource, *DraftPackagesClientCreateOptions) (DraftPackagesClientCreateResponse, error)` +- New function `*DraftPackagesClient.Delete(context.Context, string, string, string, *DraftPackagesClientDeleteOptions) (DraftPackagesClientDeleteResponse, error)` +- New function `*DraftPackagesClient.BeginExtractFile(context.Context, string, string, string, ExtractFileOperationParameters, *DraftPackagesClientBeginExtractFileOptions) (*runtime.Poller[DraftPackagesClientExtractFileResponse], error)` +- New function `*DraftPackagesClient.BeginGenerateFoldersAndScripts(context.Context, string, string, string, GenerateOperationParameters, *DraftPackagesClientBeginGenerateFoldersAndScriptsOptions) (*runtime.Poller[DraftPackagesClientGenerateFoldersAndScriptsResponse], error)` +- New function `*DraftPackagesClient.Get(context.Context, string, string, string, *DraftPackagesClientGetOptions) (DraftPackagesClientGetResponse, error)` +- New function `*DraftPackagesClient.GetPath(context.Context, string, string, string, *DraftPackagesClientGetPathOptions) (DraftPackagesClientGetPathResponse, error)` +- New function `*DraftPackagesClient.NewListByTestBaseAccountPager(string, string, *DraftPackagesClientListByTestBaseAccountOptions) *runtime.Pager[DraftPackagesClientListByTestBaseAccountResponse]` +- New function `*DraftPackagesClient.Update(context.Context, string, string, string, DraftPackageUpdateParameters, *DraftPackagesClientUpdateOptions) (DraftPackagesClientUpdateResponse, error)` +- New function `NewFeatureUpdateSupportedOsesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FeatureUpdateSupportedOsesClient, error)` +- New function `*FeatureUpdateSupportedOsesClient.NewListPager(string, string, *FeatureUpdateSupportedOsesClientListOptions) *runtime.Pager[FeatureUpdateSupportedOsesClientListResponse]` +- New function `NewFirstPartyAppsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FirstPartyAppsClient, error)` +- New function `*FirstPartyAppsClient.Get(context.Context, string, string, string, *FirstPartyAppsClientGetOptions) (FirstPartyAppsClientGetResponse, error)` +- New function `*FirstPartyAppsClient.NewListPager(string, string, *FirstPartyAppsClientListOptions) *runtime.Pager[FirstPartyAppsClientListResponse]` +- New function `NewFreeHourBalancesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FreeHourBalancesClient, error)` +- New function `*FreeHourBalancesClient.Get(context.Context, string, string, FreeHourBalanceName, *FreeHourBalancesClientGetOptions) (FreeHourBalancesClientGetResponse, error)` +- New function `*FreeHourBalancesClient.NewListPager(string, string, *FreeHourBalancesClientListOptions) *runtime.Pager[FreeHourBalancesClientListResponse]` +- New function `*GalleryAppSKUProperties.GetGalleryAppSKUProperties() *GalleryAppSKUProperties` +- New function `NewGalleryAppSKUsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GalleryAppSKUsClient, error)` +- New function `*GalleryAppSKUsClient.Get(context.Context, string, string, string, string, *GalleryAppSKUsClientGetOptions) (GalleryAppSKUsClientGetResponse, error)` +- New function `*GalleryAppSKUsClient.NewListPager(string, string, string, *GalleryAppSKUsClientListOptions) *runtime.Pager[GalleryAppSKUsClientListResponse]` +- New function `NewGalleryAppsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GalleryAppsClient, error)` +- New function `*GalleryAppsClient.Get(context.Context, string, string, string, *GalleryAppsClientGetOptions) (GalleryAppsClientGetResponse, error)` +- New function `*GalleryAppsClient.NewListPager(string, string, *GalleryAppsClientListOptions) *runtime.Pager[GalleryAppsClientListResponse]` +- New function `NewImageDefinitionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ImageDefinitionsClient, error)` +- New function `*ImageDefinitionsClient.Create(context.Context, string, string, string, ImageDefinitionResource, *ImageDefinitionsClientCreateOptions) (ImageDefinitionsClientCreateResponse, error)` +- New function `*ImageDefinitionsClient.Delete(context.Context, string, string, string, *ImageDefinitionsClientDeleteOptions) (ImageDefinitionsClientDeleteResponse, error)` +- New function `*ImageDefinitionsClient.Get(context.Context, string, string, string, *ImageDefinitionsClientGetOptions) (ImageDefinitionsClientGetResponse, error)` +- New function `*ImageDefinitionsClient.NewListByTestBaseAccountPager(string, string, *ImageDefinitionsClientListByTestBaseAccountOptions) *runtime.Pager[ImageDefinitionsClientListByTestBaseAccountResponse]` +- New function `*IntuneSingletonResourceProperties.GetCredentialProperties() *CredentialProperties` +- New function `*PackagesClient.RunTest(context.Context, string, string, string, *PackagesClientRunTestOptions) (PackagesClientRunTestResponse, error)` +- New function `*TestResultsClient.GetConsoleLogDownloadURL(context.Context, string, string, string, string, TestResultConsoleLogDownloadURLParameters, *TestResultsClientGetConsoleLogDownloadURLOptions) (TestResultsClientGetConsoleLogDownloadURLResponse, error)` +- New function `NewVHDsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*VHDsClient, error)` +- New function `*VHDsClient.Delete(context.Context, string, string, string, *VHDsClientDeleteOptions) (VHDsClientDeleteResponse, error)` +- New function `*VHDsClient.Get(context.Context, string, string, string, *VHDsClientGetOptions) (VHDsClientGetResponse, error)` +- New function `*VHDsClient.NewListByTestBaseAccountPager(string, string, *VHDsClientListByTestBaseAccountOptions) *runtime.Pager[VHDsClientListByTestBaseAccountResponse]` +- New function `*WingetAppSKUProperties.GetGalleryAppSKUProperties() *GalleryAppSKUProperties` +- New struct `ActionRequest` +- New struct `ActionRequestProperties` +- New struct `ActionRequests` +- New struct `AnswerCitation` +- New struct `AvailableInplaceUpgradeOSListResult` +- New struct `AvailableInplaceUpgradeOSProperties` +- New struct `AvailableInplaceUpgradeOSResource` +- New struct `BillingHubExecutionUsageDetail` +- New struct `BillingHubFreeHourIncrementEntry` +- New struct `BillingHubGetFreeHourBalanceResponse` +- New struct `BillingHubGetUsageRequest` +- New struct `BillingHubGetUsageResponse` +- New struct `BillingHubPackageUsage` +- New struct `BillingHubUsage` +- New struct `BillingHubUsageGroup` +- New struct `BillingHubUsageGroupedByUpdateType` +- New struct `ChatRequest` +- New struct `ChatResponse` +- New struct `ChatResponseProperties` +- New struct `ChatSessionProperties` +- New struct `ChatSessionResource` +- New struct `ChatSessionResourceListResult` +- New struct `CopyFromPackageOperationParameters` +- New struct `CredentialListResult` +- New struct `CredentialResource` +- New struct `CustomImageListResult` +- New struct `CustomImageProperties` +- New struct `CustomImageResource` +- New struct `DraftPackageGetPathResponse` +- New struct `DraftPackageIntuneAppMetadata` +- New struct `DraftPackageIntuneAppMetadataItem` +- New struct `DraftPackageListResult` +- New struct `DraftPackageProperties` +- New struct `DraftPackageResource` +- New struct `DraftPackageUpdateParameterProperties` +- New struct `DraftPackageUpdateParameters` +- New struct `EnrolledIntuneApp` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ExtractFileOperationParameters` +- New struct `FeatureUpdateSupportedOsesProperties` +- New struct `FeatureUpdateSupportedOsesResource` +- New struct `FeatureUpdateSupportedOsesResult` +- New struct `FirstPartyAppDefinition` +- New struct `FirstPartyAppListResult` +- New struct `FirstPartyAppProperties` +- New struct `FirstPartyAppResource` +- New struct `FreeHourBalanceResource` +- New struct `FreeHourBalancesListResult` +- New struct `GalleryAppDefinition` +- New struct `GalleryAppListResult` +- New struct `GalleryAppProperties` +- New struct `GalleryAppResource` +- New struct `GalleryAppSKUListResult` +- New struct `GalleryAppSKUResource` +- New struct `GenerateOperationParameters` +- New struct `GetImageDefinitionParameters` +- New struct `HighlightedFile` +- New struct `ImageDefinitionListResult` +- New struct `ImageDefinitionProperties` +- New struct `ImageDefinitionResource` +- New struct `ImageDefinitionsListResult` +- New struct `ImageNameCheckAvailabilityParameters` +- New struct `ImageValidationResults` +- New struct `InplaceUpgradeOSInfo` +- New struct `InplaceUpgradeProperties` +- New struct `IntuneEnrollmentMetadata` +- New struct `IntuneSingletonResourceProperties` +- New struct `OsProperties` +- New struct `PackageRunTestParameters` +- New struct `PreReleaseAccessRequestSpec` +- New struct `ReleaseProperties` +- New struct `SystemAssignedServiceIdentity` +- New struct `TabState` +- New struct `TestResultConsoleLogDownloadURLParameters` +- New struct `TestResultFirstPartyAppDefinition` +- New struct `VHDListResult` +- New struct `VHDProperties` +- New struct `VHDResource` +- New struct `VerificationResult` +- New struct `WingetAppSKUProperties` +- New field `Identity` in struct `AccountResource` +- New field `Identity` in struct `AccountUpdateParameters` +- New field `EnrollIntuneBefore`, `Install1PAppBefore`, `PostUpgrade`, `PreUpgrade` in struct `Command` +- New field `ResourceType` in struct `GetFileUploadURLParameters` +- New field `CustomImageDisplayName`, `CustomImageID`, `InplaceUpgradeBaselineProperties` in struct `OSUpdateProperties` +- New field `CustomImageDisplayName`, `CustomImageID`, `InplaceUpgradeBaselineProperties` in struct `OSUpdateTestSummary` +- New field `ActionType` in struct `Operation` +- New field `DraftPackageID`, `FirstPartyApps`, `GalleryApps`, `InplaceUpgradeOSPair`, `IntuneEnrollmentMetadata` in struct `PackageProperties` +- New field `DraftPackageID`, `FirstPartyApps`, `InplaceUpgradeOSPair`, `IntuneEnrollmentMetadata` in struct `PackageUpdateParameterProperties` +- New field `SystemData` in struct `ProxyResource` +- New field `InplaceUpgradeBaselineReliabilityResults` in struct `ReliabilityResultSingletonResourceProperties` +- New field `SystemData` in struct `Resource` +- New field `StderrLogFileName`, `StdoutLogFileName` in struct `ScriptExecutionResult` +- New field `BaselineOSs`, `InsiderChannelIDs`, `TargetOSImageIDs` in struct `TargetOSInfo` +- New field `ValidationResultID` in struct `Test` +- New field `CustomImageDisplayName`, `CustomImageID`, `FirstPartyApps`, `InplaceUpgradeProperties`, `InteropMediaType`, `InteropMediaVersion`, `TestEndTime`, `TestStartTime` in struct `TestResultProperties` +- New field `InplaceUpgradesTestSummary`, `PackageTags` in struct `TestSummaryProperties` +- New field `SystemData` in struct `TrackedResource` + + ## 0.6.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/testbase/armtestbase/accounts_client.go b/sdk/resourcemanager/testbase/armtestbase/accounts_client.go index d1fedea9e5d7..f0c740562de2 100644 --- a/sdk/resourcemanager/testbase/armtestbase/accounts_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/accounts_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -30,7 +29,7 @@ type AccountsClient struct { } // NewAccountsClient creates a new instance of AccountsClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountsClient, error) { @@ -48,33 +47,33 @@ func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, // CheckPackageNameAvailability - Checks that the Test Base Package name and version is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - parameters - Parameters supplied to the Test Base Package CheckNameAvailability operation. // - options - AccountsClientCheckPackageNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckPackageNameAvailability // method. func (client *AccountsClient) CheckPackageNameAvailability(ctx context.Context, resourceGroupName string, testBaseAccountName string, parameters PackageCheckNameAvailabilityParameters, options *AccountsClientCheckPackageNameAvailabilityOptions) (AccountsClientCheckPackageNameAvailabilityResponse, error) { + var err error req, err := client.checkPackageNameAvailabilityCreateRequest(ctx, resourceGroupName, testBaseAccountName, parameters, options) if err != nil { return AccountsClientCheckPackageNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientCheckPackageNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AccountsClientCheckPackageNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientCheckPackageNameAvailabilityResponse{}, err } - return client.checkPackageNameAvailabilityHandleResponse(resp) + resp, err := client.checkPackageNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkPackageNameAvailabilityCreateRequest creates the CheckPackageNameAvailability request. func (client *AccountsClient) checkPackageNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, parameters PackageCheckNameAvailabilityParameters, options *AccountsClientCheckPackageNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/checkPackageNameAvailability" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -89,10 +88,13 @@ func (client *AccountsClient) checkPackageNameAvailabilityCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // checkPackageNameAvailabilityHandleResponse handles the CheckPackageNameAvailability response. @@ -107,8 +109,8 @@ func (client *AccountsClient) checkPackageNameAvailabilityHandleResponse(resp *h // BeginCreate - Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - parameters - Parameters supplied to create a Test Base Account. // - options - AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method. @@ -118,9 +120,10 @@ func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[AccountsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -129,28 +132,27 @@ func (client *AccountsClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified subscription. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview func (client *AccountsClient) create(ctx context.Context, resourceGroupName string, testBaseAccountName string, parameters AccountResource, options *AccountsClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, testBaseAccountName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, parameters AccountResource, options *AccountsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -168,17 +170,20 @@ func (client *AccountsClient) createCreateRequest(ctx context.Context, resourceG if options != nil && options.Restore != nil { reqQP.Set("restore", strconv.FormatBool(*options.Restore)) } - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *AccountsClientBeginDeleteOptions) (*runtime.Poller[AccountsClientDeleteResponse], error) { @@ -187,9 +192,10 @@ func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[AccountsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -198,28 +204,27 @@ func (client *AccountsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *AccountsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *AccountsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -234,7 +239,7 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,31 +248,31 @@ func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. func (client *AccountsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *AccountsClientGetOptions) (AccountsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) if err != nil { return AccountsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AccountsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *AccountsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -282,7 +287,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -300,32 +305,32 @@ func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsCl // GetFileUploadURL - Gets the file upload URL of a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - AccountsClientGetFileUploadURLOptions contains the optional parameters for the AccountsClient.GetFileUploadURL // method. func (client *AccountsClient) GetFileUploadURL(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *AccountsClientGetFileUploadURLOptions) (AccountsClientGetFileUploadURLResponse, error) { + var err error req, err := client.getFileUploadURLCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) if err != nil { return AccountsClientGetFileUploadURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AccountsClientGetFileUploadURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AccountsClientGetFileUploadURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AccountsClientGetFileUploadURLResponse{}, err } - return client.getFileUploadURLHandleResponse(resp) + resp, err := client.getFileUploadURLHandleResponse(httpResp) + return resp, err } // getFileUploadURLCreateRequest creates the GetFileUploadURL request. func (client *AccountsClient) getFileUploadURLCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *AccountsClientGetFileUploadURLOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFileUploadUrl" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -340,11 +345,14 @@ func (client *AccountsClient) getFileUploadURLCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Parameters != nil { - return req, runtime.MarshalAsJSON(req, *options.Parameters) + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil } return req, nil } @@ -360,8 +368,8 @@ func (client *AccountsClient) getFileUploadURLHandleResponse(resp *http.Response // NewListByResourceGroupPager - Lists all the Test Base Accounts in a resource group. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager // method. func (client *AccountsClient) NewListByResourceGroupPager(resourceGroupName string, options *AccountsClientListByResourceGroupOptions) *runtime.Pager[AccountsClientListByResourceGroupResponse] { @@ -395,9 +403,6 @@ func (client *AccountsClient) NewListByResourceGroupPager(resourceGroupName stri // listByResourceGroupCreateRequest creates the ListByResourceGroup request. func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AccountsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -411,7 +416,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte if options != nil && options.GetDeleted != nil { reqQP.Set("getDeleted", strconv.FormatBool(*options.GetDeleted)) } - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -426,9 +431,9 @@ func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Respo return result, nil } -// NewListBySubscriptionPager - Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. +// NewListBySubscriptionPager - Lists all the Test Base Accounts in a subscription. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview // - options - AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.NewListBySubscriptionPager // method. func (client *AccountsClient) NewListBySubscriptionPager(options *AccountsClientListBySubscriptionOptions) *runtime.Pager[AccountsClientListBySubscriptionResponse] { @@ -462,9 +467,6 @@ func (client *AccountsClient) NewListBySubscriptionPager(options *AccountsClient // listBySubscriptionCreateRequest creates the ListBySubscription request. func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AccountsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/testBaseAccounts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -474,7 +476,7 @@ func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Contex if options != nil && options.GetDeleted != nil { reqQP.Set("getDeleted", strconv.FormatBool(*options.GetDeleted)) } - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -492,8 +494,8 @@ func (client *AccountsClient) listBySubscriptionHandleResponse(resp *http.Respon // BeginOffboard - Offboard a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - AccountsClientBeginOffboardOptions contains the optional parameters for the AccountsClient.BeginOffboard method. func (client *AccountsClient) BeginOffboard(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *AccountsClientBeginOffboardOptions) (*runtime.Poller[AccountsClientOffboardResponse], error) { @@ -502,9 +504,10 @@ func (client *AccountsClient) BeginOffboard(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientOffboardResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientOffboardResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[AccountsClientOffboardResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -513,28 +516,27 @@ func (client *AccountsClient) BeginOffboard(ctx context.Context, resourceGroupNa // Offboard - Offboard a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview func (client *AccountsClient) offboard(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *AccountsClientBeginOffboardOptions) (*http.Response, error) { + var err error req, err := client.offboardCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // offboardCreateRequest creates the Offboard request. func (client *AccountsClient) offboardCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *AccountsClientBeginOffboardOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/offboard" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -549,7 +551,7 @@ func (client *AccountsClient) offboardCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -558,8 +560,8 @@ func (client *AccountsClient) offboardCreateRequest(ctx context.Context, resourc // BeginUpdate - Update an existing Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - parameters - Parameters supplied to update a Test Base Account. // - options - AccountsClientBeginUpdateOptions contains the optional parameters for the AccountsClient.BeginUpdate method. @@ -569,9 +571,10 @@ func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AccountsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[AccountsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -580,28 +583,27 @@ func (client *AccountsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Update an existing Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview func (client *AccountsClient) update(ctx context.Context, resourceGroupName string, testBaseAccountName string, parameters AccountUpdateParameters, options *AccountsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, testBaseAccountName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, parameters AccountUpdateParameters, options *AccountsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -616,8 +618,11 @@ func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/testbase/armtestbase/accounts_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/accounts_client_example_test.go deleted file mode 100644 index d69e95df3c11..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/accounts_client_example_test.go +++ /dev/null @@ -1,457 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountsListBySubscription.json -func ExampleAccountsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountsClient().NewListBySubscriptionPager(&armtestbase.AccountsClientListBySubscriptionOptions{GetDeleted: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AccountListResult = armtestbase.AccountListResult{ - // Value: []*armtestbase.AccountResource{ - // { - // Name: to.Ptr("contoso-testBaseAccount1"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.AccountResourceProperties{ - // AccessLevel: to.Ptr("EarlyAccess"), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // SKU: &armtestbase.AccountSKU{ - // Name: to.Ptr("S0"), - // Capabilities: []*armtestbase.AccountSKUCapability{ - // { - // Name: to.Ptr("SLA"), - // Value: to.Ptr("99.9%"), - // }, - // { - // Name: to.Ptr("maximumPackageCount"), - // Value: to.Ptr("5"), - // }, - // { - // Name: to.Ptr("packageMaximumRunSeconds"), - // Value: to.Ptr("3600"), - // }}, - // Tier: to.Ptr(armtestbase.TierStandard), - // }, - // }, - // }, - // { - // Name: to.Ptr("contoso-testBaseAccount2"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg2/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.AccountResourceProperties{ - // AccessLevel: to.Ptr("EarlyAccess"), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // SKU: &armtestbase.AccountSKU{ - // Name: to.Ptr("S0"), - // Capabilities: []*armtestbase.AccountSKUCapability{ - // { - // Name: to.Ptr("SLA"), - // Value: to.Ptr("99.999%"), - // }, - // { - // Name: to.Ptr("maximumPackageCount"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("packageMaximumRunSeconds"), - // Value: to.Ptr("10800"), - // }}, - // Tier: to.Ptr(armtestbase.TierStandard), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountsList.json -func ExampleAccountsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountsClient().NewListByResourceGroupPager("contoso-rg1", &armtestbase.AccountsClientListByResourceGroupOptions{GetDeleted: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AccountListResult = armtestbase.AccountListResult{ - // Value: []*armtestbase.AccountResource{ - // { - // Name: to.Ptr("contoso-testBaseAccount1"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.AccountResourceProperties{ - // AccessLevel: to.Ptr("EarlyAccess"), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // SKU: &armtestbase.AccountSKU{ - // Name: to.Ptr("S0"), - // Capabilities: []*armtestbase.AccountSKUCapability{ - // { - // Name: to.Ptr("SLA"), - // Value: to.Ptr("99.9%"), - // }, - // { - // Name: to.Ptr("maximumPackageCount"), - // Value: to.Ptr("5"), - // }, - // { - // Name: to.Ptr("packageMaximumRunSeconds"), - // Value: to.Ptr("3600"), - // }}, - // Tier: to.Ptr(armtestbase.TierStandard), - // }, - // }, - // }, - // { - // Name: to.Ptr("contoso-testBaseAccount2"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg2/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.AccountResourceProperties{ - // AccessLevel: to.Ptr("EarlyAccess"), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // SKU: &armtestbase.AccountSKU{ - // Name: to.Ptr("S0"), - // Capabilities: []*armtestbase.AccountSKUCapability{ - // { - // Name: to.Ptr("SLA"), - // Value: to.Ptr("99.999%"), - // }, - // { - // Name: to.Ptr("maximumPackageCount"), - // Value: to.Ptr("100"), - // }, - // { - // Name: to.Ptr("packageMaximumRunSeconds"), - // Value: to.Ptr("10800"), - // }}, - // Tier: to.Ptr(armtestbase.TierStandard), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountCreate.json -func ExampleAccountsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginCreate(ctx, "contoso-rg1", "contoso-testBaseAccount1", armtestbase.AccountResource{ - Location: to.Ptr("westus"), - Properties: &armtestbase.AccountResourceProperties{ - SKU: &armtestbase.AccountSKU{ - Name: to.Ptr("S0"), - Tier: to.Ptr(armtestbase.TierStandard), - }, - }, - }, &armtestbase.AccountsClientBeginCreateOptions{Restore: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccountResource = armtestbase.AccountResource{ - // Name: to.Ptr("contoso-testBaseAccount1"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.AccountResourceProperties{ - // AccessLevel: to.Ptr("StandardAccess"), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // SKU: &armtestbase.AccountSKU{ - // Name: to.Ptr("S0"), - // Capabilities: []*armtestbase.AccountSKUCapability{ - // { - // Name: to.Ptr("SLA"), - // Value: to.Ptr("99.9%"), - // }, - // { - // Name: to.Ptr("maximumPackageCount"), - // Value: to.Ptr("5"), - // }, - // { - // Name: to.Ptr("packageMaximumRunSeconds"), - // Value: to.Ptr("3600"), - // }}, - // Tier: to.Ptr(armtestbase.TierStandard), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountUpdate.json -func ExampleAccountsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginUpdate(ctx, "contoso-rg1", "contoso-testBaseAccount1", armtestbase.AccountUpdateParameters{ - Properties: &armtestbase.AccountUpdateParameterProperties{ - SKU: &armtestbase.AccountSKU{ - Name: to.Ptr("S0"), - Tier: to.Ptr(armtestbase.TierStandard), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccountResource = armtestbase.AccountResource{ - // Name: to.Ptr("contoso-testBaseAccount1"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.AccountResourceProperties{ - // AccessLevel: to.Ptr("EarlyAccess"), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // SKU: &armtestbase.AccountSKU{ - // Name: to.Ptr("S0"), - // Capabilities: []*armtestbase.AccountSKUCapability{ - // { - // Name: to.Ptr("SLA"), - // Value: to.Ptr("99.9%"), - // }, - // { - // Name: to.Ptr("maximumPackageCount"), - // Value: to.Ptr("5"), - // }, - // { - // Name: to.Ptr("packageMaximumRunSeconds"), - // Value: to.Ptr("3600"), - // }}, - // Tier: to.Ptr(armtestbase.TierStandard), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountDelete.json -func ExampleAccountsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginDelete(ctx, "contoso-rg1", "contoso-testBaseAccount1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountGet.json -func ExampleAccountsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AccountResource = armtestbase.AccountResource{ - // Name: to.Ptr("contoso-testBaseAccount1"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.AccountResourceProperties{ - // AccessLevel: to.Ptr("EarlyAccess"), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // SKU: &armtestbase.AccountSKU{ - // Name: to.Ptr("S0"), - // Capabilities: []*armtestbase.AccountSKUCapability{ - // { - // Name: to.Ptr("SLA"), - // Value: to.Ptr("99.9%"), - // }, - // { - // Name: to.Ptr("maximumPackageCount"), - // Value: to.Ptr("5"), - // }, - // { - // Name: to.Ptr("packageMaximumRunSeconds"), - // Value: to.Ptr("3600"), - // }}, - // Tier: to.Ptr(armtestbase.TierStandard), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountOffboard.json -func ExampleAccountsClient_BeginOffboard() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginOffboard(ctx, "contoso-rg1", "contoso-testBaseAccount1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountGetFileUploadUrl.json -func ExampleAccountsClient_GetFileUploadURL() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().GetFileUploadURL(ctx, "contoso-rg1", "contoso-testBaseAccount1", &armtestbase.AccountsClientGetFileUploadURLOptions{Parameters: &armtestbase.GetFileUploadURLParameters{ - BlobName: to.Ptr("package.zip"), - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FileUploadURLResponse = armtestbase.FileUploadURLResponse{ - // BlobPath: to.Ptr("https://uslwestusdevsa.blob.core.windows.net/usltest/temp/20c0d7e0-1bb6-477f-bc04-57c734453000/package.zip"), - // UploadURL: to.Ptr("https://uslwestusdevsa.blob.core.windows.net/usltest/temp/20c0d7e0-1bb6-477f-bc04-57c734453000/token"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/CheckPackageNameAvailability.json -func ExampleAccountsClient_CheckPackageNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().CheckPackageNameAvailability(ctx, "contoso-rg1", "contoso-testBaseAccount1", armtestbase.PackageCheckNameAvailabilityParameters{ - Name: to.Ptr("testApp"), - Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages"), - ApplicationName: to.Ptr("testApp"), - Version: to.Ptr("1.0.0"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityResult = armtestbase.CheckNameAvailabilityResult{ - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/actionrequests_client.go b/sdk/resourcemanager/testbase/armtestbase/actionrequests_client.go new file mode 100644 index 000000000000..6a51abfb226f --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/actionrequests_client.go @@ -0,0 +1,296 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ActionRequestsClient contains the methods for the ActionRequests group. +// Don't use this type directly, use NewActionRequestsClient() instead. +type ActionRequestsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewActionRequestsClient creates a new instance of ActionRequestsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewActionRequestsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActionRequestsClient, error) { + cl, err := arm.NewClient(moduleName+".ActionRequestsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ActionRequestsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Delete - Delete (revoke) an action request. Only requests in review can be deleted. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - ActionRequestsClientDeleteOptions contains the optional parameters for the ActionRequestsClient.Delete method. +func (client *ActionRequestsClient) Delete(ctx context.Context, resourceGroupName string, testBaseAccountName string, actionRequestName string, options *ActionRequestsClientDeleteOptions) (ActionRequestsClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, actionRequestName, options) + if err != nil { + return ActionRequestsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ActionRequestsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ActionRequestsClientDeleteResponse{}, err + } + return ActionRequestsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ActionRequestsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, actionRequestName string, options *ActionRequestsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if actionRequestName == "" { + return nil, errors.New("parameter actionRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{actionRequestName}", url.PathEscape(actionRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the action request under the specified test base account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - ActionRequestsClientGetOptions contains the optional parameters for the ActionRequestsClient.Get method. +func (client *ActionRequestsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, actionRequestName string, options *ActionRequestsClientGetOptions) (ActionRequestsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, actionRequestName, options) + if err != nil { + return ActionRequestsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ActionRequestsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ActionRequestsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ActionRequestsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, actionRequestName string, options *ActionRequestsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if actionRequestName == "" { + return nil, errors.New("parameter actionRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{actionRequestName}", url.PathEscape(actionRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ActionRequestsClient) getHandleResponse(resp *http.Response) (ActionRequestsClientGetResponse, error) { + result := ActionRequestsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ActionRequest); err != nil { + return ActionRequestsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all action requests under the specified test base account. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - ActionRequestsClientListOptions contains the optional parameters for the ActionRequestsClient.NewListPager method. +func (client *ActionRequestsClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *ActionRequestsClientListOptions) *runtime.Pager[ActionRequestsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ActionRequestsClientListResponse]{ + More: func(page ActionRequestsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ActionRequestsClientListResponse) (ActionRequestsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ActionRequestsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ActionRequestsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ActionRequestsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ActionRequestsClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *ActionRequestsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + if options != nil && options.RequestType != nil { + reqQP.Set("requestType", *options.RequestType) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ActionRequestsClient) listHandleResponse(resp *http.Response) (ActionRequestsClientListResponse, error) { + result := ActionRequestsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ActionRequests); err != nil { + return ActionRequestsClientListResponse{}, err + } + return result, nil +} + +// Put - Create (submit) an action request. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - ActionRequestsClientPutOptions contains the optional parameters for the ActionRequestsClient.Put method. +func (client *ActionRequestsClient) Put(ctx context.Context, resourceGroupName string, testBaseAccountName string, actionRequestName string, options *ActionRequestsClientPutOptions) (ActionRequestsClientPutResponse, error) { + var err error + req, err := client.putCreateRequest(ctx, resourceGroupName, testBaseAccountName, actionRequestName, options) + if err != nil { + return ActionRequestsClientPutResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ActionRequestsClientPutResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ActionRequestsClientPutResponse{}, err + } + resp, err := client.putHandleResponse(httpResp) + return resp, err +} + +// putCreateRequest creates the Put request. +func (client *ActionRequestsClient) putCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, actionRequestName string, options *ActionRequestsClientPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/actionRequests/{actionRequestName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if actionRequestName == "" { + return nil, errors.New("parameter actionRequestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{actionRequestName}", url.PathEscape(actionRequestName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.ActionRequest != nil { + if err := runtime.MarshalAsJSON(req, *options.ActionRequest); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// putHandleResponse handles the Put response. +func (client *ActionRequestsClient) putHandleResponse(resp *http.Response) (ActionRequestsClientPutResponse, error) { + result := ActionRequestsClientPutResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ActionRequest); err != nil { + return ActionRequestsClientPutResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/analysisresults_client.go b/sdk/resourcemanager/testbase/armtestbase/analysisresults_client.go index 595fab9ad943..734ddddcce71 100644 --- a/sdk/resourcemanager/testbase/armtestbase/analysisresults_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/analysisresults_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type AnalysisResultsClient struct { } // NewAnalysisResultsClient creates a new instance of AnalysisResultsClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAnalysisResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AnalysisResultsClient, error) { @@ -47,34 +46,34 @@ func NewAnalysisResultsClient(subscriptionID string, credential azcore.TokenCred // Get - Gets an Analysis Result of a Test Result by name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. -// - testResultName - The Test Result Name. It equals to {osName}-{TestResultId} string. +// - testResultName - The Test Result Name. It equals to TestResult-{TestResultId} string. // - analysisResultName - The name of the Analysis Result of a Test Result. // - options - AnalysisResultsClientGetOptions contains the optional parameters for the AnalysisResultsClient.Get method. func (client *AnalysisResultsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, analysisResultName AnalysisResultName, options *AnalysisResultsClientGetOptions) (AnalysisResultsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultName, options) if err != nil { return AnalysisResultsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AnalysisResultsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AnalysisResultsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AnalysisResultsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *AnalysisResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, analysisResultName AnalysisResultName, options *AnalysisResultsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults/{analysisResultName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -101,7 +100,7 @@ func (client *AnalysisResultsClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -119,11 +118,11 @@ func (client *AnalysisResultsClient) getHandleResponse(resp *http.Response) (Ana // NewListPager - Lists the Analysis Results of a Test Result. The result collection will only contain one element as all // the data will be nested in a singleton object. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. -// - testResultName - The Test Result Name. It equals to {osName}-{TestResultId} string. +// - testResultName - The Test Result Name. It equals to TestResult-{TestResultId} string. // - analysisResultType - The type of the Analysis Result of a Test Result. // - options - AnalysisResultsClientListOptions contains the optional parameters for the AnalysisResultsClient.NewListPager // method. @@ -152,9 +151,6 @@ func (client *AnalysisResultsClient) NewListPager(resourceGroupName string, test // listCreateRequest creates the List request. func (client *AnalysisResultsClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, analysisResultType AnalysisResultType, options *AnalysisResultsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/analysisResults" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -178,7 +174,7 @@ func (client *AnalysisResultsClient) listCreateRequest(ctx context.Context, reso } reqQP := req.Raw().URL.Query() reqQP.Set("analysisResultType", string(analysisResultType)) - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/analysisresults_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/analysisresults_client_example_test.go deleted file mode 100644 index 137803954e56..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/analysisresults_client_example_test.go +++ /dev/null @@ -1,602 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/CPURegressionAnalysisResultsList.json -func ExampleAnalysisResultsClient_NewListPager_cpuRegressionAnalysisResultsList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAnalysisResultsClient().NewListPager("contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-Test-Id", armtestbase.AnalysisResultTypeCPURegression, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AnalysisResultListResult = armtestbase.AnalysisResultListResult{ - // Value: []*armtestbase.AnalysisResultSingletonResource{ - // { - // Name: to.Ptr("cpuRegression"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults/analysisResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-1909-Test-Id/analysisResults/cpuRegression"), - // Properties: &armtestbase.CPURegressionResultSingletonResourceProperties{ - // AnalysisResultType: to.Ptr(armtestbase.AnalysisResultTypeCPURegression), - // Grade: to.Ptr(armtestbase.GradePass), - // CPURegressionResults: []*armtestbase.RegressionResult{ - // { - // Diff: to.Ptr[float64](0.1), - // FileName: to.Ptr("testApp.exe"), - // Grade: to.Ptr(armtestbase.GradePass), - // IsRegressed: to.Ptr(false), - // Details: to.Ptr("Some details of testApp"), - // }, - // { - // Diff: to.Ptr[float64](0.15), - // FileName: to.Ptr("dependencies.exe"), - // Grade: to.Ptr(armtestbase.GradePass), - // IsRegressed: to.Ptr(false), - // Details: to.Ptr("Some details of dependencies"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/CPUUtilizationAnalysisResultsList.json -func ExampleAnalysisResultsClient_NewListPager_cpuUtilizationAnalysisResultsList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAnalysisResultsClient().NewListPager("contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-Test-Id", armtestbase.AnalysisResultTypeCPUUtilization, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AnalysisResultListResult = armtestbase.AnalysisResultListResult{ - // Value: []*armtestbase.AnalysisResultSingletonResource{ - // { - // Name: to.Ptr("cpuUtilization"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults/analysisResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-1909-Test-Id/analysisResults/cpuUtilization"), - // Properties: &armtestbase.CPUUtilizationResultSingletonResourceProperties{ - // AnalysisResultType: to.Ptr(armtestbase.AnalysisResultTypeCPUUtilization), - // Grade: to.Ptr(armtestbase.GradePass), - // CPUUtilizationResults: []*armtestbase.UtilizationResult{ - // { - // LowerBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](50), - // Value: to.Ptr[float64](20), - // }, - // Process: to.Ptr("app.exe"), - // UpperBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](90), - // Value: to.Ptr[float64](60), - // }, - // Utilization: []*armtestbase.UtilizationEntry{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // Value: to.Ptr[float64](34.7), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:31:00Z"); return t}()), - // Value: to.Ptr[float64](35.9), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:32:00Z"); return t}()), - // Value: to.Ptr[float64](27.1), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:33:00Z"); return t}()), - // Value: to.Ptr[float64](49.8), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:34:00Z"); return t}()), - // Value: to.Ptr[float64](45.6), - // }}, - // }, - // { - // LowerBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](50), - // Value: to.Ptr[float64](20), - // }, - // Process: to.Ptr("anotherProcess.exe"), - // UpperBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](90), - // Value: to.Ptr[float64](60), - // }, - // Utilization: []*armtestbase.UtilizationEntry{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // Value: to.Ptr[float64](34.7), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:31:00Z"); return t}()), - // Value: to.Ptr[float64](35.9), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:32:00Z"); return t}()), - // Value: to.Ptr[float64](27.1), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:33:00Z"); return t}()), - // Value: to.Ptr[float64](49.8), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:34:00Z"); return t}()), - // Value: to.Ptr[float64](45.6), - // }}, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/MemoryRegressionAnalysisResultsList.json -func ExampleAnalysisResultsClient_NewListPager_memoryRegressionAnalysisResultsList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAnalysisResultsClient().NewListPager("contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-Test-Id", armtestbase.AnalysisResultTypeMemoryRegression, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AnalysisResultListResult = armtestbase.AnalysisResultListResult{ - // Value: []*armtestbase.AnalysisResultSingletonResource{ - // { - // Name: to.Ptr("memoryRegression"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults/analysisResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-1909-Test-Id/analysisResults/memoryRegression"), - // Properties: &armtestbase.MemoryRegressionResultSingletonResourceProperties{ - // AnalysisResultType: to.Ptr(armtestbase.AnalysisResultTypeMemoryRegression), - // Grade: to.Ptr(armtestbase.GradePass), - // MemoryRegressionResults: []*armtestbase.RegressionResult{ - // { - // Diff: to.Ptr[float64](0.1), - // FileName: to.Ptr("testApp.exe"), - // Grade: to.Ptr(armtestbase.GradePass), - // IsRegressed: to.Ptr(false), - // Details: to.Ptr("Some details of testApp"), - // }, - // { - // Diff: to.Ptr[float64](0.15), - // FileName: to.Ptr("dependencies.exe"), - // Grade: to.Ptr(armtestbase.GradePass), - // IsRegressed: to.Ptr(false), - // Details: to.Ptr("Some details of dependencies"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/MemoryUtilizationAnalysisResultsList.json -func ExampleAnalysisResultsClient_NewListPager_memoryUtilizationAnalysisResultsList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAnalysisResultsClient().NewListPager("contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-Test-Id", armtestbase.AnalysisResultTypeMemoryUtilization, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AnalysisResultListResult = armtestbase.AnalysisResultListResult{ - // Value: []*armtestbase.AnalysisResultSingletonResource{ - // { - // Name: to.Ptr("cpuUtilization"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults/analysisResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-1909-Test-Id/analysisResults/memoryUtilization"), - // Properties: &armtestbase.MemoryUtilizationResultSingletonResourceProperties{ - // AnalysisResultType: to.Ptr(armtestbase.AnalysisResultTypeMemoryUtilization), - // Grade: to.Ptr(armtestbase.GradePass), - // MemoryUtilizationResults: []*armtestbase.UtilizationResult{ - // { - // LowerBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](50), - // Value: to.Ptr[float64](20), - // }, - // Process: to.Ptr("app.exe"), - // UpperBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](90), - // Value: to.Ptr[float64](60), - // }, - // Utilization: []*armtestbase.UtilizationEntry{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // Value: to.Ptr[float64](34.7), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:31:00Z"); return t}()), - // Value: to.Ptr[float64](35.9), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:32:00Z"); return t}()), - // Value: to.Ptr[float64](27.1), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:33:00Z"); return t}()), - // Value: to.Ptr[float64](49.8), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:34:00Z"); return t}()), - // Value: to.Ptr[float64](45.6), - // }}, - // }, - // { - // LowerBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](50), - // Value: to.Ptr[float64](20), - // }, - // Process: to.Ptr("anotherProcess.exe"), - // UpperBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](90), - // Value: to.Ptr[float64](60), - // }, - // Utilization: []*armtestbase.UtilizationEntry{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // Value: to.Ptr[float64](34.7), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:31:00Z"); return t}()), - // Value: to.Ptr[float64](35.9), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:32:00Z"); return t}()), - // Value: to.Ptr[float64](27.1), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:33:00Z"); return t}()), - // Value: to.Ptr[float64](49.8), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:34:00Z"); return t}()), - // Value: to.Ptr[float64](45.6), - // }}, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/CPURegressionAnalysisResultGet.json -func ExampleAnalysisResultsClient_Get_cpuRegressionAnalysisResultGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAnalysisResultsClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-Test-Id", armtestbase.AnalysisResultNameCPURegression, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AnalysisResultSingletonResource = armtestbase.AnalysisResultSingletonResource{ - // Name: to.Ptr("cpuRegression"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults/analysisResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-1909-Test-Id/analysisResults/cpuRegression"), - // Properties: &armtestbase.CPURegressionResultSingletonResourceProperties{ - // AnalysisResultType: to.Ptr(armtestbase.AnalysisResultTypeCPURegression), - // Grade: to.Ptr(armtestbase.GradePass), - // CPURegressionResults: []*armtestbase.RegressionResult{ - // { - // Diff: to.Ptr[float64](0.1), - // FileName: to.Ptr("testApp.exe"), - // Grade: to.Ptr(armtestbase.GradePass), - // IsRegressed: to.Ptr(false), - // Details: to.Ptr("Some details of testApp"), - // }, - // { - // Diff: to.Ptr[float64](0.15), - // FileName: to.Ptr("dependencies.exe"), - // Grade: to.Ptr(armtestbase.GradePass), - // IsRegressed: to.Ptr(false), - // Details: to.Ptr("Some details of dependencies"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/CPUUtilizationAnalysisResultGet.json -func ExampleAnalysisResultsClient_Get_cpuUtilizationAnalysisResultGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAnalysisResultsClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-Test-Id", armtestbase.AnalysisResultNameCPUUtilization, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AnalysisResultSingletonResource = armtestbase.AnalysisResultSingletonResource{ - // Name: to.Ptr("cpuUtilization"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults/analysisResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-1909-Test-Id/analysisResults/cpuUtilization"), - // Properties: &armtestbase.CPUUtilizationResultSingletonResourceProperties{ - // AnalysisResultType: to.Ptr(armtestbase.AnalysisResultTypeCPUUtilization), - // Grade: to.Ptr(armtestbase.GradePass), - // CPUUtilizationResults: []*armtestbase.UtilizationResult{ - // { - // LowerBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](50), - // Value: to.Ptr[float64](20), - // }, - // Process: to.Ptr("app.exe"), - // UpperBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](90), - // Value: to.Ptr[float64](60), - // }, - // Utilization: []*armtestbase.UtilizationEntry{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // Value: to.Ptr[float64](34.7), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:31:00Z"); return t}()), - // Value: to.Ptr[float64](35.9), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:32:00Z"); return t}()), - // Value: to.Ptr[float64](27.1), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:33:00Z"); return t}()), - // Value: to.Ptr[float64](49.8), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:34:00Z"); return t}()), - // Value: to.Ptr[float64](45.6), - // }}, - // }, - // { - // LowerBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](50), - // Value: to.Ptr[float64](20), - // }, - // Process: to.Ptr("anotherProcess.exe"), - // UpperBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](90), - // Value: to.Ptr[float64](60), - // }, - // Utilization: []*armtestbase.UtilizationEntry{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // Value: to.Ptr[float64](34.7), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:31:00Z"); return t}()), - // Value: to.Ptr[float64](35.9), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:32:00Z"); return t}()), - // Value: to.Ptr[float64](27.1), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:33:00Z"); return t}()), - // Value: to.Ptr[float64](49.8), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:34:00Z"); return t}()), - // Value: to.Ptr[float64](45.6), - // }}, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/MemoryRegressionAnalysisResultGet.json -func ExampleAnalysisResultsClient_Get_memoryRegressionAnalysisResultGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAnalysisResultsClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-Test-Id", armtestbase.AnalysisResultNameMemoryRegression, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AnalysisResultSingletonResource = armtestbase.AnalysisResultSingletonResource{ - // Name: to.Ptr("memoryRegression"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults/analysisResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-1909-Test-Id/analysisResults/memoryRegression"), - // Properties: &armtestbase.MemoryRegressionResultSingletonResourceProperties{ - // AnalysisResultType: to.Ptr(armtestbase.AnalysisResultTypeMemoryRegression), - // Grade: to.Ptr(armtestbase.GradePass), - // MemoryRegressionResults: []*armtestbase.RegressionResult{ - // { - // Diff: to.Ptr[float64](0.1), - // FileName: to.Ptr("testApp.exe"), - // Grade: to.Ptr(armtestbase.GradePass), - // IsRegressed: to.Ptr(false), - // Details: to.Ptr("Some details of testApp"), - // }, - // { - // Diff: to.Ptr[float64](0.15), - // FileName: to.Ptr("dependencies.exe"), - // Grade: to.Ptr(armtestbase.GradePass), - // IsRegressed: to.Ptr(false), - // Details: to.Ptr("Some details of dependencies"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/MemoryUtilizationAnalysisResultGet.json -func ExampleAnalysisResultsClient_Get_memoryUtilizationAnalysisResultGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAnalysisResultsClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-Test-Id", armtestbase.AnalysisResultNameMemoryUtilization, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AnalysisResultSingletonResource = armtestbase.AnalysisResultSingletonResource{ - // Name: to.Ptr("memoryUtilization"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults/analysisResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-1909-Test-Id/analysisResults/memoryUtilization"), - // Properties: &armtestbase.MemoryUtilizationResultSingletonResourceProperties{ - // AnalysisResultType: to.Ptr(armtestbase.AnalysisResultTypeMemoryUtilization), - // Grade: to.Ptr(armtestbase.GradePass), - // MemoryUtilizationResults: []*armtestbase.UtilizationResult{ - // { - // LowerBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](50), - // Value: to.Ptr[float64](20), - // }, - // Process: to.Ptr("app.exe"), - // UpperBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](90), - // Value: to.Ptr[float64](60), - // }, - // Utilization: []*armtestbase.UtilizationEntry{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // Value: to.Ptr[float64](34.7), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:31:00Z"); return t}()), - // Value: to.Ptr[float64](35.9), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:32:00Z"); return t}()), - // Value: to.Ptr[float64](27.1), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:33:00Z"); return t}()), - // Value: to.Ptr[float64](49.8), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:34:00Z"); return t}()), - // Value: to.Ptr[float64](45.6), - // }}, - // }, - // { - // LowerBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](50), - // Value: to.Ptr[float64](20), - // }, - // Process: to.Ptr("anotherProcess.exe"), - // UpperBound: &armtestbase.UtilizationBound{ - // Percentile: to.Ptr[float64](90), - // Value: to.Ptr[float64](60), - // }, - // Utilization: []*armtestbase.UtilizationEntry{ - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // Value: to.Ptr[float64](34.7), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:31:00Z"); return t}()), - // Value: to.Ptr[float64](35.9), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:32:00Z"); return t}()), - // Value: to.Ptr[float64](27.1), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:33:00Z"); return t}()), - // Value: to.Ptr[float64](49.8), - // }, - // { - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:34:00Z"); return t}()), - // Value: to.Ptr[float64](45.6), - // }}, - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/autorest.md b/sdk/resourcemanager/testbase/armtestbase/autorest.md index c727419d2976..65ac79898089 100644 --- a/sdk/resourcemanager/testbase/armtestbase/autorest.md +++ b/sdk/resourcemanager/testbase/armtestbase/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/testbase/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/testbase/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.6.1 +module-version: 0.7.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/testbase/armtestbase/availableinplaceupgradeos_client.go b/sdk/resourcemanager/testbase/armtestbase/availableinplaceupgradeos_client.go new file mode 100644 index 000000000000..9823c6fa0e20 --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/availableinplaceupgradeos_client.go @@ -0,0 +1,176 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AvailableInplaceUpgradeOSClient contains the methods for the AvailableInplaceUpgradeOS group. +// Don't use this type directly, use NewAvailableInplaceUpgradeOSClient() instead. +type AvailableInplaceUpgradeOSClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAvailableInplaceUpgradeOSClient creates a new instance of AvailableInplaceUpgradeOSClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAvailableInplaceUpgradeOSClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableInplaceUpgradeOSClient, error) { + cl, err := arm.NewClient(moduleName+".AvailableInplaceUpgradeOSClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AvailableInplaceUpgradeOSClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets an available In-place Upgrade OS to run a package under a Test Base Account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - availableInplaceUpgradeOSResourceName - The resource name of an Available In-place Upgrade OS. +// - options - AvailableInplaceUpgradeOSClientGetOptions contains the optional parameters for the AvailableInplaceUpgradeOSClient.Get +// method. +func (client *AvailableInplaceUpgradeOSClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, availableInplaceUpgradeOSResourceName string, options *AvailableInplaceUpgradeOSClientGetOptions) (AvailableInplaceUpgradeOSClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, availableInplaceUpgradeOSResourceName, options) + if err != nil { + return AvailableInplaceUpgradeOSClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AvailableInplaceUpgradeOSClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AvailableInplaceUpgradeOSClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AvailableInplaceUpgradeOSClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, availableInplaceUpgradeOSResourceName string, options *AvailableInplaceUpgradeOSClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableInplaceUpgradeOSs/{availableInplaceUpgradeOSResourceName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if availableInplaceUpgradeOSResourceName == "" { + return nil, errors.New("parameter availableInplaceUpgradeOSResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{availableInplaceUpgradeOSResourceName}", url.PathEscape(availableInplaceUpgradeOSResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AvailableInplaceUpgradeOSClient) getHandleResponse(resp *http.Response) (AvailableInplaceUpgradeOSClientGetResponse, error) { + result := AvailableInplaceUpgradeOSClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableInplaceUpgradeOSResource); err != nil { + return AvailableInplaceUpgradeOSClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all the available In-place Upgrade OSs to a package under a Test Base Account. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - osUpdateType - The type of the OS Update. +// - options - AvailableInplaceUpgradeOSClientListOptions contains the optional parameters for the AvailableInplaceUpgradeOSClient.NewListPager +// method. +func (client *AvailableInplaceUpgradeOSClient) NewListPager(resourceGroupName string, testBaseAccountName string, osUpdateType OsUpdateType, options *AvailableInplaceUpgradeOSClientListOptions) *runtime.Pager[AvailableInplaceUpgradeOSClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AvailableInplaceUpgradeOSClientListResponse]{ + More: func(page AvailableInplaceUpgradeOSClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AvailableInplaceUpgradeOSClientListResponse) (AvailableInplaceUpgradeOSClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, testBaseAccountName, osUpdateType, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AvailableInplaceUpgradeOSClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AvailableInplaceUpgradeOSClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailableInplaceUpgradeOSClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *AvailableInplaceUpgradeOSClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, osUpdateType OsUpdateType, options *AvailableInplaceUpgradeOSClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableInplaceUpgradeOSs" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("osUpdateType", string(osUpdateType)) + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AvailableInplaceUpgradeOSClient) listHandleResponse(resp *http.Response) (AvailableInplaceUpgradeOSClientListResponse, error) { + result := AvailableInplaceUpgradeOSClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableInplaceUpgradeOSListResult); err != nil { + return AvailableInplaceUpgradeOSClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/availableos_client.go b/sdk/resourcemanager/testbase/armtestbase/availableos_client.go index d6bb3528d4ae..f46f43945252 100644 --- a/sdk/resourcemanager/testbase/armtestbase/availableos_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/availableos_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type AvailableOSClient struct { } // NewAvailableOSClient creates a new instance of AvailableOSClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAvailableOSClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailableOSClient, error) { @@ -47,32 +46,32 @@ func NewAvailableOSClient(subscriptionID string, credential azcore.TokenCredenti // Get - Gets an available OS to run a package under a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - availableOSResourceName - The resource name of an Available OS. // - options - AvailableOSClientGetOptions contains the optional parameters for the AvailableOSClient.Get method. func (client *AvailableOSClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, availableOSResourceName string, options *AvailableOSClientGetOptions) (AvailableOSClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, availableOSResourceName, options) if err != nil { return AvailableOSClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AvailableOSClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AvailableOSClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AvailableOSClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *AvailableOSClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, availableOSResourceName string, options *AvailableOSClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs/{availableOSResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -91,7 +90,7 @@ func (client *AvailableOSClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,8 +107,8 @@ func (client *AvailableOSClient) getHandleResponse(resp *http.Response) (Availab // NewListPager - Lists all the available OSs to run a package under a Test Base Account. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - osUpdateType - The type of the OS Update. // - options - AvailableOSClientListOptions contains the optional parameters for the AvailableOSClient.NewListPager method. @@ -144,9 +143,6 @@ func (client *AvailableOSClient) NewListPager(resourceGroupName string, testBase // listCreateRequest creates the List request. func (client *AvailableOSClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, osUpdateType OsUpdateType, options *AvailableOSClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/availableOSs" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -162,7 +158,7 @@ func (client *AvailableOSClient) listCreateRequest(ctx context.Context, resource } reqQP := req.Raw().URL.Query() reqQP.Set("osUpdateType", string(osUpdateType)) - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/availableos_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/availableos_client_example_test.go deleted file mode 100644 index 9baf94000c3e..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/availableos_client_example_test.go +++ /dev/null @@ -1,141 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/AvailableOSsList.json -func ExampleAvailableOSClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailableOSClient().NewListPager("contoso-rg", "contoso-testBaseAccount", armtestbase.OsUpdateTypeSecurityUpdate, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AvailableOSListResult = armtestbase.AvailableOSListResult{ - // Value: []*armtestbase.AvailableOSResource{ - // { - // Name: to.Ptr("Windows-10-2004"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/availableOSs"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/availableOSs/Windows-10-2004"), - // Properties: &armtestbase.AvailableOSProperties{ - // InsiderChannel: to.Ptr("Channel 1"), - // OSID: to.Ptr("Windows 10 2004"), - // OSName: to.Ptr("Windows 10 2004"), - // OSPlatform: to.Ptr("Client"), - // OSUpdateType: to.Ptr("Feature update"), - // OSVersion: to.Ptr("Windows 10"), - // }, - // }, - // { - // Name: to.Ptr("Windows-10-1909"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/availableOSs"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/availableOSs/Windows-10-1909"), - // Properties: &armtestbase.AvailableOSProperties{ - // OSID: to.Ptr("Windows 10 1909"), - // OSName: to.Ptr("Windows 10 1909"), - // OSPlatform: to.Ptr("Client"), - // OSUpdateType: to.Ptr("Security update"), - // OSVersion: to.Ptr("Windows 10"), - // }, - // }, - // { - // Name: to.Ptr("Windows-10-1903"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/availableOSs"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/availableOSs/Windows-10-1903"), - // Properties: &armtestbase.AvailableOSProperties{ - // OSID: to.Ptr("Windows 10 1903"), - // OSName: to.Ptr("Windows 10 1903"), - // OSPlatform: to.Ptr("Client"), - // OSUpdateType: to.Ptr("Security update"), - // OSVersion: to.Ptr("Windows 10"), - // }, - // }, - // { - // Name: to.Ptr("Windows-10-1809"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/availableOSs"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/availableOSs/Windows-10-1809"), - // Properties: &armtestbase.AvailableOSProperties{ - // InsiderChannel: to.Ptr("Channel 3"), - // OSID: to.Ptr("Windows 10 1809"), - // OSName: to.Ptr("Windows 10 1809"), - // OSPlatform: to.Ptr("Client"), - // OSUpdateType: to.Ptr("Feature update"), - // OSVersion: to.Ptr("Windows 10"), - // }, - // }, - // { - // Name: to.Ptr("Windows-Server-2016"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/availableOSs"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/availableOSs/Windows-Server-2016"), - // Properties: &armtestbase.AvailableOSProperties{ - // OSID: to.Ptr("Windows Server 2016"), - // OSName: to.Ptr("Windows Server 2016"), - // OSPlatform: to.Ptr("Server"), - // OSUpdateType: to.Ptr("Security update"), - // OSVersion: to.Ptr("Windows Server 2016"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/AvailableOSGet.json -func ExampleAvailableOSClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailableOSClient().Get(ctx, "contoso-rg", "contoso-testBaseAccount", "Windows-10-2004", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AvailableOSResource = armtestbase.AvailableOSResource{ - // Name: to.Ptr("Windows-10-2004"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/availableOSs"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/availableOSs/Windows-10-2004"), - // Properties: &armtestbase.AvailableOSProperties{ - // InsiderChannel: to.Ptr("Channel 1"), - // OSID: to.Ptr("Windows 10 2004"), - // OSName: to.Ptr("Windows 10 2004"), - // OSPlatform: to.Ptr("Client"), - // OSUpdateType: to.Ptr("Feature update"), - // OSVersion: to.Ptr("Windows 10"), - // }, - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/billinghubservice_client.go b/sdk/resourcemanager/testbase/armtestbase/billinghubservice_client.go new file mode 100644 index 000000000000..715cdb17249e --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/billinghubservice_client.go @@ -0,0 +1,166 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BillingHubServiceClient contains the methods for the BillingHubService group. +// Don't use this type directly, use NewBillingHubServiceClient() instead. +type BillingHubServiceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBillingHubServiceClient creates a new instance of BillingHubServiceClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBillingHubServiceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BillingHubServiceClient, error) { + cl, err := arm.NewClient(moduleName+".BillingHubServiceClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BillingHubServiceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetFreeHourBalance - +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - BillingHubServiceClientGetFreeHourBalanceOptions contains the optional parameters for the BillingHubServiceClient.GetFreeHourBalance +// method. +func (client *BillingHubServiceClient) GetFreeHourBalance(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *BillingHubServiceClientGetFreeHourBalanceOptions) (BillingHubServiceClientGetFreeHourBalanceResponse, error) { + var err error + req, err := client.getFreeHourBalanceCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + if err != nil { + return BillingHubServiceClientGetFreeHourBalanceResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BillingHubServiceClientGetFreeHourBalanceResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BillingHubServiceClientGetFreeHourBalanceResponse{}, err + } + resp, err := client.getFreeHourBalanceHandleResponse(httpResp) + return resp, err +} + +// getFreeHourBalanceCreateRequest creates the GetFreeHourBalance request. +func (client *BillingHubServiceClient) getFreeHourBalanceCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *BillingHubServiceClientGetFreeHourBalanceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getFreeHourBalance" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getFreeHourBalanceHandleResponse handles the GetFreeHourBalance response. +func (client *BillingHubServiceClient) getFreeHourBalanceHandleResponse(resp *http.Response) (BillingHubServiceClientGetFreeHourBalanceResponse, error) { + result := BillingHubServiceClientGetFreeHourBalanceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BillingHubGetFreeHourBalanceResponse); err != nil { + return BillingHubServiceClientGetFreeHourBalanceResponse{}, err + } + return result, nil +} + +// GetUsage - +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - BillingHubServiceClientGetUsageOptions contains the optional parameters for the BillingHubServiceClient.GetUsage +// method. +func (client *BillingHubServiceClient) GetUsage(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *BillingHubServiceClientGetUsageOptions) (BillingHubServiceClientGetUsageResponse, error) { + var err error + req, err := client.getUsageCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + if err != nil { + return BillingHubServiceClientGetUsageResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BillingHubServiceClientGetUsageResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BillingHubServiceClientGetUsageResponse{}, err + } + resp, err := client.getUsageHandleResponse(httpResp) + return resp, err +} + +// getUsageCreateRequest creates the GetUsage request. +func (client *BillingHubServiceClient) getUsageCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *BillingHubServiceClientGetUsageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/getUsage" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.GetUsageRequest != nil { + if err := runtime.MarshalAsJSON(req, *options.GetUsageRequest); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// getUsageHandleResponse handles the GetUsage response. +func (client *BillingHubServiceClient) getUsageHandleResponse(resp *http.Response) (BillingHubServiceClientGetUsageResponse, error) { + result := BillingHubServiceClientGetUsageResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BillingHubGetUsageResponse); err != nil { + return BillingHubServiceClientGetUsageResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/chatsession_client.go b/sdk/resourcemanager/testbase/armtestbase/chatsession_client.go new file mode 100644 index 000000000000..9bdad4f34afd --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/chatsession_client.go @@ -0,0 +1,119 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ChatSessionClient contains the methods for the ChatSession group. +// Don't use this type directly, use NewChatSessionClient() instead. +type ChatSessionClient struct { + internal *arm.Client + subscriptionID string +} + +// NewChatSessionClient creates a new instance of ChatSessionClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewChatSessionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ChatSessionClient, error) { + cl, err := arm.NewClient(moduleName+".ChatSessionClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ChatSessionClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginChat - Start a new chat turn. Ask a question and see the answer in response. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - chatSessionName - The chat session name. +// - parameters - Payload to ask a question. +// - options - ChatSessionClientBeginChatOptions contains the optional parameters for the ChatSessionClient.BeginChat method. +func (client *ChatSessionClient) BeginChat(ctx context.Context, resourceGroupName string, testBaseAccountName string, chatSessionName string, parameters ChatRequest, options *ChatSessionClientBeginChatOptions) (*runtime.Poller[ChatSessionClientChatResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.chat(ctx, resourceGroupName, testBaseAccountName, chatSessionName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ChatSessionClientChatResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ChatSessionClientChatResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Chat - Start a new chat turn. Ask a question and see the answer in response. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +func (client *ChatSessionClient) chat(ctx context.Context, resourceGroupName string, testBaseAccountName string, chatSessionName string, parameters ChatRequest, options *ChatSessionClientBeginChatOptions) (*http.Response, error) { + var err error + req, err := client.chatCreateRequest(ctx, resourceGroupName, testBaseAccountName, chatSessionName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// chatCreateRequest creates the Chat request. +func (client *ChatSessionClient) chatCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, chatSessionName string, parameters ChatRequest, options *ChatSessionClientBeginChatOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions/{chatSessionName}/chat" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if chatSessionName == "" { + return nil, errors.New("parameter chatSessionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{chatSessionName}", url.PathEscape(chatSessionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/chatsessions_client.go b/sdk/resourcemanager/testbase/armtestbase/chatsessions_client.go new file mode 100644 index 000000000000..9df8e2f09472 --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/chatsessions_client.go @@ -0,0 +1,172 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ChatSessionsClient contains the methods for the ChatSessions group. +// Don't use this type directly, use NewChatSessionsClient() instead. +type ChatSessionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewChatSessionsClient creates a new instance of ChatSessionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewChatSessionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ChatSessionsClient, error) { + cl, err := arm.NewClient(moduleName+".ChatSessionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ChatSessionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a chat session +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - chatSessionName - The chat session name. +// - options - ChatSessionsClientGetOptions contains the optional parameters for the ChatSessionsClient.Get method. +func (client *ChatSessionsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, chatSessionName string, options *ChatSessionsClientGetOptions) (ChatSessionsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, chatSessionName, options) + if err != nil { + return ChatSessionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ChatSessionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ChatSessionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ChatSessionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, chatSessionName string, options *ChatSessionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions/{chatSessionName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if chatSessionName == "" { + return nil, errors.New("parameter chatSessionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{chatSessionName}", url.PathEscape(chatSessionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ChatSessionsClient) getHandleResponse(resp *http.Response) (ChatSessionsClientGetResponse, error) { + result := ChatSessionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ChatSessionResource); err != nil { + return ChatSessionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all chat sessions +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - ChatSessionsClientListOptions contains the optional parameters for the ChatSessionsClient.NewListPager method. +func (client *ChatSessionsClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *ChatSessionsClientListOptions) *runtime.Pager[ChatSessionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ChatSessionsClientListResponse]{ + More: func(page ChatSessionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ChatSessionsClientListResponse) (ChatSessionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ChatSessionsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ChatSessionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ChatSessionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ChatSessionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *ChatSessionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/chatSessions" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ChatSessionsClient) listHandleResponse(resp *http.Response) (ChatSessionsClientListResponse, error) { + result := ChatSessionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ChatSessionResourceListResult); err != nil { + return ChatSessionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/client_factory.go b/sdk/resourcemanager/testbase/armtestbase/client_factory.go index 7144d51758c7..ea28975bc24a 100644 --- a/sdk/resourcemanager/testbase/armtestbase/client_factory.go +++ b/sdk/resourcemanager/testbase/armtestbase/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -24,7 +23,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -38,18 +37,23 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewSKUsClient() *SKUsClient { - subClient, _ := NewSKUsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAccountsClient() *AccountsClient { + subClient, _ := NewAccountsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewAccountsClient() *AccountsClient { - subClient, _ := NewAccountsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewActionRequestsClient() *ActionRequestsClient { + subClient, _ := NewActionRequestsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewUsageClient() *UsageClient { - subClient, _ := NewUsageClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAnalysisResultsClient() *AnalysisResultsClient { + subClient, _ := NewAnalysisResultsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewAvailableInplaceUpgradeOSClient() *AvailableInplaceUpgradeOSClient { + subClient, _ := NewAvailableInplaceUpgradeOSClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -58,43 +62,43 @@ func (c *ClientFactory) NewAvailableOSClient() *AvailableOSClient { return subClient } -func (c *ClientFactory) NewFlightingRingsClient() *FlightingRingsClient { - subClient, _ := NewFlightingRingsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewBillingHubServiceClient() *BillingHubServiceClient { + subClient, _ := NewBillingHubServiceClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTestTypesClient() *TestTypesClient { - subClient, _ := NewTestTypesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewChatSessionClient() *ChatSessionClient { + subClient, _ := NewChatSessionClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPackagesClient() *PackagesClient { - subClient, _ := NewPackagesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewChatSessionsClient() *ChatSessionsClient { + subClient, _ := NewChatSessionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTestSummariesClient() *TestSummariesClient { - subClient, _ := NewTestSummariesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCredentialClient() *CredentialClient { + subClient, _ := NewCredentialClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTestResultsClient() *TestResultsClient { - subClient, _ := NewTestResultsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCredentialsClient() *CredentialsClient { + subClient, _ := NewCredentialsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOSUpdatesClient() *OSUpdatesClient { - subClient, _ := NewOSUpdatesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCustomImagesClient() *CustomImagesClient { + subClient, _ := NewCustomImagesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewFavoriteProcessesClient() *FavoriteProcessesClient { - subClient, _ := NewFavoriteProcessesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCustomerEventsClient() *CustomerEventsClient { + subClient, _ := NewCustomerEventsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewAnalysisResultsClient() *AnalysisResultsClient { - subClient, _ := NewAnalysisResultsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDraftPackagesClient() *DraftPackagesClient { + subClient, _ := NewDraftPackagesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -103,8 +107,48 @@ func (c *ClientFactory) NewEmailEventsClient() *EmailEventsClient { return subClient } -func (c *ClientFactory) NewCustomerEventsClient() *CustomerEventsClient { - subClient, _ := NewCustomerEventsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewFavoriteProcessesClient() *FavoriteProcessesClient { + subClient, _ := NewFavoriteProcessesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFeatureUpdateSupportedOsesClient() *FeatureUpdateSupportedOsesClient { + subClient, _ := NewFeatureUpdateSupportedOsesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFirstPartyAppsClient() *FirstPartyAppsClient { + subClient, _ := NewFirstPartyAppsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFlightingRingsClient() *FlightingRingsClient { + subClient, _ := NewFlightingRingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFreeHourBalancesClient() *FreeHourBalancesClient { + subClient, _ := NewFreeHourBalancesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewGalleryAppSKUsClient() *GalleryAppSKUsClient { + subClient, _ := NewGalleryAppSKUsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewGalleryAppsClient() *GalleryAppsClient { + subClient, _ := NewGalleryAppsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewImageDefinitionsClient() *ImageDefinitionsClient { + subClient, _ := NewImageDefinitionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOSUpdatesClient() *OSUpdatesClient { + subClient, _ := NewOSUpdatesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -112,3 +156,38 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } + +func (c *ClientFactory) NewPackagesClient() *PackagesClient { + subClient, _ := NewPackagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSKUsClient() *SKUsClient { + subClient, _ := NewSKUsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewTestResultsClient() *TestResultsClient { + subClient, _ := NewTestResultsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewTestSummariesClient() *TestSummariesClient { + subClient, _ := NewTestSummariesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewTestTypesClient() *TestTypesClient { + subClient, _ := NewTestTypesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewUsageClient() *UsageClient { + subClient, _ := NewUsageClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewVHDsClient() *VHDsClient { + subClient, _ := NewVHDsClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/testbase/armtestbase/constants.go b/sdk/resourcemanager/testbase/armtestbase/constants.go index d0f1e16c45f7..8ee1e21bf926 100644 --- a/sdk/resourcemanager/testbase/armtestbase/constants.go +++ b/sdk/resourcemanager/testbase/armtestbase/constants.go @@ -3,26 +3,26 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase const ( moduleName = "armtestbase" - moduleVersion = "v0.6.1" + moduleVersion = "v0.7.0" ) // Action - The action of the command. type Action string const ( - ActionClose Action = "Close" - ActionCustom Action = "Custom" - ActionInstall Action = "Install" - ActionLaunch Action = "Launch" - ActionUninstall Action = "Uninstall" + ActionClose Action = "Close" + ActionCustom Action = "Custom" + ActionFlowDrivenCustom Action = "FlowDrivenCustom" + ActionInstall Action = "Install" + ActionLaunch Action = "Launch" + ActionUninstall Action = "Uninstall" ) // PossibleActionValues returns the possible values for the Action const type. @@ -30,12 +30,27 @@ func PossibleActionValues() []Action { return []Action{ ActionClose, ActionCustom, + ActionFlowDrivenCustom, ActionInstall, ActionLaunch, ActionUninstall, } } +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + type AnalysisResultName string const ( @@ -113,6 +128,38 @@ func PossibleAnalysisStatusValues() []AnalysisStatus { } } +// ApplicationType - The type of a gallery application. +type ApplicationType string + +const ( + ApplicationTypeWinget ApplicationType = "Winget" +) + +// PossibleApplicationTypeValues returns the possible values for the ApplicationType const type. +func PossibleApplicationTypeValues() []ApplicationType { + return []ApplicationType{ + ApplicationTypeWinget, + } +} + +// Architecture - The architecture of an OS or a first party application. +type Architecture string + +const ( + ArchitectureArm64 Architecture = "arm64" + ArchitectureX64 Architecture = "x64" + ArchitectureX86 Architecture = "x86" +) + +// PossibleArchitectureValues returns the possible values for the Architecture const type. +func PossibleArchitectureValues() []Architecture { + return []Architecture{ + ArchitectureArm64, + ArchitectureX64, + ArchitectureX86, + } +} + // Category - The category of the failure. type Category string @@ -173,6 +220,64 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// CredentialType - Credential type. +type CredentialType string + +const ( + // CredentialTypeIntuneAccount - Username password credential for intune enrollment. + CredentialTypeIntuneAccount CredentialType = "IntuneAccount" +) + +// PossibleCredentialTypeValues returns the possible values for the CredentialType const type. +func PossibleCredentialTypeValues() []CredentialType { + return []CredentialType{ + CredentialTypeIntuneAccount, + } +} + +// DraftPackageSourceType - The source type. +type DraftPackageSourceType string + +const ( + DraftPackageSourceTypeGalleryApp DraftPackageSourceType = "GalleryApp" + DraftPackageSourceTypeIntuneEnrollment DraftPackageSourceType = "IntuneEnrollment" + DraftPackageSourceTypeIntuneWin DraftPackageSourceType = "IntuneWin" + DraftPackageSourceTypeNative DraftPackageSourceType = "Native" + DraftPackageSourceTypeTestBasePackage DraftPackageSourceType = "TestBasePackage" +) + +// PossibleDraftPackageSourceTypeValues returns the possible values for the DraftPackageSourceType const type. +func PossibleDraftPackageSourceTypeValues() []DraftPackageSourceType { + return []DraftPackageSourceType{ + DraftPackageSourceTypeGalleryApp, + DraftPackageSourceTypeIntuneEnrollment, + DraftPackageSourceTypeIntuneWin, + DraftPackageSourceTypeNative, + DraftPackageSourceTypeTestBasePackage, + } +} + +type Engagements string + +const ( + EngagementsMAPP Engagements = "MAPP" + EngagementsMVI Engagements = "MVI" + EngagementsMVP Engagements = "MVP" + EngagementsOther Engagements = "Other" + EngagementsSUVP Engagements = "SUVP" +) + +// PossibleEngagementsValues returns the possible values for the Engagements const type. +func PossibleEngagementsValues() []Engagements { + return []Engagements{ + EngagementsMAPP, + EngagementsMVI, + EngagementsMVP, + EngagementsOther, + EngagementsSUVP, + } +} + // ExecutionStatus - The execution status of a test. type ExecutionStatus string @@ -201,6 +306,85 @@ func PossibleExecutionStatusValues() []ExecutionStatus { } } +// ExtractFileType - The type of file to extract. +type ExtractFileType string + +const ( + ExtractFileTypeIntuneWinPackage ExtractFileType = "IntuneWinPackage" + ExtractFileTypeTestBasePackage ExtractFileType = "TestBasePackage" +) + +// PossibleExtractFileTypeValues returns the possible values for the ExtractFileType const type. +func PossibleExtractFileTypeValues() []ExtractFileType { + return []ExtractFileType{ + ExtractFileTypeIntuneWinPackage, + ExtractFileTypeTestBasePackage, + } +} + +// FileUploadResourceType - Resource type for file uploading. +type FileUploadResourceType string + +const ( + // FileUploadResourceTypePackage - Upload file for package onboarding. + FileUploadResourceTypePackage FileUploadResourceType = "Package" + // FileUploadResourceTypeVHD - Upload VHD file for image onboarding. + FileUploadResourceTypeVHD FileUploadResourceType = "VHD" +) + +// PossibleFileUploadResourceTypeValues returns the possible values for the FileUploadResourceType const type. +func PossibleFileUploadResourceTypeValues() []FileUploadResourceType { + return []FileUploadResourceType{ + FileUploadResourceTypePackage, + FileUploadResourceTypeVHD, + } +} + +type FreeHourBalanceName string + +const ( + FreeHourBalanceNameSubscriptionLevel FreeHourBalanceName = "SubscriptionLevel" + FreeHourBalanceNameTenantLevel FreeHourBalanceName = "TenantLevel" +) + +// PossibleFreeHourBalanceNameValues returns the possible values for the FreeHourBalanceName const type. +func PossibleFreeHourBalanceNameValues() []FreeHourBalanceName { + return []FreeHourBalanceName{ + FreeHourBalanceNameSubscriptionLevel, + FreeHourBalanceNameTenantLevel, + } +} + +type FreeHourStatus string + +const ( + FreeHourStatusEnabled FreeHourStatus = "Enabled" + FreeHourStatusSuspended FreeHourStatus = "Suspended" +) + +// PossibleFreeHourStatusValues returns the possible values for the FreeHourStatus const type. +func PossibleFreeHourStatusValues() []FreeHourStatus { + return []FreeHourStatus{ + FreeHourStatusEnabled, + FreeHourStatusSuspended, + } +} + +type FreeHourType string + +const ( + FreeHourTypePermanent FreeHourType = "Permanent" + FreeHourTypeTemporary FreeHourType = "Temporary" +) + +// PossibleFreeHourTypeValues returns the possible values for the FreeHourType const type. +func PossibleFreeHourTypeValues() []FreeHourType { + return []FreeHourType{ + FreeHourTypePermanent, + FreeHourTypeTemporary, + } +} + // Grade - The grade of a test. type Grade string @@ -221,10 +405,196 @@ func PossibleGradeValues() []Grade { } } +// ImageArchitecture - Custom image architecture. +type ImageArchitecture string + +const ( + // ImageArchitectureX64 - 64-bit architecture. + ImageArchitectureX64 ImageArchitecture = "x64" +) + +// PossibleImageArchitectureValues returns the possible values for the ImageArchitecture const type. +func PossibleImageArchitectureValues() []ImageArchitecture { + return []ImageArchitecture{ + ImageArchitectureX64, + } +} + +// ImageOSState - Custom image OS state. +type ImageOSState string + +const ( + // ImageOSStateGeneralized - Sysprep generalization processed. + ImageOSStateGeneralized ImageOSState = "Generalized" + // ImageOSStateSpecialized - Fully kept with user specified settings. + ImageOSStateSpecialized ImageOSState = "Specialized" +) + +// PossibleImageOSStateValues returns the possible values for the ImageOSState const type. +func PossibleImageOSStateValues() []ImageOSState { + return []ImageOSState{ + ImageOSStateGeneralized, + ImageOSStateSpecialized, + } +} + +// ImageSecurityType - Custom image security type. +type ImageSecurityType string + +const ( + // ImageSecurityTypeStandard - Standard security type. + ImageSecurityTypeStandard ImageSecurityType = "Standard" + // ImageSecurityTypeTrustedLaunch - Specify higher security level compared to Standard. + ImageSecurityTypeTrustedLaunch ImageSecurityType = "TrustedLaunch" +) + +// PossibleImageSecurityTypeValues returns the possible values for the ImageSecurityType const type. +func PossibleImageSecurityTypeValues() []ImageSecurityType { + return []ImageSecurityType{ + ImageSecurityTypeStandard, + ImageSecurityTypeTrustedLaunch, + } +} + +// ImageSource - Custom image source type. +type ImageSource string + +const ( + // ImageSourceUnknown - Unknown image source type. + ImageSourceUnknown ImageSource = "Unknown" + // ImageSourceVHD - Specify image onboarding through VHD. + ImageSourceVHD ImageSource = "VHD" +) + +// PossibleImageSourceValues returns the possible values for the ImageSource const type. +func PossibleImageSourceValues() []ImageSource { + return []ImageSource{ + ImageSourceUnknown, + ImageSourceVHD, + } +} + +// ImageStatus - Status of the custom image. +type ImageStatus string + +const ( + // ImageStatusFailed - Failed to onboard or pass validation. + ImageStatusFailed ImageStatus = "Failed" + // ImageStatusReady - Completed validation and is ready for use. + ImageStatusReady ImageStatus = "Ready" + // ImageStatusUnknown - Unknown image status. + ImageStatusUnknown ImageStatus = "Unknown" + // ImageStatusValidating - Succeed to onboard but is in validation process. + ImageStatusValidating ImageStatus = "Validating" +) + +// PossibleImageStatusValues returns the possible values for the ImageStatus const type. +func PossibleImageStatusValues() []ImageStatus { + return []ImageStatus{ + ImageStatusFailed, + ImageStatusReady, + ImageStatusUnknown, + ImageStatusValidating, + } +} + +// InteropExecutionMode - Specifies how the first party applications should be inter-operated with user's application. +type InteropExecutionMode string + +const ( + // InteropExecutionModeFirstPartyApp - User application will test with the first party applications. + InteropExecutionModeFirstPartyApp InteropExecutionMode = "firstPartyApp" + // InteropExecutionModeFirstPartyAppWithTests - User application will test with the first party applications. For out-of-box + // tests, additional test cases for first party applications will also be run. + InteropExecutionModeFirstPartyAppWithTests InteropExecutionMode = "firstPartyAppWithTests" +) + +// PossibleInteropExecutionModeValues returns the possible values for the InteropExecutionMode const type. +func PossibleInteropExecutionModeValues() []InteropExecutionMode { + return []InteropExecutionMode{ + InteropExecutionModeFirstPartyApp, + InteropExecutionModeFirstPartyAppWithTests, + } +} + +// IntuneExtractStatus - Extract status. +type IntuneExtractStatus string + +const ( + IntuneExtractStatusExtractFailed IntuneExtractStatus = "ExtractFailed" + IntuneExtractStatusNoDependencyApp IntuneExtractStatus = "NoDependencyApp" + IntuneExtractStatusReady IntuneExtractStatus = "Ready" + IntuneExtractStatusUploadFailed IntuneExtractStatus = "UploadFailed" + IntuneExtractStatusUploading IntuneExtractStatus = "Uploading" +) + +// PossibleIntuneExtractStatusValues returns the possible values for the IntuneExtractStatus const type. +func PossibleIntuneExtractStatusValues() []IntuneExtractStatus { + return []IntuneExtractStatus{ + IntuneExtractStatusExtractFailed, + IntuneExtractStatusNoDependencyApp, + IntuneExtractStatusReady, + IntuneExtractStatusUploadFailed, + IntuneExtractStatusUploading, + } +} + +type OrderBy string + +const ( + OrderByPopularity OrderBy = "popularity" + OrderByRelevance OrderBy = "relevance" +) + +// PossibleOrderByValues returns the possible values for the OrderBy const type. +func PossibleOrderByValues() []OrderBy { + return []OrderBy{ + OrderByPopularity, + OrderByRelevance, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// OsProductState - State of the OS product. +type OsProductState string + +const ( + OsProductStateActive OsProductState = "Active" + OsProductStateDisabled OsProductState = "Disabled" +) + +// PossibleOsProductStateValues returns the possible values for the OsProductState const type. +func PossibleOsProductStateValues() []OsProductState { + return []OsProductState{ + OsProductStateActive, + OsProductStateDisabled, + } +} + +// OsUpdateType - Specifies the OS update type to test against. type OsUpdateType string const ( OsUpdateTypeFeatureUpdate OsUpdateType = "FeatureUpdate" + OsUpdateTypeInplaceUpgrade OsUpdateType = "InplaceUpgrade" OsUpdateTypeSecurityUpdate OsUpdateType = "SecurityUpdate" ) @@ -232,6 +602,7 @@ const ( func PossibleOsUpdateTypeValues() []OsUpdateType { return []OsUpdateType{ OsUpdateTypeFeatureUpdate, + OsUpdateTypeInplaceUpgrade, OsUpdateTypeSecurityUpdate, } } @@ -266,6 +637,32 @@ func PossiblePackageStatusValues() []PackageStatus { } } +// PackageStudioTabs - Specifies the tabs when creating / cloning / editing a package. +type PackageStudioTabs string + +const ( + PackageStudioTabsBasicsTab PackageStudioTabs = "BasicsTab" + PackageStudioTabsConfigureTestTab PackageStudioTabs = "ConfigureTestTab" + PackageStudioTabsEditPackageTab PackageStudioTabs = "EditPackageTab" + PackageStudioTabsReviewAndCreateTab PackageStudioTabs = "ReviewAndCreateTab" + PackageStudioTabsTagsTab PackageStudioTabs = "TagsTab" + PackageStudioTabsTestMatrixTab PackageStudioTabs = "TestMatrixTab" + PackageStudioTabsUnspecified PackageStudioTabs = "Unspecified" +) + +// PossiblePackageStudioTabsValues returns the possible values for the PackageStudioTabs const type. +func PossiblePackageStudioTabsValues() []PackageStudioTabs { + return []PackageStudioTabs{ + PackageStudioTabsBasicsTab, + PackageStudioTabsConfigureTestTab, + PackageStudioTabsEditPackageTab, + PackageStudioTabsReviewAndCreateTab, + PackageStudioTabsTagsTab, + PackageStudioTabsTestMatrixTab, + PackageStudioTabsUnspecified, + } +} + // ProvisioningState - ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property type ProvisioningState string @@ -306,6 +703,52 @@ func PossibleReasonValues() []Reason { } } +type RequestStatus string + +const ( + RequestStatusApproved RequestStatus = "Approved" + RequestStatusDeclined RequestStatus = "Declined" + RequestStatusInReview RequestStatus = "InReview" +) + +// PossibleRequestStatusValues returns the possible values for the RequestStatus const type. +func PossibleRequestStatusValues() []RequestStatus { + return []RequestStatus{ + RequestStatusApproved, + RequestStatusDeclined, + RequestStatusInReview, + } +} + +type RequestTypes string + +const ( + RequestTypesPreReleaseAccess RequestTypes = "PreReleaseAccess" +) + +// PossibleRequestTypesValues returns the possible values for the RequestTypes const type. +func PossibleRequestTypesValues() []RequestTypes { + return []RequestTypes{ + RequestTypesPreReleaseAccess, + } +} + +// SystemAssignedServiceIdentityType - Type of managed service identity (either system assigned, or none). +type SystemAssignedServiceIdentityType string + +const ( + SystemAssignedServiceIdentityTypeNone SystemAssignedServiceIdentityType = "None" + SystemAssignedServiceIdentityTypeSystemAssigned SystemAssignedServiceIdentityType = "SystemAssigned" +) + +// PossibleSystemAssignedServiceIdentityTypeValues returns the possible values for the SystemAssignedServiceIdentityType const type. +func PossibleSystemAssignedServiceIdentityTypeValues() []SystemAssignedServiceIdentityType { + return []SystemAssignedServiceIdentityType{ + SystemAssignedServiceIdentityTypeNone, + SystemAssignedServiceIdentityTypeSystemAssigned, + } +} + // TestAnalysisStatus - The status of the analysis. type TestAnalysisStatus string @@ -358,6 +801,7 @@ func PossibleTestStatusValues() []TestStatus { type TestType string const ( + TestTypeFlowDrivenTest TestType = "FlowDrivenTest" TestTypeFunctionalTest TestType = "FunctionalTest" TestTypeOutOfBoxTest TestType = "OutOfBoxTest" ) @@ -365,6 +809,7 @@ const ( // PossibleTestTypeValues returns the possible values for the TestType const type. func PossibleTestTypeValues() []TestType { return []TestType{ + TestTypeFlowDrivenTest, TestTypeFunctionalTest, TestTypeOutOfBoxTest, } @@ -389,6 +834,7 @@ type Type string const ( TypeFeatureUpdate Type = "FeatureUpdate" + TypeInplaceUpgrade Type = "InplaceUpgrade" TypeSecurityUpdate Type = "SecurityUpdate" ) @@ -396,10 +842,38 @@ const ( func PossibleTypeValues() []Type { return []Type{ TypeFeatureUpdate, + TypeInplaceUpgrade, TypeSecurityUpdate, } } +// VHDStatus - The status of the VHD. +type VHDStatus string + +const ( + // VHDStatusFailed - Failed to pass VHD verification. + VHDStatusFailed VHDStatus = "Failed" + // VHDStatusOccupied - An image is onboarding with this VHD. + VHDStatusOccupied VHDStatus = "Occupied" + // VHDStatusReady - Succeed to be upload and pass VHD verification. + VHDStatusReady VHDStatus = "Ready" + // VHDStatusUnknown - Unknown VHD status. + VHDStatusUnknown VHDStatus = "Unknown" + // VHDStatusVerifying - Processing VHD file checking and malware scanning. + VHDStatusVerifying VHDStatus = "Verifying" +) + +// PossibleVHDStatusValues returns the possible values for the VHDStatus const type. +func PossibleVHDStatusValues() []VHDStatus { + return []VHDStatus{ + VHDStatusFailed, + VHDStatusOccupied, + VHDStatusReady, + VHDStatusUnknown, + VHDStatusVerifying, + } +} + // ValidationRunStatus - The status of the validation run of the package. type ValidationRunStatus string @@ -419,3 +893,21 @@ func PossibleValidationRunStatusValues() []ValidationRunStatus { ValidationRunStatusUnknown, } } + +// VerificationStatus - Indicates if the validation or rule checking is passed. +type VerificationStatus string + +const ( + // VerificationStatusFailed - Validation or rule checking failed. + VerificationStatusFailed VerificationStatus = "Failed" + // VerificationStatusPassed - Validation or rule checking passed. + VerificationStatusPassed VerificationStatus = "Passed" +) + +// PossibleVerificationStatusValues returns the possible values for the VerificationStatus const type. +func PossibleVerificationStatusValues() []VerificationStatus { + return []VerificationStatus{ + VerificationStatusFailed, + VerificationStatusPassed, + } +} diff --git a/sdk/resourcemanager/testbase/armtestbase/credential_client.go b/sdk/resourcemanager/testbase/armtestbase/credential_client.go new file mode 100644 index 000000000000..79d50742cfaf --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/credential_client.go @@ -0,0 +1,173 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CredentialClient contains the methods for the Credential group. +// Don't use this type directly, use NewCredentialClient() instead. +type CredentialClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCredentialClient creates a new instance of CredentialClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCredentialClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CredentialClient, error) { + cl, err := arm.NewClient(moduleName+".CredentialClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CredentialClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a test base credential Resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - credentialName - The credential resource name. +// - options - CredentialClientGetOptions contains the optional parameters for the CredentialClient.Get method. +func (client *CredentialClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, credentialName string, options *CredentialClientGetOptions) (CredentialClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, credentialName, options) + if err != nil { + return CredentialClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CredentialClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CredentialClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CredentialClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, credentialName string, options *CredentialClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if credentialName == "" { + return nil, errors.New("parameter credentialName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialName}", url.PathEscape(credentialName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CredentialClient) getHandleResponse(resp *http.Response) (CredentialClientGetResponse, error) { + result := CredentialClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialResource); err != nil { + return CredentialClientGetResponse{}, err + } + return result, nil +} + +// NewListByTestBaseAccountPager - Lists all the Credentials under a Test Base Account. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - CredentialClientListByTestBaseAccountOptions contains the optional parameters for the CredentialClient.NewListByTestBaseAccountPager +// method. +func (client *CredentialClient) NewListByTestBaseAccountPager(resourceGroupName string, testBaseAccountName string, options *CredentialClientListByTestBaseAccountOptions) *runtime.Pager[CredentialClientListByTestBaseAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[CredentialClientListByTestBaseAccountResponse]{ + More: func(page CredentialClientListByTestBaseAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CredentialClientListByTestBaseAccountResponse) (CredentialClientListByTestBaseAccountResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByTestBaseAccountCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CredentialClientListByTestBaseAccountResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CredentialClientListByTestBaseAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CredentialClientListByTestBaseAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByTestBaseAccountHandleResponse(resp) + }, + }) +} + +// listByTestBaseAccountCreateRequest creates the ListByTestBaseAccount request. +func (client *CredentialClient) listByTestBaseAccountCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *CredentialClientListByTestBaseAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByTestBaseAccountHandleResponse handles the ListByTestBaseAccount response. +func (client *CredentialClient) listByTestBaseAccountHandleResponse(resp *http.Response) (CredentialClientListByTestBaseAccountResponse, error) { + result := CredentialClientListByTestBaseAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialListResult); err != nil { + return CredentialClientListByTestBaseAccountResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/credentials_client.go b/sdk/resourcemanager/testbase/armtestbase/credentials_client.go new file mode 100644 index 000000000000..d11e0a6f0e87 --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/credentials_client.go @@ -0,0 +1,228 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CredentialsClient contains the methods for the Credentials group. +// Don't use this type directly, use NewCredentialsClient() instead. +type CredentialsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCredentialsClient creates a new instance of CredentialsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCredentialsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CredentialsClient, error) { + cl, err := arm.NewClient(moduleName+".CredentialsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CredentialsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates or replaces a Test Base Credential. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - credentialName - The credential resource name. +// - parameters - Parameters supplied to create a Test Base Credential. +// - options - CredentialsClientCreateOptions contains the optional parameters for the CredentialsClient.Create method. +func (client *CredentialsClient) Create(ctx context.Context, resourceGroupName string, testBaseAccountName string, credentialName string, parameters CredentialResource, options *CredentialsClientCreateOptions) (CredentialsClientCreateResponse, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceGroupName, testBaseAccountName, credentialName, parameters, options) + if err != nil { + return CredentialsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CredentialsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return CredentialsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *CredentialsClient) createCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, credentialName string, parameters CredentialResource, options *CredentialsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if credentialName == "" { + return nil, errors.New("parameter credentialName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialName}", url.PathEscape(credentialName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *CredentialsClient) createHandleResponse(resp *http.Response) (CredentialsClientCreateResponse, error) { + result := CredentialsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialResource); err != nil { + return CredentialsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes an existing test base credential. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - credentialName - The credential resource name. +// - options - CredentialsClientDeleteOptions contains the optional parameters for the CredentialsClient.Delete method. +func (client *CredentialsClient) Delete(ctx context.Context, resourceGroupName string, testBaseAccountName string, credentialName string, options *CredentialsClientDeleteOptions) (CredentialsClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, credentialName, options) + if err != nil { + return CredentialsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CredentialsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return CredentialsClientDeleteResponse{}, err + } + return CredentialsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CredentialsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, credentialName string, options *CredentialsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if credentialName == "" { + return nil, errors.New("parameter credentialName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialName}", url.PathEscape(credentialName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Updates an existing test base credential. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - credentialName - The credential resource name. +// - parameters - Parameters supplied to create a test base credential. +// - options - CredentialsClientUpdateOptions contains the optional parameters for the CredentialsClient.Update method. +func (client *CredentialsClient) Update(ctx context.Context, resourceGroupName string, testBaseAccountName string, credentialName string, parameters CredentialResource, options *CredentialsClientUpdateOptions) (CredentialsClientUpdateResponse, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, testBaseAccountName, credentialName, parameters, options) + if err != nil { + return CredentialsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CredentialsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CredentialsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *CredentialsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, credentialName string, parameters CredentialResource, options *CredentialsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/credentials/{credentialName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if credentialName == "" { + return nil, errors.New("parameter credentialName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{credentialName}", url.PathEscape(credentialName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *CredentialsClient) updateHandleResponse(resp *http.Response) (CredentialsClientUpdateResponse, error) { + result := CredentialsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CredentialResource); err != nil { + return CredentialsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/customerevents_client.go b/sdk/resourcemanager/testbase/armtestbase/customerevents_client.go index 5fa5396e3f1a..45801e4fdcc7 100644 --- a/sdk/resourcemanager/testbase/armtestbase/customerevents_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/customerevents_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type CustomerEventsClient struct { } // NewCustomerEventsClient creates a new instance of CustomerEventsClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewCustomerEventsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomerEventsClient, error) { @@ -47,8 +46,8 @@ func NewCustomerEventsClient(subscriptionID string, credential azcore.TokenCrede // BeginCreate - Create or replace a Test Base Customer Event. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - customerEventName - The resource name of the Test Base Customer event. // - parameters - Parameters supplied to create a Test Base CustomerEvent. @@ -60,9 +59,10 @@ func (client *CustomerEventsClient) BeginCreate(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomerEventsClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomerEventsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CustomerEventsClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,28 +71,27 @@ func (client *CustomerEventsClient) BeginCreate(ctx context.Context, resourceGro // Create - Create or replace a Test Base Customer Event. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview func (client *CustomerEventsClient) create(ctx context.Context, resourceGroupName string, testBaseAccountName string, customerEventName string, parameters CustomerEventResource, options *CustomerEventsClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, testBaseAccountName, customerEventName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. func (client *CustomerEventsClient) createCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, customerEventName string, parameters CustomerEventResource, options *CustomerEventsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -111,17 +110,20 @@ func (client *CustomerEventsClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a Test Base Customer Event. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - customerEventName - The resource name of the Test Base Customer event. // - options - CustomerEventsClientBeginDeleteOptions contains the optional parameters for the CustomerEventsClient.BeginDelete @@ -132,9 +134,10 @@ func (client *CustomerEventsClient) BeginDelete(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomerEventsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomerEventsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CustomerEventsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -143,28 +146,27 @@ func (client *CustomerEventsClient) BeginDelete(ctx context.Context, resourceGro // Delete - Deletes a Test Base Customer Event. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview func (client *CustomerEventsClient) deleteOperation(ctx context.Context, resourceGroupName string, testBaseAccountName string, customerEventName string, options *CustomerEventsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, customerEventName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. func (client *CustomerEventsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, customerEventName string, options *CustomerEventsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -183,7 +185,7 @@ func (client *CustomerEventsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -192,32 +194,32 @@ func (client *CustomerEventsClient) deleteCreateRequest(ctx context.Context, res // Get - Gets a Test Base CustomerEvent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - customerEventName - The resource name of the Test Base Customer event. // - options - CustomerEventsClientGetOptions contains the optional parameters for the CustomerEventsClient.Get method. func (client *CustomerEventsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, customerEventName string, options *CustomerEventsClientGetOptions) (CustomerEventsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, customerEventName, options) if err != nil { return CustomerEventsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CustomerEventsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CustomerEventsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CustomerEventsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *CustomerEventsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, customerEventName string, options *CustomerEventsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents/{customerEventName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -236,7 +238,7 @@ func (client *CustomerEventsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -253,8 +255,8 @@ func (client *CustomerEventsClient) getHandleResponse(resp *http.Response) (Cust // NewListByTestBaseAccountPager - Lists all notification events subscribed under a Test Base Account. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - CustomerEventsClientListByTestBaseAccountOptions contains the optional parameters for the CustomerEventsClient.NewListByTestBaseAccountPager // method. @@ -289,9 +291,6 @@ func (client *CustomerEventsClient) NewListByTestBaseAccountPager(resourceGroupN // listByTestBaseAccountCreateRequest creates the ListByTestBaseAccount request. func (client *CustomerEventsClient) listByTestBaseAccountCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *CustomerEventsClientListByTestBaseAccountOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customerEvents" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -306,7 +305,7 @@ func (client *CustomerEventsClient) listByTestBaseAccountCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/customerevents_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/customerevents_client_example_test.go deleted file mode 100644 index 33f07b6e5057..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/customerevents_client_example_test.go +++ /dev/null @@ -1,249 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/CustomerEventsList.json -func ExampleCustomerEventsClient_NewListByTestBaseAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomerEventsClient().NewListByTestBaseAccountPager("contoso-rg1", "contoso-testBaseAccount1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomerEventListResult = armtestbase.CustomerEventListResult{ - // Value: []*armtestbase.CustomerEventResource{ - // { - // Name: to.Ptr("ExecutionFailure"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/customerEvents"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/customerEvents/ExecutionFailure"), - // Properties: &armtestbase.CustomerEventProperties{ - // EventName: to.Ptr("ExecutionFailure"), - // Receivers: []*armtestbase.NotificationEventReceiver{ - // { - // ReceiverType: to.Ptr("SubscriptionRole"), - // ReceiverValue: &armtestbase.NotificationReceiverValue{ - // SubscriptionReceiverValue: &armtestbase.SubscriptionReceiverValue{ - // Role: to.Ptr("Contributor"), - // SubscriptionID: to.Ptr("test-subscription-id"), - // SubscriptionName: to.Ptr("test-subscription"), - // }, - // }, - // }, - // { - // ReceiverType: to.Ptr("DistributionGroup"), - // ReceiverValue: &armtestbase.NotificationReceiverValue{ - // DistributionGroupListReceiverValue: &armtestbase.DistributionGroupListReceiverValue{ - // DistributionGroups: []*string{ - // to.Ptr("test@microsoft.com")}, - // }, - // }, - // }}, - // }, - // }, - // { - // Name: to.Ptr("WeeklySummary"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/customerEvents"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/customerEvents/WeeklySummary"), - // Properties: &armtestbase.CustomerEventProperties{ - // EventName: to.Ptr("WeeklySummary"), - // Receivers: []*armtestbase.NotificationEventReceiver{ - // { - // ReceiverType: to.Ptr("UserObjects"), - // ReceiverValue: &armtestbase.NotificationReceiverValue{ - // UserObjectReceiverValue: &armtestbase.UserObjectReceiverValue{ - // UserObjectIDs: []*string{ - // to.Ptr("245245245245325"), - // to.Ptr("365365365363565")}, - // }, - // }, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/CustomerEventCreate.json -func ExampleCustomerEventsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCustomerEventsClient().BeginCreate(ctx, "contoso-rg1", "contoso-testBaseAccount1", "WeeklySummary", armtestbase.CustomerEventResource{ - Properties: &armtestbase.CustomerEventProperties{ - EventName: to.Ptr("WeeklySummary"), - Receivers: []*armtestbase.NotificationEventReceiver{ - { - ReceiverType: to.Ptr("UserObjects"), - ReceiverValue: &armtestbase.NotificationReceiverValue{ - UserObjectReceiverValue: &armtestbase.UserObjectReceiverValue{ - UserObjectIDs: []*string{ - to.Ptr("245245245245325"), - to.Ptr("365365365363565")}, - }, - }, - }, - { - ReceiverType: to.Ptr("DistributionGroup"), - ReceiverValue: &armtestbase.NotificationReceiverValue{ - DistributionGroupListReceiverValue: &armtestbase.DistributionGroupListReceiverValue{ - DistributionGroups: []*string{ - to.Ptr("test@microsoft.com")}, - }, - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomerEventResource = armtestbase.CustomerEventResource{ - // Name: to.Ptr("WeeklySummary"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/customerEvents"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/customerEvents/WeeklySummary"), - // Properties: &armtestbase.CustomerEventProperties{ - // EventName: to.Ptr("WeeklySummary"), - // Receivers: []*armtestbase.NotificationEventReceiver{ - // { - // ReceiverType: to.Ptr("UserObjects"), - // ReceiverValue: &armtestbase.NotificationReceiverValue{ - // UserObjectReceiverValue: &armtestbase.UserObjectReceiverValue{ - // UserObjectIDs: []*string{ - // to.Ptr("245245245245325"), - // to.Ptr("365365365363565")}, - // }, - // }, - // }, - // { - // ReceiverType: to.Ptr("DistributionGroup"), - // ReceiverValue: &armtestbase.NotificationReceiverValue{ - // DistributionGroupListReceiverValue: &armtestbase.DistributionGroupListReceiverValue{ - // DistributionGroups: []*string{ - // to.Ptr("test@microsoft.com")}, - // }, - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/CustomerEventDelete.json -func ExampleCustomerEventsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCustomerEventsClient().BeginDelete(ctx, "contoso-rg1", "contoso-testBaseAccount1", "WeeklySummary", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/CustomerEventGet.json -func ExampleCustomerEventsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomerEventsClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", "WeeklySummary", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomerEventResource = armtestbase.CustomerEventResource{ - // Name: to.Ptr("WeeklySummary"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/customerEvents"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/customerEvents/WeeklySummary"), - // Properties: &armtestbase.CustomerEventProperties{ - // EventName: to.Ptr("WeeklySummary"), - // Receivers: []*armtestbase.NotificationEventReceiver{ - // { - // ReceiverType: to.Ptr("UserObjects"), - // ReceiverValue: &armtestbase.NotificationReceiverValue{ - // UserObjectReceiverValue: &armtestbase.UserObjectReceiverValue{ - // UserObjectIDs: []*string{ - // to.Ptr("245245245245325"), - // to.Ptr("365365365363565")}, - // }, - // }, - // }, - // { - // ReceiverType: to.Ptr("SubscriptionRole"), - // ReceiverValue: &armtestbase.NotificationReceiverValue{ - // SubscriptionReceiverValue: &armtestbase.SubscriptionReceiverValue{ - // Role: to.Ptr("Contributor"), - // SubscriptionID: to.Ptr("test-subscription-id"), - // SubscriptionName: to.Ptr("test-subscription"), - // }, - // }, - // }, - // { - // ReceiverType: to.Ptr("DistributionGroup"), - // ReceiverValue: &armtestbase.NotificationReceiverValue{ - // DistributionGroupListReceiverValue: &armtestbase.DistributionGroupListReceiverValue{ - // DistributionGroups: []*string{ - // to.Ptr("test@microsoft.com")}, - // }, - // }, - // }}, - // }, - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/customimages_client.go b/sdk/resourcemanager/testbase/armtestbase/customimages_client.go new file mode 100644 index 000000000000..ea48d925f6eb --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/customimages_client.go @@ -0,0 +1,384 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CustomImagesClient contains the methods for the CustomImages group. +// Don't use this type directly, use NewCustomImagesClient() instead. +type CustomImagesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCustomImagesClient creates a new instance of CustomImagesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCustomImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomImagesClient, error) { + cl, err := arm.NewClient(moduleName+".CustomImagesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CustomImagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CheckImageNameAvailability - Checks that the test vase custom image generated from VHD resource has valid and unique definition +// and version, return architecture and OS state of potential existing image definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - parameters - Parameters supplied to the test base custom image CheckAvailability operation. +// - options - CustomImagesClientCheckImageNameAvailabilityOptions contains the optional parameters for the CustomImagesClient.CheckImageNameAvailability +// method. +func (client *CustomImagesClient) CheckImageNameAvailability(ctx context.Context, resourceGroupName string, testBaseAccountName string, parameters ImageNameCheckAvailabilityParameters, options *CustomImagesClientCheckImageNameAvailabilityOptions) (CustomImagesClientCheckImageNameAvailabilityResponse, error) { + var err error + req, err := client.checkImageNameAvailabilityCreateRequest(ctx, resourceGroupName, testBaseAccountName, parameters, options) + if err != nil { + return CustomImagesClientCheckImageNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CustomImagesClientCheckImageNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CustomImagesClientCheckImageNameAvailabilityResponse{}, err + } + resp, err := client.checkImageNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkImageNameAvailabilityCreateRequest creates the CheckImageNameAvailability request. +func (client *CustomImagesClient) checkImageNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, parameters ImageNameCheckAvailabilityParameters, options *CustomImagesClientCheckImageNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/checkImageNameAvailability" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// checkImageNameAvailabilityHandleResponse handles the CheckImageNameAvailability response. +func (client *CustomImagesClient) checkImageNameAvailabilityHandleResponse(resp *http.Response) (CustomImagesClientCheckImageNameAvailabilityResponse, error) { + result := CustomImagesClientCheckImageNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VerificationResult); err != nil { + return CustomImagesClientCheckImageNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreate - Creates a test base custom image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - customImageName - The resource name of the test base custom image. +// - parameters - Parameters supplied to create a test base custom image. +// - options - CustomImagesClientBeginCreateOptions contains the optional parameters for the CustomImagesClient.BeginCreate +// method. +func (client *CustomImagesClient) BeginCreate(ctx context.Context, resourceGroupName string, testBaseAccountName string, customImageName string, parameters CustomImageResource, options *CustomImagesClientBeginCreateOptions) (*runtime.Poller[CustomImagesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, testBaseAccountName, customImageName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomImagesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[CustomImagesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Create - Creates a test base custom image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +func (client *CustomImagesClient) create(ctx context.Context, resourceGroupName string, testBaseAccountName string, customImageName string, parameters CustomImageResource, options *CustomImagesClientBeginCreateOptions) (*http.Response, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceGroupName, testBaseAccountName, customImageName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *CustomImagesClient) createCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, customImageName string, parameters CustomImageResource, options *CustomImagesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if customImageName == "" { + return nil, errors.New("parameter customImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customImageName}", url.PathEscape(customImageName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a test base custom image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - customImageName - The resource name of the test base custom image. +// - options - CustomImagesClientBeginDeleteOptions contains the optional parameters for the CustomImagesClient.BeginDelete +// method. +func (client *CustomImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, testBaseAccountName string, customImageName string, options *CustomImagesClientBeginDeleteOptions) (*runtime.Poller[CustomImagesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, testBaseAccountName, customImageName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomImagesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[CustomImagesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes a test base custom image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +func (client *CustomImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, testBaseAccountName string, customImageName string, options *CustomImagesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, customImageName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CustomImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, customImageName string, options *CustomImagesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if customImageName == "" { + return nil, errors.New("parameter customImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customImageName}", url.PathEscape(customImageName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a test base custom image. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - customImageName - The resource name of the test base custom image. +// - options - CustomImagesClientGetOptions contains the optional parameters for the CustomImagesClient.Get method. +func (client *CustomImagesClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, customImageName string, options *CustomImagesClientGetOptions) (CustomImagesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, customImageName, options) + if err != nil { + return CustomImagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CustomImagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CustomImagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CustomImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, customImageName string, options *CustomImagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages/{customImageName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if customImageName == "" { + return nil, errors.New("parameter customImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customImageName}", url.PathEscape(customImageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CustomImagesClient) getHandleResponse(resp *http.Response) (CustomImagesClientGetResponse, error) { + result := CustomImagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomImageResource); err != nil { + return CustomImagesClientGetResponse{}, err + } + return result, nil +} + +// NewListByTestBaseAccountPager - Lists all the custom images under a test base account. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - CustomImagesClientListByTestBaseAccountOptions contains the optional parameters for the CustomImagesClient.NewListByTestBaseAccountPager +// method. +func (client *CustomImagesClient) NewListByTestBaseAccountPager(resourceGroupName string, testBaseAccountName string, options *CustomImagesClientListByTestBaseAccountOptions) *runtime.Pager[CustomImagesClientListByTestBaseAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[CustomImagesClientListByTestBaseAccountResponse]{ + More: func(page CustomImagesClientListByTestBaseAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CustomImagesClientListByTestBaseAccountResponse) (CustomImagesClientListByTestBaseAccountResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByTestBaseAccountCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CustomImagesClientListByTestBaseAccountResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CustomImagesClientListByTestBaseAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CustomImagesClientListByTestBaseAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByTestBaseAccountHandleResponse(resp) + }, + }) +} + +// listByTestBaseAccountCreateRequest creates the ListByTestBaseAccount request. +func (client *CustomImagesClient) listByTestBaseAccountCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *CustomImagesClientListByTestBaseAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/customImages" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByTestBaseAccountHandleResponse handles the ListByTestBaseAccount response. +func (client *CustomImagesClient) listByTestBaseAccountHandleResponse(resp *http.Response) (CustomImagesClientListByTestBaseAccountResponse, error) { + result := CustomImagesClientListByTestBaseAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomImageListResult); err != nil { + return CustomImagesClientListByTestBaseAccountResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/draftpackages_client.go b/sdk/resourcemanager/testbase/armtestbase/draftpackages_client.go new file mode 100644 index 000000000000..74a1756a3d4d --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/draftpackages_client.go @@ -0,0 +1,654 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// DraftPackagesClient contains the methods for the DraftPackages group. +// Don't use this type directly, use NewDraftPackagesClient() instead. +type DraftPackagesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDraftPackagesClient creates a new instance of DraftPackagesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDraftPackagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DraftPackagesClient, error) { + cl, err := arm.NewClient(moduleName+".DraftPackagesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DraftPackagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCopyFromPackage - Copy package file and metadata from a package to this draft package +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - draftPackageName - The resource name of the Test Base Draft Package. +// - parameters - Parameters supplied to the Test Base Draft Package CopyFromPackage operation. +// - options - DraftPackagesClientBeginCopyFromPackageOptions contains the optional parameters for the DraftPackagesClient.BeginCopyFromPackage +// method. +func (client *DraftPackagesClient) BeginCopyFromPackage(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters CopyFromPackageOperationParameters, options *DraftPackagesClientBeginCopyFromPackageOptions) (*runtime.Poller[DraftPackagesClientCopyFromPackageResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.copyFromPackage(ctx, resourceGroupName, testBaseAccountName, draftPackageName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DraftPackagesClientCopyFromPackageResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DraftPackagesClientCopyFromPackageResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CopyFromPackage - Copy package file and metadata from a package to this draft package +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +func (client *DraftPackagesClient) copyFromPackage(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters CopyFromPackageOperationParameters, options *DraftPackagesClientBeginCopyFromPackageOptions) (*http.Response, error) { + var err error + req, err := client.copyFromPackageCreateRequest(ctx, resourceGroupName, testBaseAccountName, draftPackageName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// copyFromPackageCreateRequest creates the CopyFromPackage request. +func (client *DraftPackagesClient) copyFromPackageCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters CopyFromPackageOperationParameters, options *DraftPackagesClientBeginCopyFromPackageOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/copyFromPackage" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if draftPackageName == "" { + return nil, errors.New("parameter draftPackageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{draftPackageName}", url.PathEscape(draftPackageName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// Create - Creates or replaces a Test Base Draft Package. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - draftPackageName - The resource name of the Test Base Draft Package. +// - parameters - Parameters supplied to create a Test Base Draft Package. +// - options - DraftPackagesClientCreateOptions contains the optional parameters for the DraftPackagesClient.Create method. +func (client *DraftPackagesClient) Create(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters DraftPackageResource, options *DraftPackagesClientCreateOptions) (DraftPackagesClientCreateResponse, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceGroupName, testBaseAccountName, draftPackageName, parameters, options) + if err != nil { + return DraftPackagesClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DraftPackagesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return DraftPackagesClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *DraftPackagesClient) createCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters DraftPackageResource, options *DraftPackagesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if draftPackageName == "" { + return nil, errors.New("parameter draftPackageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{draftPackageName}", url.PathEscape(draftPackageName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *DraftPackagesClient) createHandleResponse(resp *http.Response) (DraftPackagesClientCreateResponse, error) { + result := DraftPackagesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DraftPackageResource); err != nil { + return DraftPackagesClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a Test Base Draft Package. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - draftPackageName - The resource name of the Test Base Draft Package. +// - options - DraftPackagesClientDeleteOptions contains the optional parameters for the DraftPackagesClient.Delete method. +func (client *DraftPackagesClient) Delete(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, options *DraftPackagesClientDeleteOptions) (DraftPackagesClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, draftPackageName, options) + if err != nil { + return DraftPackagesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DraftPackagesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DraftPackagesClientDeleteResponse{}, err + } + return DraftPackagesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DraftPackagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, options *DraftPackagesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if draftPackageName == "" { + return nil, errors.New("parameter draftPackageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{draftPackageName}", url.PathEscape(draftPackageName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginExtractFile - Performs extracting file operation for a Test Base Draft Package +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - draftPackageName - The resource name of the Test Base Draft Package. +// - parameters - Parameters supplied to the Test Base Draft Package ExtractFile operation. +// - options - DraftPackagesClientBeginExtractFileOptions contains the optional parameters for the DraftPackagesClient.BeginExtractFile +// method. +func (client *DraftPackagesClient) BeginExtractFile(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters ExtractFileOperationParameters, options *DraftPackagesClientBeginExtractFileOptions) (*runtime.Poller[DraftPackagesClientExtractFileResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.extractFile(ctx, resourceGroupName, testBaseAccountName, draftPackageName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DraftPackagesClientExtractFileResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DraftPackagesClientExtractFileResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// ExtractFile - Performs extracting file operation for a Test Base Draft Package +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +func (client *DraftPackagesClient) extractFile(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters ExtractFileOperationParameters, options *DraftPackagesClientBeginExtractFileOptions) (*http.Response, error) { + var err error + req, err := client.extractFileCreateRequest(ctx, resourceGroupName, testBaseAccountName, draftPackageName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// extractFileCreateRequest creates the ExtractFile request. +func (client *DraftPackagesClient) extractFileCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters ExtractFileOperationParameters, options *DraftPackagesClientBeginExtractFileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/extractFile" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if draftPackageName == "" { + return nil, errors.New("parameter draftPackageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{draftPackageName}", url.PathEscape(draftPackageName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// BeginGenerateFoldersAndScripts - Generates folders and scripts +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - draftPackageName - The resource name of the Test Base Draft Package. +// - parameters - Parameters supplied to the Test Base Draft Package Generate operation. +// - options - DraftPackagesClientBeginGenerateFoldersAndScriptsOptions contains the optional parameters for the DraftPackagesClient.BeginGenerateFoldersAndScripts +// method. +func (client *DraftPackagesClient) BeginGenerateFoldersAndScripts(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters GenerateOperationParameters, options *DraftPackagesClientBeginGenerateFoldersAndScriptsOptions) (*runtime.Poller[DraftPackagesClientGenerateFoldersAndScriptsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateFoldersAndScripts(ctx, resourceGroupName, testBaseAccountName, draftPackageName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DraftPackagesClientGenerateFoldersAndScriptsResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DraftPackagesClientGenerateFoldersAndScriptsResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// GenerateFoldersAndScripts - Generates folders and scripts +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +func (client *DraftPackagesClient) generateFoldersAndScripts(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters GenerateOperationParameters, options *DraftPackagesClientBeginGenerateFoldersAndScriptsOptions) (*http.Response, error) { + var err error + req, err := client.generateFoldersAndScriptsCreateRequest(ctx, resourceGroupName, testBaseAccountName, draftPackageName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// generateFoldersAndScriptsCreateRequest creates the GenerateFoldersAndScripts request. +func (client *DraftPackagesClient) generateFoldersAndScriptsCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters GenerateOperationParameters, options *DraftPackagesClientBeginGenerateFoldersAndScriptsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/generateFoldersAndScripts" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if draftPackageName == "" { + return nil, errors.New("parameter draftPackageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{draftPackageName}", url.PathEscape(draftPackageName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// Get - Gets a Test Base Draft Package. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - draftPackageName - The resource name of the Test Base Draft Package. +// - options - DraftPackagesClientGetOptions contains the optional parameters for the DraftPackagesClient.Get method. +func (client *DraftPackagesClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, options *DraftPackagesClientGetOptions) (DraftPackagesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, draftPackageName, options) + if err != nil { + return DraftPackagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DraftPackagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DraftPackagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *DraftPackagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, options *DraftPackagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if draftPackageName == "" { + return nil, errors.New("parameter draftPackageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{draftPackageName}", url.PathEscape(draftPackageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DraftPackagesClient) getHandleResponse(resp *http.Response) (DraftPackagesClientGetResponse, error) { + result := DraftPackagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DraftPackageResource); err != nil { + return DraftPackagesClientGetResponse{}, err + } + return result, nil +} + +// GetPath - Gets draft package path and temp working path with SAS. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - draftPackageName - The resource name of the Test Base Draft Package. +// - options - DraftPackagesClientGetPathOptions contains the optional parameters for the DraftPackagesClient.GetPath method. +func (client *DraftPackagesClient) GetPath(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, options *DraftPackagesClientGetPathOptions) (DraftPackagesClientGetPathResponse, error) { + var err error + req, err := client.getPathCreateRequest(ctx, resourceGroupName, testBaseAccountName, draftPackageName, options) + if err != nil { + return DraftPackagesClientGetPathResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DraftPackagesClientGetPathResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DraftPackagesClientGetPathResponse{}, err + } + resp, err := client.getPathHandleResponse(httpResp) + return resp, err +} + +// getPathCreateRequest creates the GetPath request. +func (client *DraftPackagesClient) getPathCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, options *DraftPackagesClientGetPathOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}/getPath" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if draftPackageName == "" { + return nil, errors.New("parameter draftPackageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{draftPackageName}", url.PathEscape(draftPackageName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getPathHandleResponse handles the GetPath response. +func (client *DraftPackagesClient) getPathHandleResponse(resp *http.Response) (DraftPackagesClientGetPathResponse, error) { + result := DraftPackagesClientGetPathResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DraftPackageGetPathResponse); err != nil { + return DraftPackagesClientGetPathResponse{}, err + } + return result, nil +} + +// NewListByTestBaseAccountPager - Lists all the draft packages under a test base account. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - DraftPackagesClientListByTestBaseAccountOptions contains the optional parameters for the DraftPackagesClient.NewListByTestBaseAccountPager +// method. +func (client *DraftPackagesClient) NewListByTestBaseAccountPager(resourceGroupName string, testBaseAccountName string, options *DraftPackagesClientListByTestBaseAccountOptions) *runtime.Pager[DraftPackagesClientListByTestBaseAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[DraftPackagesClientListByTestBaseAccountResponse]{ + More: func(page DraftPackagesClientListByTestBaseAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DraftPackagesClientListByTestBaseAccountResponse) (DraftPackagesClientListByTestBaseAccountResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByTestBaseAccountCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DraftPackagesClientListByTestBaseAccountResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DraftPackagesClientListByTestBaseAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DraftPackagesClientListByTestBaseAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByTestBaseAccountHandleResponse(resp) + }, + }) +} + +// listByTestBaseAccountCreateRequest creates the ListByTestBaseAccount request. +func (client *DraftPackagesClient) listByTestBaseAccountCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *DraftPackagesClientListByTestBaseAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.PackageName != nil { + reqQP.Set("packageName", *options.PackageName) + } + if options != nil && options.EditPackage != nil { + reqQP.Set("editPackage", strconv.FormatBool(*options.EditPackage)) + } + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByTestBaseAccountHandleResponse handles the ListByTestBaseAccount response. +func (client *DraftPackagesClient) listByTestBaseAccountHandleResponse(resp *http.Response) (DraftPackagesClientListByTestBaseAccountResponse, error) { + result := DraftPackagesClientListByTestBaseAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DraftPackageListResult); err != nil { + return DraftPackagesClientListByTestBaseAccountResponse{}, err + } + return result, nil +} + +// Update - Updates an existing Test Base Draft Package. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - draftPackageName - The resource name of the Test Base Draft Package. +// - parameters - Parameters supplied to update a Test Base Draft Package. +// - options - DraftPackagesClientUpdateOptions contains the optional parameters for the DraftPackagesClient.Update method. +func (client *DraftPackagesClient) Update(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters DraftPackageUpdateParameters, options *DraftPackagesClientUpdateOptions) (DraftPackagesClientUpdateResponse, error) { + var err error + req, err := client.updateCreateRequest(ctx, resourceGroupName, testBaseAccountName, draftPackageName, parameters, options) + if err != nil { + return DraftPackagesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DraftPackagesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DraftPackagesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *DraftPackagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, draftPackageName string, parameters DraftPackageUpdateParameters, options *DraftPackagesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/draftPackages/{draftPackageName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if draftPackageName == "" { + return nil, errors.New("parameter draftPackageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{draftPackageName}", url.PathEscape(draftPackageName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *DraftPackagesClient) updateHandleResponse(resp *http.Response) (DraftPackagesClientUpdateResponse, error) { + result := DraftPackagesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DraftPackageResource); err != nil { + return DraftPackagesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/emailevents_client.go b/sdk/resourcemanager/testbase/armtestbase/emailevents_client.go index 0585556ef4d6..12cf63411e28 100644 --- a/sdk/resourcemanager/testbase/armtestbase/emailevents_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/emailevents_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type EmailEventsClient struct { } // NewEmailEventsClient creates a new instance of EmailEventsClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewEmailEventsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EmailEventsClient, error) { @@ -47,32 +46,32 @@ func NewEmailEventsClient(subscriptionID string, credential azcore.TokenCredenti // Get - Gets a email event of a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - emailEventResourceName - The resource name of an email event. // - options - EmailEventsClientGetOptions contains the optional parameters for the EmailEventsClient.Get method. func (client *EmailEventsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, emailEventResourceName string, options *EmailEventsClientGetOptions) (EmailEventsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, emailEventResourceName, options) if err != nil { return EmailEventsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return EmailEventsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EmailEventsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EmailEventsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *EmailEventsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, emailEventResourceName string, options *EmailEventsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/emailEvents/{emailEventResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -91,7 +90,7 @@ func (client *EmailEventsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,8 +107,8 @@ func (client *EmailEventsClient) getHandleResponse(resp *http.Response) (EmailEv // NewListPager - Lists all the email events of a Test Base Account. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - EmailEventsClientListOptions contains the optional parameters for the EmailEventsClient.NewListPager method. func (client *EmailEventsClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *EmailEventsClientListOptions) *runtime.Pager[EmailEventsClientListResponse] { @@ -143,9 +142,6 @@ func (client *EmailEventsClient) NewListPager(resourceGroupName string, testBase // listCreateRequest creates the List request. func (client *EmailEventsClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *EmailEventsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/emailEvents" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -160,7 +156,7 @@ func (client *EmailEventsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/emailevents_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/emailevents_client_example_test.go deleted file mode 100644 index d6ed80b29124..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/emailevents_client_example_test.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/EmailEventsList.json -func ExampleEmailEventsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEmailEventsClient().NewListPager("contoso-rg", "contoso-testBaseAccount", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EmailEventListResult = armtestbase.EmailEventListResult{ - // Value: []*armtestbase.EmailEventResource{ - // { - // Name: to.Ptr("weekly-summary"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/emailEvents"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/emailEvents/weekly-summary"), - // Properties: &armtestbase.EmailEventProperties{ - // DisplayName: to.Ptr("Weekly Summary"), - // EventID: to.Ptr("weekly-summary"), - // EventName: to.Ptr("weekly-summary"), - // }, - // }, - // { - // Name: to.Ptr("daily-summary"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/emailEvents"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/emailEvents/daily-summary"), - // Properties: &armtestbase.EmailEventProperties{ - // DisplayName: to.Ptr("Daily Summary"), - // EventID: to.Ptr("daily-summary"), - // EventName: to.Ptr("daily-summary"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/EmailEventGet.json -func ExampleEmailEventsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEmailEventsClient().Get(ctx, "contoso-rg", "contoso-testBaseAccount", "weekly-summary", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EmailEventResource = armtestbase.EmailEventResource{ - // Name: to.Ptr("weekly-summary"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/emailEvents"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/emailEvents/weekly-summary"), - // Properties: &armtestbase.EmailEventProperties{ - // DisplayName: to.Ptr("Weekly Summary"), - // EventID: to.Ptr("weekly-summary"), - // EventName: to.Ptr("weekly-summary"), - // }, - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/favoriteprocesses_client.go b/sdk/resourcemanager/testbase/armtestbase/favoriteprocesses_client.go index 94f592281728..0175aac11f86 100644 --- a/sdk/resourcemanager/testbase/armtestbase/favoriteprocesses_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/favoriteprocesses_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type FavoriteProcessesClient struct { } // NewFavoriteProcessesClient creates a new instance of FavoriteProcessesClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewFavoriteProcessesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FavoriteProcessesClient, error) { @@ -47,8 +46,8 @@ func NewFavoriteProcessesClient(subscriptionID string, credential azcore.TokenCr // Create - Create or replace a favorite process for a Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - favoriteProcessResourceName - The resource name of a favorite process in a package. If the process name contains characters @@ -58,26 +57,26 @@ func NewFavoriteProcessesClient(subscriptionID string, credential azcore.TokenCr // - options - FavoriteProcessesClientCreateOptions contains the optional parameters for the FavoriteProcessesClient.Create // method. func (client *FavoriteProcessesClient) Create(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, favoriteProcessResourceName string, parameters FavoriteProcessResource, options *FavoriteProcessesClientCreateOptions) (FavoriteProcessesClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, parameters, options) if err != nil { return FavoriteProcessesClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FavoriteProcessesClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FavoriteProcessesClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FavoriteProcessesClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. func (client *FavoriteProcessesClient) createCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, favoriteProcessResourceName string, parameters FavoriteProcessResource, options *FavoriteProcessesClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -100,10 +99,13 @@ func (client *FavoriteProcessesClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // createHandleResponse handles the Create response. @@ -118,8 +120,8 @@ func (client *FavoriteProcessesClient) createHandleResponse(resp *http.Response) // Delete - Deletes a favorite process for a specific package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - favoriteProcessResourceName - The resource name of a favorite process in a package. If the process name contains characters @@ -128,16 +130,18 @@ func (client *FavoriteProcessesClient) createHandleResponse(resp *http.Response) // - options - FavoriteProcessesClientDeleteOptions contains the optional parameters for the FavoriteProcessesClient.Delete // method. func (client *FavoriteProcessesClient) Delete(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, favoriteProcessResourceName string, options *FavoriteProcessesClientDeleteOptions) (FavoriteProcessesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, options) if err != nil { return FavoriteProcessesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FavoriteProcessesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return FavoriteProcessesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return FavoriteProcessesClientDeleteResponse{}, err } return FavoriteProcessesClientDeleteResponse{}, nil } @@ -145,9 +149,6 @@ func (client *FavoriteProcessesClient) Delete(ctx context.Context, resourceGroup // deleteCreateRequest creates the Delete request. func (client *FavoriteProcessesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, favoriteProcessResourceName string, options *FavoriteProcessesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -170,7 +171,7 @@ func (client *FavoriteProcessesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,8 +180,8 @@ func (client *FavoriteProcessesClient) deleteCreateRequest(ctx context.Context, // Get - Gets a favorite process for a Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - favoriteProcessResourceName - The resource name of a favorite process in a package. If the process name contains characters @@ -188,26 +189,26 @@ func (client *FavoriteProcessesClient) deleteCreateRequest(ctx context.Context, // name. // - options - FavoriteProcessesClientGetOptions contains the optional parameters for the FavoriteProcessesClient.Get method. func (client *FavoriteProcessesClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, favoriteProcessResourceName string, options *FavoriteProcessesClientGetOptions) (FavoriteProcessesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, options) if err != nil { return FavoriteProcessesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FavoriteProcessesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FavoriteProcessesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FavoriteProcessesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *FavoriteProcessesClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, favoriteProcessResourceName string, options *FavoriteProcessesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses/{favoriteProcessResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -230,7 +231,7 @@ func (client *FavoriteProcessesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,8 +248,8 @@ func (client *FavoriteProcessesClient) getHandleResponse(resp *http.Response) (F // NewListPager - Lists the favorite processes for a specific package. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - options - FavoriteProcessesClientListOptions contains the optional parameters for the FavoriteProcessesClient.NewListPager @@ -284,9 +285,6 @@ func (client *FavoriteProcessesClient) NewListPager(resourceGroupName string, te // listCreateRequest creates the List request. func (client *FavoriteProcessesClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *FavoriteProcessesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -305,7 +303,7 @@ func (client *FavoriteProcessesClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/favoriteprocesses_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/favoriteprocesses_client_example_test.go deleted file mode 100644 index 4bc19305c560..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/favoriteprocesses_client_example_test.go +++ /dev/null @@ -1,140 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/FavoriteProcessesList.json -func ExampleFavoriteProcessesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFavoriteProcessesClient().NewListPager("contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FavoriteProcessListResult = armtestbase.FavoriteProcessListResult{ - // Value: []*armtestbase.FavoriteProcessResource{ - // { - // Name: to.Ptr("testAppProcess"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/favoriteProcesses"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/favoriteProcesses/testAppProcess"), - // Properties: &armtestbase.FavoriteProcessProperties{ - // ActualProcessName: to.Ptr("testApp&.exe"), - // }, - // }, - // { - // Name: to.Ptr("anotherProcess"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/favoriteProcesses"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/favoriteProcesses/anotherProcess"), - // Properties: &armtestbase.FavoriteProcessProperties{ - // ActualProcessName: to.Ptr("anotherProcess&&.exe"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/FavoriteProcessCreate.json -func ExampleFavoriteProcessesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFavoriteProcessesClient().Create(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "testAppProcess", armtestbase.FavoriteProcessResource{ - Properties: &armtestbase.FavoriteProcessProperties{ - ActualProcessName: to.Ptr("testApp&.exe"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FavoriteProcessResource = armtestbase.FavoriteProcessResource{ - // Name: to.Ptr("testAppProcess"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/favoriteProcesses"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/favoriteProcesses/testAppProcess"), - // Properties: &armtestbase.FavoriteProcessProperties{ - // ActualProcessName: to.Ptr("testApp&.exe"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/FavoriteProcessDelete.json -func ExampleFavoriteProcessesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewFavoriteProcessesClient().Delete(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "testAppProcess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/FavoriteProcessGet.json -func ExampleFavoriteProcessesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFavoriteProcessesClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "testAppProcess", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FavoriteProcessResource = armtestbase.FavoriteProcessResource{ - // Name: to.Ptr("testAppProcess"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/favoriteProcesses"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/favoriteProcesses/testAppProcess"), - // Properties: &armtestbase.FavoriteProcessProperties{ - // ActualProcessName: to.Ptr("testApp&.exe"), - // }, - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/featureupdatesupportedoses_client.go b/sdk/resourcemanager/testbase/armtestbase/featureupdatesupportedoses_client.go new file mode 100644 index 000000000000..af63ae3c8c07 --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/featureupdatesupportedoses_client.go @@ -0,0 +1,111 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FeatureUpdateSupportedOsesClient contains the methods for the FeatureUpdateSupportedOses group. +// Don't use this type directly, use NewFeatureUpdateSupportedOsesClient() instead. +type FeatureUpdateSupportedOsesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFeatureUpdateSupportedOsesClient creates a new instance of FeatureUpdateSupportedOsesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFeatureUpdateSupportedOsesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FeatureUpdateSupportedOsesClient, error) { + cl, err := arm.NewClient(moduleName+".FeatureUpdateSupportedOsesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FeatureUpdateSupportedOsesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Lists all the available OSs to run a package under a Test Base Account. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - FeatureUpdateSupportedOsesClientListOptions contains the optional parameters for the FeatureUpdateSupportedOsesClient.NewListPager +// method. +func (client *FeatureUpdateSupportedOsesClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *FeatureUpdateSupportedOsesClientListOptions) *runtime.Pager[FeatureUpdateSupportedOsesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FeatureUpdateSupportedOsesClientListResponse]{ + More: func(page FeatureUpdateSupportedOsesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FeatureUpdateSupportedOsesClientListResponse) (FeatureUpdateSupportedOsesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FeatureUpdateSupportedOsesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FeatureUpdateSupportedOsesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FeatureUpdateSupportedOsesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FeatureUpdateSupportedOsesClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *FeatureUpdateSupportedOsesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/featureUpdateSupportedOses" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FeatureUpdateSupportedOsesClient) listHandleResponse(resp *http.Response) (FeatureUpdateSupportedOsesClientListResponse, error) { + result := FeatureUpdateSupportedOsesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FeatureUpdateSupportedOsesResult); err != nil { + return FeatureUpdateSupportedOsesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/firstpartyapps_client.go b/sdk/resourcemanager/testbase/armtestbase/firstpartyapps_client.go new file mode 100644 index 000000000000..e17a42f2822f --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/firstpartyapps_client.go @@ -0,0 +1,172 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirstPartyAppsClient contains the methods for the FirstPartyApps group. +// Don't use this type directly, use NewFirstPartyAppsClient() instead. +type FirstPartyAppsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFirstPartyAppsClient creates a new instance of FirstPartyAppsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFirstPartyAppsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirstPartyAppsClient, error) { + cl, err := arm.NewClient(moduleName+".FirstPartyAppsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirstPartyAppsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a first party application to prepare a test run for a Test Base Account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - firstPartyAppResourceName - The resource name of a first party application. +// - options - FirstPartyAppsClientGetOptions contains the optional parameters for the FirstPartyAppsClient.Get method. +func (client *FirstPartyAppsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, firstPartyAppResourceName string, options *FirstPartyAppsClientGetOptions) (FirstPartyAppsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, firstPartyAppResourceName, options) + if err != nil { + return FirstPartyAppsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirstPartyAppsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirstPartyAppsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FirstPartyAppsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, firstPartyAppResourceName string, options *FirstPartyAppsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/firstPartyApps/{firstPartyAppResourceName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if firstPartyAppResourceName == "" { + return nil, errors.New("parameter firstPartyAppResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firstPartyAppResourceName}", url.PathEscape(firstPartyAppResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FirstPartyAppsClient) getHandleResponse(resp *http.Response) (FirstPartyAppsClientGetResponse, error) { + result := FirstPartyAppsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirstPartyAppResource); err != nil { + return FirstPartyAppsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all first party applications currently available for test runs under a Test Base Account. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - FirstPartyAppsClientListOptions contains the optional parameters for the FirstPartyAppsClient.NewListPager method. +func (client *FirstPartyAppsClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *FirstPartyAppsClientListOptions) *runtime.Pager[FirstPartyAppsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FirstPartyAppsClientListResponse]{ + More: func(page FirstPartyAppsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FirstPartyAppsClientListResponse) (FirstPartyAppsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FirstPartyAppsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirstPartyAppsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirstPartyAppsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FirstPartyAppsClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *FirstPartyAppsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/firstPartyApps" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FirstPartyAppsClient) listHandleResponse(resp *http.Response) (FirstPartyAppsClientListResponse, error) { + result := FirstPartyAppsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirstPartyAppListResult); err != nil { + return FirstPartyAppsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/flightingrings_client.go b/sdk/resourcemanager/testbase/armtestbase/flightingrings_client.go index c5729100c722..dcd3f0bdfe3a 100644 --- a/sdk/resourcemanager/testbase/armtestbase/flightingrings_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/flightingrings_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type FlightingRingsClient struct { } // NewFlightingRingsClient creates a new instance of FlightingRingsClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewFlightingRingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FlightingRingsClient, error) { @@ -47,32 +46,32 @@ func NewFlightingRingsClient(subscriptionID string, credential azcore.TokenCrede // Get - Gets a flighting ring of a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - flightingRingResourceName - The resource name of a flighting ring. // - options - FlightingRingsClientGetOptions contains the optional parameters for the FlightingRingsClient.Get method. func (client *FlightingRingsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, flightingRingResourceName string, options *FlightingRingsClientGetOptions) (FlightingRingsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, flightingRingResourceName, options) if err != nil { return FlightingRingsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FlightingRingsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FlightingRingsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FlightingRingsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *FlightingRingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, flightingRingResourceName string, options *FlightingRingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings/{flightingRingResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -91,7 +90,7 @@ func (client *FlightingRingsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,8 +107,8 @@ func (client *FlightingRingsClient) getHandleResponse(resp *http.Response) (Flig // NewListPager - Lists all the flighting rings of a Test Base Account. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - FlightingRingsClientListOptions contains the optional parameters for the FlightingRingsClient.NewListPager method. func (client *FlightingRingsClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *FlightingRingsClientListOptions) *runtime.Pager[FlightingRingsClientListResponse] { @@ -143,9 +142,6 @@ func (client *FlightingRingsClient) NewListPager(resourceGroupName string, testB // listCreateRequest creates the List request. func (client *FlightingRingsClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *FlightingRingsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/flightingRings" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -160,7 +156,7 @@ func (client *FlightingRingsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/flightingrings_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/flightingrings_client_example_test.go deleted file mode 100644 index 9f16ac9425be..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/flightingrings_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/FlightingRingsList.json -func ExampleFlightingRingsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFlightingRingsClient().NewListPager("contoso-rg", "contoso-testBaseAccount", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FlightingRingListResult = armtestbase.FlightingRingListResult{ - // Value: []*armtestbase.FlightingRingResource{ - // { - // Name: to.Ptr("Insider-Beta-Channel"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/flightingRings"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/flightingRings/Insider-Beta-Channel"), - // Properties: &armtestbase.FlightingRingProperties{ - // ActualFlightingRingName: to.Ptr("Insider Beta Channel"), - // }, - // }, - // { - // Name: to.Ptr("Another-Channel"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/flightingRings"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/flightingRings/Another-Channel"), - // Properties: &armtestbase.FlightingRingProperties{ - // ActualFlightingRingName: to.Ptr("Another Channel"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/FlightingRingGet.json -func ExampleFlightingRingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFlightingRingsClient().Get(ctx, "contoso-rg", "contoso-testBaseAccount", "Insider-Beta-Channel", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FlightingRingResource = armtestbase.FlightingRingResource{ - // Name: to.Ptr("Insider-Beta-Channel"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/flightingRings"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/flightingRings/Insider-Beta-Channel"), - // Properties: &armtestbase.FlightingRingProperties{ - // ActualFlightingRingName: to.Ptr("Insider Beta Channel"), - // }, - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/freehourbalances_client.go b/sdk/resourcemanager/testbase/armtestbase/freehourbalances_client.go new file mode 100644 index 000000000000..c0a4758616e5 --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/freehourbalances_client.go @@ -0,0 +1,173 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FreeHourBalancesClient contains the methods for the FreeHourBalances group. +// Don't use this type directly, use NewFreeHourBalancesClient() instead. +type FreeHourBalancesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFreeHourBalancesClient creates a new instance of FreeHourBalancesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFreeHourBalancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FreeHourBalancesClient, error) { + cl, err := arm.NewClient(moduleName+".FreeHourBalancesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FreeHourBalancesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Return the Test Base free hour balance. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - freeHourBalanceName - The name of the free hour balance of a Test Base Account. +// - options - FreeHourBalancesClientGetOptions contains the optional parameters for the FreeHourBalancesClient.Get method. +func (client *FreeHourBalancesClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, freeHourBalanceName FreeHourBalanceName, options *FreeHourBalancesClientGetOptions) (FreeHourBalancesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, freeHourBalanceName, options) + if err != nil { + return FreeHourBalancesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FreeHourBalancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FreeHourBalancesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FreeHourBalancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, freeHourBalanceName FreeHourBalanceName, options *FreeHourBalancesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/freeHourBalances/{freeHourBalanceName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if freeHourBalanceName == "" { + return nil, errors.New("parameter freeHourBalanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{freeHourBalanceName}", url.PathEscape(string(freeHourBalanceName))) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FreeHourBalancesClient) getHandleResponse(resp *http.Response) (FreeHourBalancesClientGetResponse, error) { + result := FreeHourBalancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FreeHourBalanceResource); err != nil { + return FreeHourBalancesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Return the Test Base free hour balances list. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - FreeHourBalancesClientListOptions contains the optional parameters for the FreeHourBalancesClient.NewListPager +// method. +func (client *FreeHourBalancesClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *FreeHourBalancesClientListOptions) *runtime.Pager[FreeHourBalancesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FreeHourBalancesClientListResponse]{ + More: func(page FreeHourBalancesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FreeHourBalancesClientListResponse) (FreeHourBalancesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FreeHourBalancesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FreeHourBalancesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FreeHourBalancesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FreeHourBalancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *FreeHourBalancesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/freeHourBalances" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FreeHourBalancesClient) listHandleResponse(resp *http.Response) (FreeHourBalancesClientListResponse, error) { + result := FreeHourBalancesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FreeHourBalancesListResult); err != nil { + return FreeHourBalancesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/galleryapps_client.go b/sdk/resourcemanager/testbase/armtestbase/galleryapps_client.go new file mode 100644 index 000000000000..b6608cbcb94c --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/galleryapps_client.go @@ -0,0 +1,186 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// GalleryAppsClient contains the methods for the GalleryApps group. +// Don't use this type directly, use NewGalleryAppsClient() instead. +type GalleryAppsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGalleryAppsClient creates a new instance of GalleryAppsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGalleryAppsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryAppsClient, error) { + cl, err := arm.NewClient(moduleName+".GalleryAppsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GalleryAppsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a gallery application to prepare a test run for a Test Base Account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - galleryAppName - The resource name of a gallery application. +// - options - GalleryAppsClientGetOptions contains the optional parameters for the GalleryAppsClient.Get method. +func (client *GalleryAppsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, galleryAppName string, options *GalleryAppsClientGetOptions) (GalleryAppsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, galleryAppName, options) + if err != nil { + return GalleryAppsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryAppsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GalleryAppsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *GalleryAppsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, galleryAppName string, options *GalleryAppsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if galleryAppName == "" { + return nil, errors.New("parameter galleryAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryAppName}", url.PathEscape(galleryAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GalleryAppsClient) getHandleResponse(resp *http.Response) (GalleryAppsClientGetResponse, error) { + result := GalleryAppsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryAppResource); err != nil { + return GalleryAppsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all gallery applications currently available for test runs under a Test Base Account which matches +// user query. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - GalleryAppsClientListOptions contains the optional parameters for the GalleryAppsClient.NewListPager method. +func (client *GalleryAppsClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *GalleryAppsClientListOptions) *runtime.Pager[GalleryAppsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GalleryAppsClientListResponse]{ + More: func(page GalleryAppsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GalleryAppsClientListResponse) (GalleryAppsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GalleryAppsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryAppsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryAppsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *GalleryAppsClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *GalleryAppsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + if options != nil && options.Keyword != nil { + reqQP.Set("keyword", *options.Keyword) + } + if options != nil && options.ApplicationType != nil { + reqQP.Set("applicationType", string(*options.ApplicationType)) + } + if options != nil && options.OrderBy != nil { + reqQP.Set("orderBy", string(*options.OrderBy)) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *GalleryAppsClient) listHandleResponse(resp *http.Response) (GalleryAppsClientListResponse, error) { + result := GalleryAppsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryAppListResult); err != nil { + return GalleryAppsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/galleryappskus_client.go b/sdk/resourcemanager/testbase/armtestbase/galleryappskus_client.go new file mode 100644 index 000000000000..7fbe9105fd63 --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/galleryappskus_client.go @@ -0,0 +1,182 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// GalleryAppSKUsClient contains the methods for the GalleryAppSKUs group. +// Don't use this type directly, use NewGalleryAppSKUsClient() instead. +type GalleryAppSKUsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGalleryAppSKUsClient creates a new instance of GalleryAppSKUsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGalleryAppSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GalleryAppSKUsClient, error) { + cl, err := arm.NewClient(moduleName+".GalleryAppSKUsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GalleryAppSKUsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a gallery application SKU to prepare a test run for a Test Base Account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - galleryAppName - The resource name of a gallery application. +// - galleryAppSKUName - The resource name of a gallery application SKU. +// - options - GalleryAppSKUsClientGetOptions contains the optional parameters for the GalleryAppSKUsClient.Get method. +func (client *GalleryAppSKUsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, galleryAppName string, galleryAppSKUName string, options *GalleryAppSKUsClientGetOptions) (GalleryAppSKUsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, galleryAppName, galleryAppSKUName, options) + if err != nil { + return GalleryAppSKUsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryAppSKUsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GalleryAppSKUsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *GalleryAppSKUsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, galleryAppName string, galleryAppSKUName string, options *GalleryAppSKUsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}/galleryAppSkus/{galleryAppSkuName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if galleryAppName == "" { + return nil, errors.New("parameter galleryAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryAppName}", url.PathEscape(galleryAppName)) + if galleryAppSKUName == "" { + return nil, errors.New("parameter galleryAppSKUName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryAppSkuName}", url.PathEscape(galleryAppSKUName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GalleryAppSKUsClient) getHandleResponse(resp *http.Response) (GalleryAppSKUsClientGetResponse, error) { + result := GalleryAppSKUsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryAppSKUResource); err != nil { + return GalleryAppSKUsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists all SKUs of a gallery application currently available for test runs under a Test Base Account. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - galleryAppName - The resource name of a gallery application. +// - options - GalleryAppSKUsClientListOptions contains the optional parameters for the GalleryAppSKUsClient.NewListPager method. +func (client *GalleryAppSKUsClient) NewListPager(resourceGroupName string, testBaseAccountName string, galleryAppName string, options *GalleryAppSKUsClientListOptions) *runtime.Pager[GalleryAppSKUsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GalleryAppSKUsClientListResponse]{ + More: func(page GalleryAppSKUsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GalleryAppSKUsClientListResponse) (GalleryAppSKUsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, testBaseAccountName, galleryAppName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GalleryAppSKUsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GalleryAppSKUsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryAppSKUsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *GalleryAppSKUsClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, galleryAppName string, options *GalleryAppSKUsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/galleryApps/{galleryAppName}/galleryAppSkus" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if galleryAppName == "" { + return nil, errors.New("parameter galleryAppName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryAppName}", url.PathEscape(galleryAppName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *GalleryAppSKUsClient) listHandleResponse(resp *http.Response) (GalleryAppSKUsClientListResponse, error) { + result := GalleryAppSKUsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryAppSKUListResult); err != nil { + return GalleryAppSKUsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/go.mod b/sdk/resourcemanager/testbase/armtestbase/go.mod index 3fcb6cc04ec6..41cfe4f06453 100644 --- a/sdk/resourcemanager/testbase/armtestbase/go.mod +++ b/sdk/resourcemanager/testbase/armtestbase/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbas go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/testbase/armtestbase/go.sum b/sdk/resourcemanager/testbase/armtestbase/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/testbase/armtestbase/go.sum +++ b/sdk/resourcemanager/testbase/armtestbase/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/testbase/armtestbase/imagedefinitions_client.go b/sdk/resourcemanager/testbase/armtestbase/imagedefinitions_client.go new file mode 100644 index 000000000000..8446b14ce528 --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/imagedefinitions_client.go @@ -0,0 +1,292 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ImageDefinitionsClient contains the methods for the ImageDefinitions group. +// Don't use this type directly, use NewImageDefinitionsClient() instead. +type ImageDefinitionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewImageDefinitionsClient creates a new instance of ImageDefinitionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewImageDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImageDefinitionsClient, error) { + cl, err := arm.NewClient(moduleName+".ImageDefinitionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ImageDefinitionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create image definition for test base custom images which are derived from 'VHD' source. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - imageDefinitionName - The resource name of the test base image definition. +// - parameters - Parameters supplied to create a test base image definition. +// - options - ImageDefinitionsClientCreateOptions contains the optional parameters for the ImageDefinitionsClient.Create method. +func (client *ImageDefinitionsClient) Create(ctx context.Context, resourceGroupName string, testBaseAccountName string, imageDefinitionName string, parameters ImageDefinitionResource, options *ImageDefinitionsClientCreateOptions) (ImageDefinitionsClientCreateResponse, error) { + var err error + req, err := client.createCreateRequest(ctx, resourceGroupName, testBaseAccountName, imageDefinitionName, parameters, options) + if err != nil { + return ImageDefinitionsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImageDefinitionsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ImageDefinitionsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *ImageDefinitionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, imageDefinitionName string, parameters ImageDefinitionResource, options *ImageDefinitionsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if imageDefinitionName == "" { + return nil, errors.New("parameter imageDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageDefinitionName}", url.PathEscape(imageDefinitionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *ImageDefinitionsClient) createHandleResponse(resp *http.Response) (ImageDefinitionsClientCreateResponse, error) { + result := ImageDefinitionsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageDefinitionResource); err != nil { + return ImageDefinitionsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a test base image definition resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - imageDefinitionName - The resource name of the test base image definition. +// - options - ImageDefinitionsClientDeleteOptions contains the optional parameters for the ImageDefinitionsClient.Delete method. +func (client *ImageDefinitionsClient) Delete(ctx context.Context, resourceGroupName string, testBaseAccountName string, imageDefinitionName string, options *ImageDefinitionsClientDeleteOptions) (ImageDefinitionsClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, imageDefinitionName, options) + if err != nil { + return ImageDefinitionsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImageDefinitionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ImageDefinitionsClientDeleteResponse{}, err + } + return ImageDefinitionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ImageDefinitionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, imageDefinitionName string, options *ImageDefinitionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if imageDefinitionName == "" { + return nil, errors.New("parameter imageDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageDefinitionName}", url.PathEscape(imageDefinitionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get image properties under the image definition name created by test base custom image which derived from 'VHD' source. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - imageDefinitionName - The resource name of the test base image definition. +// - options - ImageDefinitionsClientGetOptions contains the optional parameters for the ImageDefinitionsClient.Get method. +func (client *ImageDefinitionsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, imageDefinitionName string, options *ImageDefinitionsClientGetOptions) (ImageDefinitionsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, imageDefinitionName, options) + if err != nil { + return ImageDefinitionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImageDefinitionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ImageDefinitionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ImageDefinitionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, imageDefinitionName string, options *ImageDefinitionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions/{imageDefinitionName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if imageDefinitionName == "" { + return nil, errors.New("parameter imageDefinitionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{imageDefinitionName}", url.PathEscape(imageDefinitionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ImageDefinitionsClient) getHandleResponse(resp *http.Response) (ImageDefinitionsClientGetResponse, error) { + result := ImageDefinitionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageDefinitionResource); err != nil { + return ImageDefinitionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByTestBaseAccountPager - List all image definition properties created by test base custom images which are derived +// from 'VHD' source. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - ImageDefinitionsClientListByTestBaseAccountOptions contains the optional parameters for the ImageDefinitionsClient.NewListByTestBaseAccountPager +// method. +func (client *ImageDefinitionsClient) NewListByTestBaseAccountPager(resourceGroupName string, testBaseAccountName string, options *ImageDefinitionsClientListByTestBaseAccountOptions) *runtime.Pager[ImageDefinitionsClientListByTestBaseAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[ImageDefinitionsClientListByTestBaseAccountResponse]{ + More: func(page ImageDefinitionsClientListByTestBaseAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ImageDefinitionsClientListByTestBaseAccountResponse) (ImageDefinitionsClientListByTestBaseAccountResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByTestBaseAccountCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ImageDefinitionsClientListByTestBaseAccountResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ImageDefinitionsClientListByTestBaseAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImageDefinitionsClientListByTestBaseAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByTestBaseAccountHandleResponse(resp) + }, + }) +} + +// listByTestBaseAccountCreateRequest creates the ListByTestBaseAccount request. +func (client *ImageDefinitionsClient) listByTestBaseAccountCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *ImageDefinitionsClientListByTestBaseAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/imageDefinitions" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByTestBaseAccountHandleResponse handles the ListByTestBaseAccount response. +func (client *ImageDefinitionsClient) listByTestBaseAccountHandleResponse(resp *http.Response) (ImageDefinitionsClientListByTestBaseAccountResponse, error) { + result := ImageDefinitionsClientListByTestBaseAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageDefinitionsListResult); err != nil { + return ImageDefinitionsClientListByTestBaseAccountResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/testbase/armtestbase/interfaces.go b/sdk/resourcemanager/testbase/armtestbase/interfaces.go new file mode 100644 index 000000000000..07993b809586 --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/interfaces.go @@ -0,0 +1,38 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +// AnalysisResultSingletonResourcePropertiesClassification provides polymorphic access to related types. +// Call the interface's GetAnalysisResultSingletonResourceProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AnalysisResultSingletonResourceProperties, *CPURegressionResultSingletonResourceProperties, *CPUUtilizationResultSingletonResourceProperties, +// - *MemoryRegressionResultSingletonResourceProperties, *MemoryUtilizationResultSingletonResourceProperties, *ReliabilityResultSingletonResourceProperties, +// - *ScriptExecutionResultSingletonResourceProperties, *TestAnalysisResultSingletonResourceProperties +type AnalysisResultSingletonResourcePropertiesClassification interface { + // GetAnalysisResultSingletonResourceProperties returns the AnalysisResultSingletonResourceProperties content of the underlying type. + GetAnalysisResultSingletonResourceProperties() *AnalysisResultSingletonResourceProperties +} + +// CredentialPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetCredentialProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *CredentialProperties, *IntuneSingletonResourceProperties +type CredentialPropertiesClassification interface { + // GetCredentialProperties returns the CredentialProperties content of the underlying type. + GetCredentialProperties() *CredentialProperties +} + +// GalleryAppSKUPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetGalleryAppSKUProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *GalleryAppSKUProperties, *WingetAppSKUProperties +type GalleryAppSKUPropertiesClassification interface { + // GetGalleryAppSKUProperties returns the GalleryAppSKUProperties content of the underlying type. + GetGalleryAppSKUProperties() *GalleryAppSKUProperties +} diff --git a/sdk/resourcemanager/testbase/armtestbase/models.go b/sdk/resourcemanager/testbase/armtestbase/models.go index 01a6d7081fb4..f9bb8202cbaa 100644 --- a/sdk/resourcemanager/testbase/armtestbase/models.go +++ b/sdk/resourcemanager/testbase/armtestbase/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -25,25 +24,25 @@ type AccountResource struct { // REQUIRED; The geo-location where the resource lives Location *string + // The identity of the testBaseAccount. + Identity *SystemAssignedServiceIdentity + // Properties of a Test Base Account. Properties *AccountResourceProperties - // The tags of the resource. + // Resource tags. Tags map[string]*string - // READ-ONLY; Resource Etag. - Etag *string - - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -103,6 +102,9 @@ type AccountUpdateParameterProperties struct { // AccountUpdateParameters - Parameters supplied to update a Test Base Account. type AccountUpdateParameters struct { + // The identity of the testBaseAccount. + Identity *SystemAssignedServiceIdentity + // Test Base Account update parameters. Properties *AccountUpdateParameterProperties @@ -146,61 +148,43 @@ type AccountUsageName struct { Value *string } -// AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method. -type AccountsClientBeginCreateOptions struct { - // The flag indicating if we would like to restore the Test Base Accounts which were soft deleted before. - Restore *bool - // Resumes the LRO from the provided token. - ResumeToken string -} +type ActionRequest struct { + // Test Base Draft Package properties. + Properties *ActionRequestProperties -// AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. -type AccountsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string -// AccountsClientBeginOffboardOptions contains the optional parameters for the AccountsClient.BeginOffboard method. -type AccountsClientBeginOffboardOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // READ-ONLY; The name of the resource + Name *string -// AccountsClientBeginUpdateOptions contains the optional parameters for the AccountsClient.BeginUpdate method. -type AccountsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData -// AccountsClientCheckPackageNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckPackageNameAvailability -// method. -type AccountsClientCheckPackageNameAvailabilityOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// AccountsClientGetFileUploadURLOptions contains the optional parameters for the AccountsClient.GetFileUploadURL method. -type AccountsClientGetFileUploadURLOptions struct { - // Parameters supplied to the Test Base Account GetFileUploadURL operation. - Parameters *GetFileUploadURLParameters -} +type ActionRequestProperties struct { + // REQUIRED + RequestType *RequestTypes + PreReleaseAccessRequestSpec *PreReleaseAccessRequestSpec -// AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. -type AccountsClientGetOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY + CreationDate *time.Time + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState -// AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager -// method. -type AccountsClientListByResourceGroupOptions struct { - // The flag indicating if we need to include the Test Base Accounts which were soft deleted before. - GetDeleted *bool + // READ-ONLY + Status *RequestStatus } -// AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.NewListBySubscriptionPager -// method. -type AccountsClientListBySubscriptionOptions struct { - // The flag indicating if we need to include the Test Base Accounts which were soft deleted before. - GetDeleted *bool +type ActionRequests struct { + Value []*ActionRequest + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string } // AnalysisResultListResult - A list of Analysis Results. It will only contain one element as all the data will be nested @@ -218,30 +202,19 @@ type AnalysisResultSingletonResource struct { // Properties of an Analysis Result. Properties AnalysisResultSingletonResourcePropertiesClassification - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// AnalysisResultSingletonResourcePropertiesClassification provides polymorphic access to related types. -// Call the interface's GetAnalysisResultSingletonResourceProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AnalysisResultSingletonResourceProperties, *CPURegressionResultSingletonResourceProperties, *CPUUtilizationResultSingletonResourceProperties, -// - *MemoryRegressionResultSingletonResourceProperties, *MemoryUtilizationResultSingletonResourceProperties, *ReliabilityResultSingletonResourceProperties, -// - *ScriptExecutionResultSingletonResourceProperties, *TestAnalysisResultSingletonResourceProperties -type AnalysisResultSingletonResourcePropertiesClassification interface { - // GetAnalysisResultSingletonResourceProperties returns the AnalysisResultSingletonResourceProperties content of the underlying type. - GetAnalysisResultSingletonResourceProperties() *AnalysisResultSingletonResourceProperties -} - // AnalysisResultSingletonResourceProperties - The properties of Analysis Result resource. type AnalysisResultSingletonResourceProperties struct { // REQUIRED; Type of the Analysis Result. @@ -257,24 +230,58 @@ func (a *AnalysisResultSingletonResourceProperties) GetAnalysisResultSingletonRe return a } -// AnalysisResultsClientGetOptions contains the optional parameters for the AnalysisResultsClient.Get method. -type AnalysisResultsClientGetOptions struct { - // placeholder for future optional parameters +// AnswerCitation - The answer citation. +type AnswerCitation struct { + // The chunk index of the content. + ChunkIndex *int32 + + // The title of the citation. + Title *string + + // The url of the citation. + URL *string } -// AnalysisResultsClientListOptions contains the optional parameters for the AnalysisResultsClient.NewListPager method. -type AnalysisResultsClientListOptions struct { - // placeholder for future optional parameters +// AvailableInplaceUpgradeOSListResult - A list of available In-place Upgrade OSs. +type AvailableInplaceUpgradeOSListResult struct { + // The list of available In-place Upgrade OS. + Value []*AvailableInplaceUpgradeOSResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string } -// AvailableOSClientGetOptions contains the optional parameters for the AvailableOSClient.Get method. -type AvailableOSClientGetOptions struct { - // placeholder for future optional parameters +// AvailableInplaceUpgradeOSProperties - The Available In-place Upgrade OS properties. +type AvailableInplaceUpgradeOSProperties struct { + // The name of an Available In-place Upgrade source OS of a Test Base Account. + SourceOsName *string + + // The the release list of the source os. + SourceOsReleases []*ReleaseProperties + + // The list of the corresponding Available In-place Upgrade target OS name of a Test Base Account. + SupportedTargetOsNameList []*string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState } -// AvailableOSClientListOptions contains the optional parameters for the AvailableOSClient.NewListPager method. -type AvailableOSClientListOptions struct { - // placeholder for future optional parameters +// AvailableInplaceUpgradeOSResource - The Available In-place Upgrade OS Map resource. +type AvailableInplaceUpgradeOSResource struct { + // Available In-place Upgrade OS Map properties. + Properties *AvailableInplaceUpgradeOSProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // AvailableOSListResult - A list of available OSs. @@ -312,19 +319,110 @@ type AvailableOSResource struct { // Available OS properties. Properties *AvailableOSProperties - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } +type BillingHubExecutionUsageDetail struct { + ApplicationName *string + ApplicationVersion *string + BilledCharges *float64 + EndTimeStamp *time.Time + ExecutionRequestID *string + MeterID *string + OSBuild *string + Release *string + SKU *string + StartTimeStamp *time.Time + TestType *string + UpdateType *string + UsedBillableHours *float64 + UsedFreeHours *float64 +} + +type BillingHubFreeHourIncrementEntry struct { + CreateTimeStamp *time.Time + ExpirationTimeStamp *time.Time + FreeHourStatus *FreeHourStatus + FreeHourType *FreeHourType + IncrementalFreeHours *float64 + RemainingFreeHours *float64 +} + +type BillingHubGetFreeHourBalanceResponse struct { + IncrementEntries []*BillingHubFreeHourIncrementEntry + TotalRemainingFreeHours *float64 +} + +type BillingHubGetUsageRequest struct { + // REQUIRED + EndTimeStamp *time.Time + + // REQUIRED + StartTimeStamp *time.Time + PageIndex *int32 + PageSize *int32 +} + +type BillingHubGetUsageResponse struct { + NextRequest *BillingHubGetUsageRequest + PackageUsageEntries []*BillingHubPackageUsage + TotalCharges *float64 + TotalUsedBillableHours *float64 + TotalUsedFreeHours *float64 +} + +type BillingHubPackageUsage struct { + ApplicationName *string + ApplicationVersion *string + AzureResourceURI *string + TotalCharges *float64 + TotalUsedBillableHours *float64 + TotalUsedFreeHours *float64 + UsageEntriesGroupedByUpdateType []*BillingHubUsageGroupedByUpdateType +} + +type BillingHubUsage struct { + ApplicationName *string + ApplicationVersion *string + AzureResourceURI *string + TotalCharges *float64 + TotalUsedBillableHours *float64 + TotalUsedFreeHours *float64 + UsageGroups []*BillingHubUsageGroup +} + +type BillingHubUsageGroup struct { + ExecutionUsageDetails []*BillingHubExecutionUsageDetail + OSBuild *string + ProductFamily *string + Release *string + ReleaseBuildDate *time.Time + ReleaseBuildNumber *int64 + ReleaseBuildRevision *int64 + TestType *string + TotalCharges *float64 + TotalUsedBillableHours *float64 + TotalUsedFreeHours *float64 +} + +type BillingHubUsageGroupedByUpdateType struct { + TotalCharges *float64 + TotalUsedBillableHours *float64 + TotalUsedFreeHours *float64 + UpdateType *string + UsageGroups []*BillingHubUsageGroup +} + // CPURegressionResultSingletonResourceProperties - The properties of CPU Regression Result. type CPURegressionResultSingletonResourceProperties struct { // REQUIRED; Type of the Analysis Result. @@ -341,8 +439,8 @@ type CPURegressionResultSingletonResourceProperties struct { // for type CPURegressionResultSingletonResourceProperties. func (c *CPURegressionResultSingletonResourceProperties) GetAnalysisResultSingletonResourceProperties() *AnalysisResultSingletonResourceProperties { return &AnalysisResultSingletonResourceProperties{ - Grade: c.Grade, AnalysisResultType: c.AnalysisResultType, + Grade: c.Grade, } } @@ -362,11 +460,72 @@ type CPUUtilizationResultSingletonResourceProperties struct { // for type CPUUtilizationResultSingletonResourceProperties. func (c *CPUUtilizationResultSingletonResourceProperties) GetAnalysisResultSingletonResourceProperties() *AnalysisResultSingletonResourceProperties { return &AnalysisResultSingletonResourceProperties{ - Grade: c.Grade, AnalysisResultType: c.AnalysisResultType, + Grade: c.Grade, } } +// ChatRequest - The chat request payload. +type ChatRequest struct { + // REQUIRED; The question of the chat turn + Question *string +} + +// ChatResponse - The chat response payload. +type ChatResponse struct { + // REQUIRED; The properties of chat response. + Properties *ChatResponseProperties +} + +// ChatResponseProperties - The chat response properties. +type ChatResponseProperties struct { + // REQUIRED; The answer from the system + Answer *string + + // REQUIRED; The question from the request + Question *string + + // READ-ONLY; The limit of questions within the chat session + Limit *int32 + + // READ-ONLY; The usage of questions within the chat session + Usage *int32 + Citations []*AnswerCitation +} + +// ChatSessionProperties - The chat session properties. +type ChatSessionProperties struct { + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// ChatSessionResource - The chat session resource. +type ChatSessionResource struct { + // The properties of chat session. + Properties *ChatSessionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ChatSessionResourceListResult - A list of chat session. +type ChatSessionResourceListResult struct { + // The list of chat session. + Value []*ChatSessionResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + // CheckNameAvailabilityResult - Description of a Check Name availability response properties. type CheckNameAvailabilityResult struct { // Value indicating the availability of the name: true if the name is available; otherwise, false. @@ -399,9 +558,21 @@ type Command struct { // Specifies whether to apply update before the command. ApplyUpdateBefore *bool + // Specifies whether to enroll Intune before the command. + EnrollIntuneBefore *bool + + // Specifies whether to install first party applications before running the command. + Install1PAppBefore *bool + // Specifies the max run time of the command. MaxRunTime *int32 + // Specifies whether the command is assigned to be executed after in-place upgrade. + PostUpgrade *bool + + // Specifies whether the command is assigned to be executed before in-place upgrade. + PreUpgrade *bool + // Specifies whether to restart the VM after the command executed. RestartAfter *bool @@ -412,6 +583,120 @@ type Command struct { RunElevated *bool } +// CopyFromPackageOperationParameters - Parameters body to pass to copy-from-package operation of Draft Package. +type CopyFromPackageOperationParameters struct { + // REQUIRED; The id of the package to copy from. + PackageID *string +} + +// CredentialListResult - A list of credential resources. +type CredentialListResult struct { + // The list of credential resources. + Value []*CredentialResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + +// CredentialProperties - The properties of test base credential +type CredentialProperties struct { + // REQUIRED; Credential type. + CredentialType *CredentialType + + // REQUIRED; Credential display name. + DisplayName *string +} + +// GetCredentialProperties implements the CredentialPropertiesClassification interface for type CredentialProperties. +func (c *CredentialProperties) GetCredentialProperties() *CredentialProperties { return c } + +// CredentialResource - The test base credential resource. +type CredentialResource struct { + // The test base credential properties. + Properties CredentialPropertiesClassification + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// CustomImageListResult - A list of Test Base custom images. +type CustomImageListResult struct { + // The list of Test Base custom images. + Value []*CustomImageResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + +// CustomImageProperties - The properties of the test base custom image. +type CustomImageProperties struct { + // REQUIRED; Image definition name. + DefinitionName *string + + // REQUIRED; Custom image source type. + Source *ImageSource + + // REQUIRED; Image version name. + VersionName *string + + // The Id of the associated VHD resource. + VhdID *string + + // READ-ONLY; The UTC timestamp when the custom image was published. + CreationTime *time.Time + + // READ-ONLY; This property indicates the size of the VHD to be created. + OSDiskImageSizeInGB *int64 + + // READ-ONLY; Product of the custom image. + Product *string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; Release of the custom image OS. + Release *string + + // READ-ONLY; The release version date of the release of the custom image OS. + ReleaseVersionDate *time.Time + + // READ-ONLY; Status of the custom image. + Status *ImageStatus + + // READ-ONLY; The validation result of the custom image. + ValidationResults *ImageValidationResults + + // READ-ONLY; The file name of the associated VHD resource. + VhdFileName *string +} + +// CustomImageResource - The test base custom image resource. +type CustomImageResource struct { + // Test Base custom image properties. + Properties *CustomImageProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + // CustomerEventListResult - A list of Test Base Customer Events. type CustomerEventListResult struct { // The list of Test Base Customer Events. @@ -435,42 +720,19 @@ type CustomerEventResource struct { // Customer Notification Event properties. Properties *CustomerEventProperties - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// CustomerEventsClientBeginCreateOptions contains the optional parameters for the CustomerEventsClient.BeginCreate method. -type CustomerEventsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CustomerEventsClientBeginDeleteOptions contains the optional parameters for the CustomerEventsClient.BeginDelete method. -type CustomerEventsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CustomerEventsClientGetOptions contains the optional parameters for the CustomerEventsClient.Get method. -type CustomerEventsClientGetOptions struct { - // placeholder for future optional parameters -} - -// CustomerEventsClientListByTestBaseAccountOptions contains the optional parameters for the CustomerEventsClient.NewListByTestBaseAccountPager -// method. -type CustomerEventsClientListByTestBaseAccountOptions struct { - // placeholder for future optional parameters -} - // DistributionGroupListReceiverValue - The user object receiver value. type DistributionGroupListReceiverValue struct { // The list of distribution groups. @@ -486,6 +748,270 @@ type DownloadURLResponse struct { ExpirationTime *time.Time } +// DraftPackageGetPathResponse - The response of getting a download URL. +type DraftPackageGetPathResponse struct { + // READ-ONLY; The base URL of the storage account. + BaseURL *string + + // READ-ONLY; The relative path of the folder hosting package files. + DraftPackagePath *string + + // READ-ONLY; Expiry date of the SAS token. + ExpirationTime *time.Time + + // READ-ONLY; A SAS token for the storage account to access workspace. + SasToken *string + + // READ-ONLY; The relative path for a temporary folder for package creation work. + WorkingPath *string +} + +// DraftPackageIntuneAppMetadata - The metadata of Intune app(s) used for generation. +type DraftPackageIntuneAppMetadata struct { + // The Metadata of the Intune App through intunewin file uploading. + IntuneApp *DraftPackageIntuneAppMetadataItem + + // The Metadata of dependencies of the Intune App through intunewin file uploading. + IntuneAppDependencies []*DraftPackageIntuneAppMetadataItem +} + +// DraftPackageIntuneAppMetadataItem - The Metadata of a single Intune App. +type DraftPackageIntuneAppMetadataItem struct { + // Intune app id. + AppID *string + + // Intune app name. + AppName *string + + // Creation date of the app. + CreateDate *time.Time + + // Ids of dependency apps. + DependencyIDs []*string + + // Count of dependency apps. + DependentAppCount *int32 + + // Description of the app. + Description *string + + // Expected exit codes returned from Intune App. + ExpectedExitCodes []*string + + // Install command. + InstallCommand *string + + // last processed time tickets. + LastProcessed *int64 + + // Minimum supported OS. The OS version must be greater than this version to run this app. + MinimumSupportedOS *string + + // Owner of the app. + Owner *string + + // Publisher of the app. + Publisher *string + + // Setup file path. + SetupFile *string + + // Extract status. + Status *IntuneExtractStatus + + // Uninstall command. + UninstallCommand *string + + // Intune app version. + Version *string +} + +// DraftPackageListResult - A list of Test Base Draft Packages. +type DraftPackageListResult struct { + // The list of Test Base Draft Packages. + Value []*DraftPackageResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + +// DraftPackageProperties - The properties of the Test Base Draft Package. +type DraftPackageProperties struct { + // The name of the app file. + AppFileName *string + + // Application name + ApplicationName *string + + // Comments added by user. + Comments *string + + // Specifies whether this draft package is used to edit a package. + EditPackage *bool + + // The executable launch command for script auto-fill. Will be used to run the application. + ExecutableLaunchCommand *string + + // The list of first party applications to test along with user application. + FirstPartyApps []*FirstPartyAppDefinition + + // The flighting ring for feature update. + FlightingRing *string + + // The list of gallery apps to test along with user application. + GalleryApps []*GalleryAppDefinition + + // The highlight files in the package. + HighlightedFiles []*HighlightedFile + + // Specifies the baseline os and target os for inplace upgrade. + InplaceUpgradeOSPair *InplaceUpgradeOSInfo + + // The metadata of Intune enrollment. + IntuneEnrollmentMetadata *IntuneEnrollmentMetadata + + // Metadata used to generate draft package folder and scripts. + IntuneMetadata *DraftPackageIntuneAppMetadata + + // Specifies the package id from which the draft package copied. + PackageID *string + + // Tags of the package to be created. + PackageTags map[string]*string + + // The process name for script auto-fill. Will be used to identify the application process. + ProcessName *string + + // The source type. + SourceType *DraftPackageSourceType + + // Tab state. + TabState *TabState + + // Specifies the target OSs of specific OS Update types. + TargetOSList []*TargetOSInfo + + // OOB, functional or flow driven. Mapped to the data in 'tests' property. + TestTypes []*TestType + + // The detailed test information. + Tests []*Test + + // Indicates whether user choose to enable script auto-fill. + UseAutofill *bool + + // Specifies whether a sample package should be used instead of the one uploaded by the user. + UseSample *bool + + // Application version + Version *string + + // READ-ONLY; The relative path of the folder hosting package files. + DraftPackagePath *string + + // READ-ONLY; The UTC timestamp when the package was last modified. + LastModifiedTime *time.Time + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState + + // READ-ONLY; The relative path for a temporarily folder for package creation work. + WorkingPath *string +} + +// DraftPackageResource - The Test Base Draft Package resource. +type DraftPackageResource struct { + // Test Base Draft Package properties. + Properties *DraftPackageProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// DraftPackageUpdateParameterProperties - The properties of draft package update parameters. +type DraftPackageUpdateParameterProperties struct { + // The name of the app file. + AppFileName *string + + // Application name + ApplicationName *string + + // Comments added by user. + Comments *string + + // The executable launch command for script auto-fill. Will be used to run the application. + ExecutableLaunchCommand *string + + // Specifies the list of first party applications to test along with user application. + FirstPartyApps []*FirstPartyAppDefinition + + // The flighting ring for feature update. + FlightingRing *string + + // The list of gallery apps to test along with user application. + GalleryApps []*GalleryAppDefinition + + // The highlight files in the package. + HighlightedFiles []*HighlightedFile + + // Specifies the baseline os and target os for in-place upgrade. + InplaceUpgradeOSPair *InplaceUpgradeOSInfo + + // The metadata of Intune enrollment. + IntuneEnrollmentMetadata *IntuneEnrollmentMetadata + + // Metadata used to generate draft package folder and scripts. + IntuneMetadata *DraftPackageIntuneAppMetadata + + // Specifies the package id from which the draft package copied. + PackageID *string + + // Tags of the package to be created. + PackageTags map[string]*string + + // The process name for script auto-fill. Will be used to identify the application process. + ProcessName *string + + // The source type. + SourceType *DraftPackageSourceType + + // Tab state. + TabState *TabState + + // Specifies the target OSs of specific OS Update types. + TargetOSList []*TargetOSInfo + + // OOB, functional or flow driven. Mapped to the data in 'tests' property. + TestTypes []*TestType + + // The detailed test information. + Tests []*Test + + // Indicates whether user choose to enable script auto-fill. + UseAutofill *bool + + // Specifies whether a sample package should be used instead of the one uploaded by the user. + UseSample *bool + + // Application version + Version *string +} + +// DraftPackageUpdateParameters - Parameters supplied to update a Test Base Draft Package. +type DraftPackageUpdateParameters struct { + // Test Base Draft Package update parameters. + Properties *DraftPackageUpdateParameterProperties +} + // EmailEventListResult - A list of email events. type EmailEventListResult struct { // The list of email events. @@ -512,175 +1038,582 @@ type EmailEventResource struct { // Email Event properties. Properties *EmailEventProperties - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// EmailEventsClientGetOptions contains the optional parameters for the EmailEventsClient.Get method. -type EmailEventsClientGetOptions struct { - // placeholder for future optional parameters +// EnrolledIntuneApp - Metadata of the enrolled Intune app. +type EnrolledIntuneApp struct { + // REQUIRED; Intune app id. + AppID *string + + // REQUIRED; Intune app name. + AppName *string + + // REQUIRED; Intune app expected installation path. + ExpectedInstallationPath *string } -// EmailEventsClientListOptions contains the optional parameters for the EmailEventsClient.NewListPager method. -type EmailEventsClientListOptions struct { - // placeholder for future optional parameters +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string } -// ErrorDefinition - Error definition. -type ErrorDefinition struct { +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + // READ-ONLY; The error code. Code *string // READ-ONLY; The error details. - Details []*ErrorDefinition + Details []*ErrorDetail // READ-ONLY; The error message. Message *string - // READ-ONLY; The target of the particular error. + // READ-ONLY; The error target. Target *string } -// ErrorResponse - The error response send when an operation fails. +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). type ErrorResponse struct { - // The error details. - Error *ErrorDefinition + // The error object. + Error *ErrorDetail +} + +// ExtractFileOperationParameters - Parameters body to pass to extract file operation of Draft Package. +type ExtractFileOperationParameters struct { + // REQUIRED; Relative path of the file to be extracted, the path must under working path of this draft package. + SourceFile *string + + // The type of file to extract. + FileType *ExtractFileType + + // Intune application id. + IntuneAppID *string +} + +// FavoriteProcessListResult - A list of favorite processes for a package. +type FavoriteProcessListResult struct { + // The list of favorite processes for a package. + Value []*FavoriteProcessResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + +// FavoriteProcessProperties - Properties of a favorite process identifier. +type FavoriteProcessProperties struct { + // REQUIRED; The actual name of the favorite process. It will be equal to resource name except for the scenario that the process + // name contains characters that are not allowed in the resource name. + ActualProcessName *string +} + +// FavoriteProcessResource - A favorite process identifier. +type FavoriteProcessResource struct { + // Properties of a favorite process identifier. + Properties *FavoriteProcessProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FeatureUpdateSupportedOsesProperties - Properties of feature update supported OSes proxy resource. +type FeatureUpdateSupportedOsesProperties struct { + // REQUIRED + BaselineProducts []*string + + // REQUIRED + DisplayText *string + + // REQUIRED + InsiderChannel *string + + // REQUIRED + OSID *string + + // REQUIRED + OSName *string + + // REQUIRED; Timestamp when the OS starts to be supported. + StartTime *time.Time + + // REQUIRED; State of the OS product. + State *OsProductState + + // REQUIRED + Version *string +} + +// FeatureUpdateSupportedOsesResource - Feature update supported OSes proxy resource. +type FeatureUpdateSupportedOsesResource struct { + // Available OS properties. + Properties *FeatureUpdateSupportedOsesProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FeatureUpdateSupportedOsesResult - Response schema of feature update supported OSes list API. +type FeatureUpdateSupportedOsesResult struct { + Value []*FeatureUpdateSupportedOsesResource + + // READ-ONLY + NextLink *string +} + +// FileUploadURLResponse - The URL response +type FileUploadURLResponse struct { + // READ-ONLY; The blob path of the uploaded package. It will be used as the 'blobPath' property of PackageResource. + BlobPath *string + + // READ-ONLY; The URL used for uploading the package. + UploadURL *string +} + +// FirstPartyAppDefinition - Properties of the definition of a first party application of the Test Base package. +type FirstPartyAppDefinition struct { + // The architecture of a first party application of a Test Base Account. + Architecture *Architecture + + // The channel info of a first party application of a Test Base Account. + Channel *string + + // Specifies how the first party applications should be inter-operated with user's application. + InteropExecutionMode *InteropExecutionMode + + // The media name of a first party application of a Test Base Account. + Name *string + + // The ring info of a first party application of a Test Base Account. + Ring *string +} + +// FirstPartyAppListResult - A list of currently available first party applications. +type FirstPartyAppListResult struct { + // The list of currently available first party applications. + Value []*FirstPartyAppResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + +// FirstPartyAppProperties - Properties of a first party application. +type FirstPartyAppProperties struct { + // The architecture of a first party application of a Test Base Account. + Architecture *Architecture + + // The channel info of a first party application of a Test Base Account. + Channel *string + + // The media type of a first party application of a Test Base Account. + MediaType *string + + // The ring info of a first party application of a Test Base Account. + Ring *string + + // The supported OS products of a first party application of a Test Base Account. + SupportedProducts []*string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// FirstPartyAppResource - The first party application resource. +type FirstPartyAppResource struct { + // Properties of a first party application. + Properties *FirstPartyAppProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FlightingRingListResult - A list of flighting rings. +type FlightingRingListResult struct { + // The list of flighting rings. + Value []*FlightingRingResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + +// FlightingRingProperties - The Flighting Ring properties. +type FlightingRingProperties struct { + // The actual name of a flighting ring of a Test Base Account. + ActualFlightingRingName *string +} + +// FlightingRingResource - The flighting ring resource. +type FlightingRingResource struct { + // Flighting Ring properties. + Properties *FlightingRingProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FreeHourBalanceResource - The Free Hour Balance Resource. +type FreeHourBalanceResource struct { + // Properties of a Free Hour Balance. + Properties *BillingHubGetFreeHourBalanceResponse + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FreeHourBalancesListResult - A list of Test Base Free Hour Balances. It will only contain one element as all the data will +// be nested in a singleton object. +type FreeHourBalancesListResult struct { + // The list of FreeHourBalances. + Value []*FreeHourBalanceResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + +// GalleryAppDefinition - Properties of the definition of a gallery application used in Test Base package. +type GalleryAppDefinition struct { + // REQUIRED; The SKU id of the gallery application. + SKUID *string + + // Whether the disclaimer of the gallery application is accepted. + IsConsented *bool +} + +// GalleryAppListResult - A list of currently available gallery applications. +type GalleryAppListResult struct { + // The list of currently available gallery applications. + Value []*GalleryAppResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + +// GalleryAppProperties - Properties of a gallery application. +type GalleryAppProperties struct { + // REQUIRED; The id of a gallery application. + ApplicationID *string + + // REQUIRED; The name of a gallery application. + ApplicationName *string + + // REQUIRED; The application type of a gallery application. + ApplicationType *ApplicationType + + // REQUIRED; The number of users using a gallery application. + Popularity *int64 + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// GalleryAppResource - The gallery application resource. +type GalleryAppResource struct { + // Properties of a gallery application. + Properties *GalleryAppProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GalleryAppSKUListResult - A list of currently available SKUs of a gallery application. +type GalleryAppSKUListResult struct { + // The list of currently available SKUs of a gallery applications. + Value []*GalleryAppSKUResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + +// GalleryAppSKUProperties - Properties of a gallery application SKU. +type GalleryAppSKUProperties struct { + // REQUIRED; The application type of a gallery application. + ApplicationType *ApplicationType + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// GetGalleryAppSKUProperties implements the GalleryAppSKUPropertiesClassification interface for type GalleryAppSKUProperties. +func (g *GalleryAppSKUProperties) GetGalleryAppSKUProperties() *GalleryAppSKUProperties { return g } + +// GalleryAppSKUResource - The gallery application resource. +type GalleryAppSKUResource struct { + // Properties of a gallery application SKU. + Properties GalleryAppSKUPropertiesClassification + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GenerateOperationParameters - Parameters body to pass to generate operation of Draft Package. +type GenerateOperationParameters struct { + // Force to generate package files even if no metadata changed. + ForceGenerate *bool +} + +// GetFileUploadURLParameters - The parameters supplied to the Test Base Account GetFileUploadURL action. +type GetFileUploadURLParameters struct { + // The custom file name of the uploaded blob. + BlobName *string + + // Resource type for file uploading. + ResourceType *FileUploadResourceType +} + +// GetImageDefinitionParameters - Parameters supplied to get the test base custom image Definition operation. +type GetImageDefinitionParameters struct { + // Image definition name. + DefinitionName *string +} + +// HighlightedFile - The information of a highlighted file that user should pay attention to. +type HighlightedFile struct { + // REQUIRED; The path of the highlighted file. + Path *string + + // The name of sections to highlight. + Sections []*string + + // A flag to save whether this file is viewed by user. + Visited *bool +} + +// IdentifiedFailure - The failure identified. +type IdentifiedFailure struct { + // The category of the failure. + Category *Category + + // Message that shows information about the failure. + ErrorMessage *string + + // The Failure Id. + FailureID *string + + // Guidance that shows what the customer needs to do for this failure. + Guidance *string } -// FavoriteProcessListResult - A list of favorite processes for a package. -type FavoriteProcessListResult struct { - // The list of favorite processes for a package. - Value []*FavoriteProcessResource +// ImageDefinitionListResult - A list of test base image definitions. +type ImageDefinitionListResult struct { + // The list of test base image definitions. + Value []*ImageDefinitionResource // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. NextLink *string } -// FavoriteProcessProperties - Properties of a favorite process identifier. -type FavoriteProcessProperties struct { - // REQUIRED; The actual name of the favorite process. It will be equal to resource name except for the scenario that the process - // name contains characters that are not allowed in the resource name. - ActualProcessName *string +// ImageDefinitionProperties - The image properties under the image definition name. +type ImageDefinitionProperties struct { + // REQUIRED; Custom image architecture. + Architecture *ImageArchitecture + + // REQUIRED; Custom image OS state. + OSState *ImageOSState + + // REQUIRED; Custom image security type. + SecurityType *ImageSecurityType + + // READ-ONLY + ProvisioningState *string } -// FavoriteProcessResource - A favorite process identifier. -type FavoriteProcessResource struct { - // Properties of a favorite process identifier. - Properties *FavoriteProcessProperties +// ImageDefinitionResource - The test base image definition resource. +type ImageDefinitionResource struct { + // Test Base custom image properties. + Properties *ImageDefinitionProperties - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// FavoriteProcessesClientCreateOptions contains the optional parameters for the FavoriteProcessesClient.Create method. -type FavoriteProcessesClientCreateOptions struct { - // placeholder for future optional parameters -} +// ImageDefinitionsListResult - The result of all available image definition under a test base account. +type ImageDefinitionsListResult struct { + // The list of image definitions. + Value []*ImageDefinitionResource -// FavoriteProcessesClientDeleteOptions contains the optional parameters for the FavoriteProcessesClient.Delete method. -type FavoriteProcessesClientDeleteOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string } -// FavoriteProcessesClientGetOptions contains the optional parameters for the FavoriteProcessesClient.Get method. -type FavoriteProcessesClientGetOptions struct { - // placeholder for future optional parameters +// ImageNameCheckAvailabilityParameters - Parameter body to request test base custom image availability. +type ImageNameCheckAvailabilityParameters struct { + // REQUIRED; Image definition name. + DefinitionName *string + + // REQUIRED; Image version name. + VersionName *string } -// FavoriteProcessesClientListOptions contains the optional parameters for the FavoriteProcessesClient.NewListPager method. -type FavoriteProcessesClientListOptions struct { - // placeholder for future optional parameters +// ImageValidationResults - The image validation result. +type ImageValidationResults struct { + // The validation results of the image. + Results []*VerificationResult } -// FileUploadURLResponse - The URL response -type FileUploadURLResponse struct { - // READ-ONLY; The blob path of the uploaded package. It will be used as the 'blobPath' property of PackageResource. - BlobPath *string +// InplaceUpgradeOSInfo - Specifies the baseline os and target os for in-place upgrade tests. +type InplaceUpgradeOSInfo struct { + // Specifies the baseline os for in-place upgrade tests. + BaselineOS *OsProperties - // READ-ONLY; The URL used for uploading the package. - UploadURL *string + // Specifies the target os for in-place upgrade tests. + TargetOS *string } -// FlightingRingListResult - A list of flighting rings. -type FlightingRingListResult struct { - // The list of flighting rings. - Value []*FlightingRingResource +// InplaceUpgradeProperties - Properties for in-place upgrade test result. +type InplaceUpgradeProperties struct { + // The build number of the baseline OS release. + BaselineBuildNumber *string - // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. - NextLink *string -} + // The build revision of the baseline OS release. + BaselineBuildRevision *string -// FlightingRingProperties - The Flighting Ring properties. -type FlightingRingProperties struct { - // The actual name of a flighting ring of a Test Base Account. - ActualFlightingRingName *string -} + // The kb number of the baseline OS release. + BaselineKbNumber *string -// FlightingRingResource - The flighting ring resource. -type FlightingRingResource struct { - // Flighting Ring properties. - Properties *FlightingRingProperties + // The name of the OS. + BaselineOsName *string - // READ-ONLY; Resource ID. - ID *string + // The name of the baseline OS release. + BaselineReleaseName *string - // READ-ONLY; Resource name. - Name *string + // The release version date of the baseline OS release. + BaselineReleaseVersionDate *time.Time - // READ-ONLY; The system metadata relating to this resource - SystemData *SystemData + // The name of the custom image resource. + CustomImageDisplayName *string - // READ-ONLY; Resource type. - Type *string -} + // Specify the referenced Test Base Custom Image Id if applicable. + CustomImageID *string -// FlightingRingsClientGetOptions contains the optional parameters for the FlightingRingsClient.Get method. -type FlightingRingsClientGetOptions struct { - // placeholder for future optional parameters -} + // Time stamp for os upgrading end (UTC). + UpgradeEndTime *time.Time -// FlightingRingsClientListOptions contains the optional parameters for the FlightingRingsClient.NewListPager method. -type FlightingRingsClientListOptions struct { - // placeholder for future optional parameters + // Time stamp for os upgrading start (UTC). + UpgradeStartTime *time.Time } -// GetFileUploadURLParameters - The parameters supplied to the Test Base Account GetFileUploadURL action. -type GetFileUploadURLParameters struct { - // The custom file name of the uploaded blob. - BlobName *string +// IntuneEnrollmentMetadata - The metadata of Intune enrollment. +type IntuneEnrollmentMetadata struct { + // The enrolled Intune apps. + AppList []*EnrolledIntuneApp + + // The id of the Intune enrollment credential. + CredentialID *string + + // The expected duration of Intune applications and policies deployment. + ExpectedDeploymentDurationInMinute *int32 } -// IdentifiedFailure - The failure identified. -type IdentifiedFailure struct { - // The category of the failure. - Category *Category +// IntuneSingletonResourceProperties - The properties of intune credential. +type IntuneSingletonResourceProperties struct { + // REQUIRED; Credential type. + CredentialType *CredentialType - // Message that shows information about the failure. - ErrorMessage *string + // REQUIRED; Credential display name. + DisplayName *string - // The Failure Id. - FailureID *string + // The key vault secret path of password. + PasswordKeyVaultSecretPath *string - // Guidance that shows what the customer needs to do for this failure. - Guidance *string + // The key vault secret path of user name. + UserNameKeyVaultSecretPath *string +} + +// GetCredentialProperties implements the CredentialPropertiesClassification interface for type IntuneSingletonResourceProperties. +func (i *IntuneSingletonResourceProperties) GetCredentialProperties() *CredentialProperties { + return &CredentialProperties{ + CredentialType: i.CredentialType, + DisplayName: i.DisplayName, + } } // MemoryRegressionResultSingletonResourceProperties - The properties of Memory Regression Result. @@ -699,8 +1632,8 @@ type MemoryRegressionResultSingletonResourceProperties struct { // for type MemoryRegressionResultSingletonResourceProperties. func (m *MemoryRegressionResultSingletonResourceProperties) GetAnalysisResultSingletonResourceProperties() *AnalysisResultSingletonResourceProperties { return &AnalysisResultSingletonResourceProperties{ - Grade: m.Grade, AnalysisResultType: m.AnalysisResultType, + Grade: m.Grade, } } @@ -720,8 +1653,8 @@ type MemoryUtilizationResultSingletonResourceProperties struct { // for type MemoryUtilizationResultSingletonResourceProperties. func (m *MemoryUtilizationResultSingletonResourceProperties) GetAnalysisResultSingletonResourceProperties() *AnalysisResultSingletonResourceProperties { return &AnalysisResultSingletonResourceProperties{ - Grade: m.Grade, AnalysisResultType: m.AnalysisResultType, + Grade: m.Grade, } } @@ -763,9 +1696,18 @@ type OSUpdateProperties struct { // The build version of the tested release (OS update). BuildVersion *string + // The name of the custom image resource. + CustomImageDisplayName *string + + // Specify the referenced Test Base Custom Image Id if available. + CustomImageID *string + // The flighting ring, only for release of feature updates. FlightingRing *string + // The properties of baseline os for in-place upgrade test. + InplaceUpgradeBaselineProperties *OsProperties + // The name of the OS. OSName *string @@ -784,16 +1726,16 @@ type OSUpdateResource struct { // Properties of an OS Update. Properties *OSUpdateProperties - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -805,6 +1747,12 @@ type OSUpdateTestSummary struct { // The build version of the tested release (OS update) BuildVersion *string + // The name of the custom image resource. + CustomImageDisplayName *string + + // Specify the referenced Test Base Custom Image Id if available. + CustomImageID *string + // The execution status of the test. ExecutionStatus *ExecutionStatus @@ -814,6 +1762,9 @@ type OSUpdateTestSummary struct { // The grade of the test. Grade *Grade + // The properties of baseline os for in-place upgrade test. + InplaceUpgradeBaselineProperties *OsProperties + // The operating system name. e.g. Windows 10 1809. OSName *string @@ -833,16 +1784,6 @@ type OSUpdateTestSummary struct { TestType *string } -// OSUpdatesClientGetOptions contains the optional parameters for the OSUpdatesClient.Get method. -type OSUpdatesClientGetOptions struct { - // placeholder for future optional parameters -} - -// OSUpdatesClientListOptions contains the optional parameters for the OSUpdatesClient.NewListPager method. -type OSUpdatesClientListOptions struct { - // placeholder for future optional parameters -} - // OSUpdatesTestSummary - The summary of some tests. type OSUpdatesTestSummary struct { // The status of the last test. @@ -861,51 +1802,68 @@ type OSUpdatesTestSummary struct { TestStatus *TestStatus } -// Operation - REST API operation +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // The object that describes the operation. + // Localized display information for this particular operation. Display *OperationDisplay - // Extra properties of the operation. - Properties any + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType - // READ-ONLY; Indicates whether the operation is a data action + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. IsDataAction *bool - // READ-ONLY; Operation name: {provider}/{resource}/{operation}. + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" Name *string - // READ-ONLY; Origin of the operation - Origin *string + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin } -// OperationDisplay - The object that describes the operation. +// OperationDisplay - Localized display information for this particular operation. type OperationDisplay struct { - // READ-ONLY; Friendly name of the operation. + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // READ-ONLY; Operation type: read, write, delete, listPackages, etc. + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". Operation *string - // READ-ONLY; The resource provider name: Microsoft.TestBase. + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". Provider *string - // READ-ONLY; Resource type on which the operation is performed. + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". Resource *string } -// OperationListResult - A list of operations supported by the resource provider. +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. type OperationListResult struct { - // List of operations supported by the Test Base resource provider. - Value []*Operation - - // READ-ONLY; URL to get the next set of operation list results if there are any. + // READ-ONLY; URL to get the next set of operation list results (if there are any). NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters +// OsProperties - The properties of an operating system. +type OsProperties struct { + // Specify the referenced Test Base Custom Image Id if available. + CustomImageID *string + + // The name of the OS. + OSName *string + + // The properties of the OS release. + ReleaseProperties *ReleaseProperties + + // READ-ONLY; The name of the custom image resource. + CustomImageDisplayName *string } // PackageCheckNameAvailabilityParameters - Parameters body to pass for Test Base Package name availability check. @@ -916,11 +1874,11 @@ type PackageCheckNameAvailabilityParameters struct { // REQUIRED; Resource name to verify. Name *string - // REQUIRED; fully qualified resource type which includes provider namespace. - Type *string - // REQUIRED; Version name to verify. Version *string + + // fully qualified resource type which includes provider namespace. + Type *string } // PackageListResult - A list of Test Base Packages. @@ -937,20 +1895,35 @@ type PackageProperties struct { // REQUIRED; Application name ApplicationName *string - // REQUIRED; The file path of the package. + // REQUIRED; Application version + Version *string + + // The file path of the package. BlobPath *string - // REQUIRED; The flighting ring for feature update. + // The id of draft package. Used to create or update this package from a draft package. + DraftPackageID *string + + // The list of first party applications to test along with user application. + FirstPartyApps []*FirstPartyAppDefinition + + // The flighting ring for feature update. FlightingRing *string - // REQUIRED; Specifies the target OSs of specific OS Update types. + // Specifies the baseline os and target os for inplace upgrade. + InplaceUpgradeOSPair *InplaceUpgradeOSInfo + + // The metadata of Intune enrollment. + IntuneEnrollmentMetadata *IntuneEnrollmentMetadata + + // Specifies the target OSs of specific OS Update types. TargetOSList []*TargetOSInfo - // REQUIRED; The detailed test information. + // The detailed test information. Tests []*Test - // REQUIRED; Application version - Version *string + // READ-ONLY; The list of gallery apps to test along with user application. + GalleryApps []*GalleryAppDefinition // READ-ONLY; Flag showing that whether the package is enabled. It doesn't schedule test for package which is not enabled. IsEnabled *bool @@ -964,7 +1937,7 @@ type PackageProperties struct { // READ-ONLY; The provisioning state of the resource. ProvisioningState *ProvisioningState - // READ-ONLY; OOB, functional or both. Mapped to the data in 'tests' property. + // READ-ONLY; OOB, functional or flow driven. Mapped to the data in 'tests' property. TestTypes []*TestType // READ-ONLY; The validation results. There's validation on package when it's created or updated. @@ -979,33 +1952,63 @@ type PackageResource struct { // Test Base Package properties. Properties *PackageProperties - // The tags of the resource. + // Resource tags. Tags map[string]*string - // READ-ONLY; Resource Etag. - Etag *string - - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } +// PackageRunTestParameters - The parameters supplied to the Test Base Package to start a Test Run. +type PackageRunTestParameters struct { + // The tested custom image id. 'osName', 'release', 'buildVersion' and 'mediaPackageVersion' would be ignored when it's eligible.' + CustomImageID *string + + // The flighting ring, only for release of feature updates. + FlightingRing *string + + // The operating system name. e.g. Windows 10 1809. + OSName *string + + // Specifies the OS update type to test against. + OSUpdateType *OsUpdateType + + // The name of the tested release (OS update). + ReleaseName *string + + // The type of the test. + TestType *TestType +} + // PackageUpdateParameterProperties - Parameters supplied to update a Test Base Package. type PackageUpdateParameterProperties struct { // The file name of the package. BlobPath *string + // The id of draft package. Used to create or update this package from a draft package. + DraftPackageID *string + + // Specifies the list of first party applications to test along with user application. + FirstPartyApps []*FirstPartyAppDefinition + // The flighting ring for feature update. FlightingRing *string + // Specifies the baseline os and target os for in-place upgrade. + InplaceUpgradeOSPair *InplaceUpgradeOSInfo + + // The metadata of Intune enrollment. + IntuneEnrollmentMetadata *IntuneEnrollmentMetadata + // Specifies whether the package is enabled. It doesn't schedule test for package which is not enabled. IsEnabled *bool @@ -1037,56 +2040,31 @@ type PackageValidationResult struct { ValidationName *string } -// PackagesClientBeginCreateOptions contains the optional parameters for the PackagesClient.BeginCreate method. -type PackagesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +type PreReleaseAccessRequestSpec struct { + City *string + CompanyWebsite *string + CountryAndRegion *string + Email *string + Engagements []*Engagements + OrganizationName *string + StateOrProvince *string + StreetAddress *string + ZipCode *string } -// PackagesClientBeginDeleteOptions contains the optional parameters for the PackagesClient.BeginDelete method. -type PackagesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PackagesClientBeginHardDeleteOptions contains the optional parameters for the PackagesClient.BeginHardDelete method. -type PackagesClientBeginHardDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PackagesClientBeginUpdateOptions contains the optional parameters for the PackagesClient.BeginUpdate method. -type PackagesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PackagesClientGetDownloadURLOptions contains the optional parameters for the PackagesClient.GetDownloadURL method. -type PackagesClientGetDownloadURLOptions struct { - // placeholder for future optional parameters -} - -// PackagesClientGetOptions contains the optional parameters for the PackagesClient.Get method. -type PackagesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PackagesClientListByTestBaseAccountOptions contains the optional parameters for the PackagesClient.NewListByTestBaseAccountPager -// method. -type PackagesClientListByTestBaseAccountOptions struct { - // placeholder for future optional parameters -} - -// ProxyResource - The resource model definition for an ARM proxy resource. It will have everything other than required location -// and tags +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location type ProxyResource struct { - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -1117,6 +2095,21 @@ type RegressionTestDetails struct { IsRegressed *bool } +// ReleaseProperties - The properties of an operating system release. +type ReleaseProperties struct { + // The build number of the OS release. + BuildNumber *string + + // The build revision of the OS release. + BuildRevision *string + + // The name of the OS release. + ReleaseName *string + + // The release version date of the OS release. + ReleaseVersionDate *time.Time +} + // ReliabilityResult - The Reliability Result. type ReliabilityResult struct { // Count of number of crashes. @@ -1155,6 +2148,9 @@ type ReliabilityResultSingletonResourceProperties struct { // The grade of the test. Grade *Grade + // The result array data for target os in an in-place upgrade test. + InplaceUpgradeBaselineReliabilityResults []*ReliabilityResult + // The result array data. ReliabilityResults []*ReliabilityResult } @@ -1163,26 +2159,24 @@ type ReliabilityResultSingletonResourceProperties struct { // for type ReliabilityResultSingletonResourceProperties. func (r *ReliabilityResultSingletonResourceProperties) GetAnalysisResultSingletonResourceProperties() *AnalysisResultSingletonResourceProperties { return &AnalysisResultSingletonResourceProperties{ - Grade: r.Grade, AnalysisResultType: r.AnalysisResultType, + Grade: r.Grade, } } -// Resource - The Resource definition. +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type. - Type *string -} + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData -// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. -type SKUsClientListOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // ScriptExecutionResult - The Script Execution Result. @@ -1199,6 +2193,12 @@ type ScriptExecutionResult struct { // Start time of script execution. StartTime *time.Time + // The stderr log file name. + StderrLogFileName *string + + // The stdout log file name. + StdoutLogFileName *string + // Whether the script execution is timed out. TimedOut *bool } @@ -1219,8 +2219,8 @@ type ScriptExecutionResultSingletonResourceProperties struct { // for type ScriptExecutionResultSingletonResourceProperties. func (s *ScriptExecutionResultSingletonResourceProperties) GetAnalysisResultSingletonResourceProperties() *AnalysisResultSingletonResourceProperties { return &AnalysisResultSingletonResourceProperties{ - Grade: s.Grade, AnalysisResultType: s.AnalysisResultType, + Grade: s.Grade, } } @@ -1236,6 +2236,19 @@ type SubscriptionReceiverValue struct { SubscriptionName *string } +// SystemAssignedServiceIdentity - Managed service identity (either system assigned, or none) +type SystemAssignedServiceIdentity struct { + // REQUIRED; Type of managed service identity (either system assigned, or none). + Type *SystemAssignedServiceIdentityType + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -1247,7 +2260,7 @@ type SystemData struct { // The type of identity that created the resource. CreatedByType *CreatedByType - // The type of identity that last modified the resource. + // The timestamp of resource last modification (UTC) LastModifiedAt *time.Time // The identity that last modified the resource. @@ -1257,12 +2270,30 @@ type SystemData struct { LastModifiedByType *CreatedByType } +// TabState - Specifies current state of tabs. +type TabState struct { + // Current tab. + CurrentTab *PackageStudioTabs + + // visited tabs. + VisitedTabs []*PackageStudioTabs +} + // TargetOSInfo - The information of the target OS to be tested. type TargetOSInfo struct { // REQUIRED; Specifies the OS update type to test against, e.g., 'Security updates' or 'Feature updates'. OSUpdateType *string - // REQUIRED; Specifies the target OSs to be tested. + // Specifies the baseline OSs to be tested. + BaselineOSs []*string + + // Insider Channel Ids. Only used for feature update. + InsiderChannelIDs []*string + + // Specifies the ids of the target OSs from Custom Images to be tested. + TargetOSImageIDs []*string + + // Specifies the target OSs to be tested. TargetOSs []*string } @@ -1277,6 +2308,9 @@ type Test struct { // Indicates if this test is active.It doesn't schedule test for not active Test. IsActive *bool + // READ-ONLY; Resource identifier of the validation test result. + ValidationResultID *string + // READ-ONLY; The status of the validation run of the package. ValidationRunStatus *ValidationRunStatus } @@ -1309,8 +2343,8 @@ type TestAnalysisResultSingletonResourceProperties struct { // for type TestAnalysisResultSingletonResourceProperties. func (t *TestAnalysisResultSingletonResourceProperties) GetAnalysisResultSingletonResourceProperties() *AnalysisResultSingletonResourceProperties { return &AnalysisResultSingletonResourceProperties{ - Grade: t.Grade, AnalysisResultType: t.AnalysisResultType, + Grade: t.Grade, } } @@ -1326,6 +2360,31 @@ type TestResultAnalysisSummary struct { Name *string } +// TestResultConsoleLogDownloadURLParameters - Parameters body to pass for getting the download URL of the test execution +// console log file. +type TestResultConsoleLogDownloadURLParameters struct { + // REQUIRED; The log file name corresponding to the download URL. + LogFileName *string +} + +// TestResultFirstPartyAppDefinition - Properties of the definition of first party application in test result. +type TestResultFirstPartyAppDefinition struct { + // The architecture of a first party application of a Test Base Account. + Architecture *Architecture + + // The channel info of a first party application of a Test Base Account. + Channel *string + + // The media name of a first party application of a Test Base Account. + Name *string + + // The ring info of a first party application of a Test Base Account. + Ring *string + + // The media version of a first party application of a Test Base Account. + Version *string +} + // TestResultListResult - A list of Test Results. type TestResultListResult struct { // The list of Test Results. @@ -1355,15 +2414,33 @@ type TestResultProperties struct { // The build version of the tested release (OS update). BuildVersion *string + // The name of the custom image resource. + CustomImageDisplayName *string + + // Specify the referenced Test Base Custom Image Id if applicable. + CustomImageID *string + // The execution status of the test. ExecutionStatus *ExecutionStatus + // The list of first party applications tested along with the package. + FirstPartyApps []*TestResultFirstPartyAppDefinition + // The flighting ring, only for release of feature updates. FlightingRing *string // The grade of the test. Grade *Grade + // Properties for inplace upgrade test. + InplaceUpgradeProperties *InplaceUpgradeProperties + + // Interop media type. + InteropMediaType *string + + // Interop media version. + InteropMediaVersion *string + // Whether download data is available. IsDownloadDataAvailable *bool @@ -1388,9 +2465,15 @@ type TestResultProperties struct { // The release version date of the tested release. ReleaseVersionDate *time.Time + // The time when test ends. + TestEndTime *time.Time + // The run time of the test. TestRunTime *string + // The time when test starts. + TestStartTime *time.Time + // The status of the test. TestStatus *TestStatus @@ -1403,51 +2486,19 @@ type TestResultResource struct { // The properties of a Test Result. Properties *TestResultProperties - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// TestResultsClientGetDownloadURLOptions contains the optional parameters for the TestResultsClient.GetDownloadURL method. -type TestResultsClientGetDownloadURLOptions struct { - // placeholder for future optional parameters -} - -// TestResultsClientGetOptions contains the optional parameters for the TestResultsClient.Get method. -type TestResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// TestResultsClientGetVideoDownloadURLOptions contains the optional parameters for the TestResultsClient.GetVideoDownloadURL -// method. -type TestResultsClientGetVideoDownloadURLOptions struct { - // placeholder for future optional parameters -} - -// TestResultsClientListOptions contains the optional parameters for the TestResultsClient.NewListPager method. -type TestResultsClientListOptions struct { - // Odata filter - Filter *string -} - -// TestSummariesClientGetOptions contains the optional parameters for the TestSummariesClient.Get method. -type TestSummariesClientGetOptions struct { - // placeholder for future optional parameters -} - -// TestSummariesClientListOptions contains the optional parameters for the TestSummariesClient.NewListPager method. -type TestSummariesClientListOptions struct { - // placeholder for future optional parameters -} - // TestSummaryListResult - A list of Test Summaries. type TestSummaryListResult struct { // The list of Test Summaries. @@ -1474,9 +2525,15 @@ type TestSummaryProperties struct { // The grade of the test. Grade *Grade + // The result summary of tests triggered by in-place upgrades + InplaceUpgradesTestSummary *OSUpdatesTestSummary + // The Azure resource Id of package. PackageID *string + // The tags of Package resource that are associated with the testSummary + PackageTags map[string]*string + // The result summary of tests triggered by security updates SecurityUpdatesTestSummary *OSUpdatesTestSummary @@ -1495,16 +2552,16 @@ type TestSummaryResource struct { // Properties of a Test Summary. Properties *TestSummaryProperties - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -1528,54 +2585,39 @@ type TestTypeResource struct { // Test Type properties. Properties *TestTypeProperties - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The system metadata relating to this resource + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// TestTypesClientGetOptions contains the optional parameters for the TestTypesClient.Get method. -type TestTypesClientGetOptions struct { - // placeholder for future optional parameters -} - -// TestTypesClientListOptions contains the optional parameters for the TestTypesClient.NewListPager method. -type TestTypesClientListOptions struct { - // placeholder for future optional parameters -} - -// TrackedResource - The resource model definition for an ARM tracked top level resource +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' type TrackedResource struct { // REQUIRED; The geo-location where the resource lives Location *string - // The tags of the resource. + // Resource tags. Tags map[string]*string - // READ-ONLY; Resource Etag. - Etag *string - - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type. - Type *string -} + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData -// UsageClientListOptions contains the optional parameters for the UsageClient.NewListPager method. -type UsageClientListOptions struct { - // Odata filter - Filter *string + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // UserObjectReceiverValue - The user object receiver value. @@ -1616,3 +2658,89 @@ type UtilizationResult struct { // Utilization data Utilization []*UtilizationEntry } + +// VHDListResult - A list of VHD resource. +type VHDListResult struct { + // The list of Test Base VHDs. + Value []*VHDResource + + // READ-ONLY; Link to the next set of results. Not empty if value contains incomplete list of results. + NextLink *string +} + +// VHDProperties - The Test Base VHD properties +type VHDProperties struct { + // READ-ONLY; The UTC timestamp when the VHD was created. + CreationTime *time.Time + + // READ-ONLY; The VHD file name. + FileName *string + + // READ-ONLY; The file size in bytes of the VHD file. + FileSize *int64 + + // READ-ONLY; The relative path of the VHD file. + Path *string + + // READ-ONLY + ProvisioningState *string + + // READ-ONLY; The status of the VHD. + Status *VHDStatus +} + +// VHDResource - The Test Base VHD resource. +type VHDResource struct { + // The Test Base VHD validation result properties. + Properties *VHDProperties + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// VerificationResult - The detailed result of a validation or rule checking. +type VerificationResult struct { + // REQUIRED; Indicates if the validation or rule checking is passed. + Result *VerificationStatus + + // Message for clarification. + Message *string + + // The name of the verification rule. + VerificationName *string +} + +// WingetAppSKUProperties - The detailed properties of a winget gallery application SKU. +type WingetAppSKUProperties struct { + // REQUIRED; The application type of a gallery application. + ApplicationType *ApplicationType + + // The license description of a winget gallery application SKU. + License *string + + // The license URL of a winget gallery application SKU. + LicenseURL *string + + // The version of a winget gallery application SKU. + Version *string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// GetGalleryAppSKUProperties implements the GalleryAppSKUPropertiesClassification interface for type WingetAppSKUProperties. +func (w *WingetAppSKUProperties) GetGalleryAppSKUProperties() *GalleryAppSKUProperties { + return &GalleryAppSKUProperties{ + ApplicationType: w.ApplicationType, + ProvisioningState: w.ProvisioningState, + } +} diff --git a/sdk/resourcemanager/testbase/armtestbase/models_serde.go b/sdk/resourcemanager/testbase/armtestbase/models_serde.go index e3579c946214..e9dc76166faf 100644 --- a/sdk/resourcemanager/testbase/armtestbase/models_serde.go +++ b/sdk/resourcemanager/testbase/armtestbase/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -50,8 +49,8 @@ func (a *AccountListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AccountResource. func (a AccountResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "etag", a.Etag) populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -70,12 +69,12 @@ func (a *AccountResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) @@ -272,6 +271,7 @@ func (a *AccountUpdateParameterProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AccountUpdateParameters. func (a AccountUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", a.Identity) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) @@ -286,6 +286,9 @@ func (a *AccountUpdateParameters) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) @@ -405,6 +408,123 @@ func (a *AccountUsageName) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ActionRequest. +func (a ActionRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionRequest. +func (a *ActionRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionRequestProperties. +func (a ActionRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "creationDate", a.CreationDate) + populate(objectMap, "preReleaseAccessRequestSpec", a.PreReleaseAccessRequestSpec) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "requestType", a.RequestType) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionRequestProperties. +func (a *ActionRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "creationDate": + err = unpopulateTimeRFC3339(val, "CreationDate", &a.CreationDate) + delete(rawMsg, key) + case "preReleaseAccessRequestSpec": + err = unpopulate(val, "PreReleaseAccessRequestSpec", &a.PreReleaseAccessRequestSpec) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "requestType": + err = unpopulate(val, "RequestType", &a.RequestType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ActionRequests. +func (a ActionRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActionRequests. +func (a *ActionRequests) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AnalysisResultListResult. func (a AnalysisResultListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -510,6 +630,154 @@ func (a *AnalysisResultSingletonResourceProperties) UnmarshalJSON(data []byte) e return nil } +// MarshalJSON implements the json.Marshaller interface for type AnswerCitation. +func (a AnswerCitation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "chunkIndex", a.ChunkIndex) + populate(objectMap, "title", a.Title) + populate(objectMap, "url", a.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnswerCitation. +func (a *AnswerCitation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "chunkIndex": + err = unpopulate(val, "ChunkIndex", &a.ChunkIndex) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &a.Title) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &a.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableInplaceUpgradeOSListResult. +func (a AvailableInplaceUpgradeOSListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableInplaceUpgradeOSListResult. +func (a *AvailableInplaceUpgradeOSListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableInplaceUpgradeOSProperties. +func (a AvailableInplaceUpgradeOSProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "sourceOsName", a.SourceOsName) + populate(objectMap, "sourceOsReleases", a.SourceOsReleases) + populate(objectMap, "supportedTargetOsNameList", a.SupportedTargetOsNameList) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableInplaceUpgradeOSProperties. +func (a *AvailableInplaceUpgradeOSProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "sourceOsName": + err = unpopulate(val, "SourceOsName", &a.SourceOsName) + delete(rawMsg, key) + case "sourceOsReleases": + err = unpopulate(val, "SourceOsReleases", &a.SourceOsReleases) + delete(rawMsg, key) + case "supportedTargetOsNameList": + err = unpopulate(val, "SupportedTargetOsNameList", &a.SupportedTargetOsNameList) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AvailableInplaceUpgradeOSResource. +func (a AvailableInplaceUpgradeOSResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableInplaceUpgradeOSResource. +func (a *AvailableInplaceUpgradeOSResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AvailableOSListResult. func (a AvailableOSListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -631,784 +899,3422 @@ func (a *AvailableOSResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CPURegressionResultSingletonResourceProperties. -func (c CPURegressionResultSingletonResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BillingHubExecutionUsageDetail. +func (b BillingHubExecutionUsageDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["analysisResultType"] = AnalysisResultTypeCPURegression - populate(objectMap, "cpuRegressionResults", c.CPURegressionResults) - populate(objectMap, "grade", c.Grade) + populate(objectMap, "applicationName", b.ApplicationName) + populate(objectMap, "applicationVersion", b.ApplicationVersion) + populate(objectMap, "billedCharges", b.BilledCharges) + populateTimeRFC3339(objectMap, "endTimeStamp", b.EndTimeStamp) + populate(objectMap, "executionRequestId", b.ExecutionRequestID) + populate(objectMap, "meterId", b.MeterID) + populate(objectMap, "osBuild", b.OSBuild) + populate(objectMap, "release", b.Release) + populate(objectMap, "sku", b.SKU) + populateTimeRFC3339(objectMap, "startTimeStamp", b.StartTimeStamp) + populate(objectMap, "testType", b.TestType) + populate(objectMap, "updateType", b.UpdateType) + populate(objectMap, "usedBillableHours", b.UsedBillableHours) + populate(objectMap, "usedFreeHours", b.UsedFreeHours) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CPURegressionResultSingletonResourceProperties. -func (c *CPURegressionResultSingletonResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingHubExecutionUsageDetail. +func (b *BillingHubExecutionUsageDetail) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "analysisResultType": - err = unpopulate(val, "AnalysisResultType", &c.AnalysisResultType) + case "applicationName": + err = unpopulate(val, "ApplicationName", &b.ApplicationName) delete(rawMsg, key) - case "cpuRegressionResults": - err = unpopulate(val, "CPURegressionResults", &c.CPURegressionResults) + case "applicationVersion": + err = unpopulate(val, "ApplicationVersion", &b.ApplicationVersion) delete(rawMsg, key) - case "grade": - err = unpopulate(val, "Grade", &c.Grade) + case "billedCharges": + err = unpopulate(val, "BilledCharges", &b.BilledCharges) + delete(rawMsg, key) + case "endTimeStamp": + err = unpopulateTimeRFC3339(val, "EndTimeStamp", &b.EndTimeStamp) + delete(rawMsg, key) + case "executionRequestId": + err = unpopulate(val, "ExecutionRequestID", &b.ExecutionRequestID) + delete(rawMsg, key) + case "meterId": + err = unpopulate(val, "MeterID", &b.MeterID) + delete(rawMsg, key) + case "osBuild": + err = unpopulate(val, "OSBuild", &b.OSBuild) + delete(rawMsg, key) + case "release": + err = unpopulate(val, "Release", &b.Release) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &b.SKU) + delete(rawMsg, key) + case "startTimeStamp": + err = unpopulateTimeRFC3339(val, "StartTimeStamp", &b.StartTimeStamp) + delete(rawMsg, key) + case "testType": + err = unpopulate(val, "TestType", &b.TestType) + delete(rawMsg, key) + case "updateType": + err = unpopulate(val, "UpdateType", &b.UpdateType) + delete(rawMsg, key) + case "usedBillableHours": + err = unpopulate(val, "UsedBillableHours", &b.UsedBillableHours) + delete(rawMsg, key) + case "usedFreeHours": + err = unpopulate(val, "UsedFreeHours", &b.UsedFreeHours) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CPUUtilizationResultSingletonResourceProperties. -func (c CPUUtilizationResultSingletonResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type BillingHubFreeHourIncrementEntry. +func (b BillingHubFreeHourIncrementEntry) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["analysisResultType"] = AnalysisResultTypeCPUUtilization - populate(objectMap, "cpuUtilizationResults", c.CPUUtilizationResults) - populate(objectMap, "grade", c.Grade) + populateTimeRFC3339(objectMap, "createTimeStamp", b.CreateTimeStamp) + populateTimeRFC3339(objectMap, "expirationTimeStamp", b.ExpirationTimeStamp) + populate(objectMap, "freeHourStatus", b.FreeHourStatus) + populate(objectMap, "freeHourType", b.FreeHourType) + populate(objectMap, "incrementalFreeHours", b.IncrementalFreeHours) + populate(objectMap, "remainingFreeHours", b.RemainingFreeHours) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CPUUtilizationResultSingletonResourceProperties. -func (c *CPUUtilizationResultSingletonResourceProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingHubFreeHourIncrementEntry. +func (b *BillingHubFreeHourIncrementEntry) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", b, err) } for key, val := range rawMsg { var err error switch key { - case "analysisResultType": - err = unpopulate(val, "AnalysisResultType", &c.AnalysisResultType) + case "createTimeStamp": + err = unpopulateTimeRFC3339(val, "CreateTimeStamp", &b.CreateTimeStamp) delete(rawMsg, key) - case "cpuUtilizationResults": - err = unpopulate(val, "CPUUtilizationResults", &c.CPUUtilizationResults) + case "expirationTimeStamp": + err = unpopulateTimeRFC3339(val, "ExpirationTimeStamp", &b.ExpirationTimeStamp) delete(rawMsg, key) - case "grade": - err = unpopulate(val, "Grade", &c.Grade) + case "freeHourStatus": + err = unpopulate(val, "FreeHourStatus", &b.FreeHourStatus) delete(rawMsg, key) - } + case "freeHourType": + err = unpopulate(val, "FreeHourType", &b.FreeHourType) + delete(rawMsg, key) + case "incrementalFreeHours": + err = unpopulate(val, "IncrementalFreeHours", &b.IncrementalFreeHours) + delete(rawMsg, key) + case "remainingFreeHours": + err = unpopulate(val, "RemainingFreeHours", &b.RemainingFreeHours) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingHubGetFreeHourBalanceResponse. +func (b BillingHubGetFreeHourBalanceResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "incrementEntries", b.IncrementEntries) + populate(objectMap, "totalRemainingFreeHours", b.TotalRemainingFreeHours) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingHubGetFreeHourBalanceResponse. +func (b *BillingHubGetFreeHourBalanceResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "incrementEntries": + err = unpopulate(val, "IncrementEntries", &b.IncrementEntries) + delete(rawMsg, key) + case "totalRemainingFreeHours": + err = unpopulate(val, "TotalRemainingFreeHours", &b.TotalRemainingFreeHours) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingHubGetUsageRequest. +func (b BillingHubGetUsageRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "endTimeStamp", b.EndTimeStamp) + populate(objectMap, "pageIndex", b.PageIndex) + populate(objectMap, "pageSize", b.PageSize) + populateTimeRFC3339(objectMap, "startTimeStamp", b.StartTimeStamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingHubGetUsageRequest. +func (b *BillingHubGetUsageRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTimeStamp": + err = unpopulateTimeRFC3339(val, "EndTimeStamp", &b.EndTimeStamp) + delete(rawMsg, key) + case "pageIndex": + err = unpopulate(val, "PageIndex", &b.PageIndex) + delete(rawMsg, key) + case "pageSize": + err = unpopulate(val, "PageSize", &b.PageSize) + delete(rawMsg, key) + case "startTimeStamp": + err = unpopulateTimeRFC3339(val, "StartTimeStamp", &b.StartTimeStamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingHubGetUsageResponse. +func (b BillingHubGetUsageResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextRequest", b.NextRequest) + populate(objectMap, "packageUsageEntries", b.PackageUsageEntries) + populate(objectMap, "totalCharges", b.TotalCharges) + populate(objectMap, "totalUsedBillableHours", b.TotalUsedBillableHours) + populate(objectMap, "totalUsedFreeHours", b.TotalUsedFreeHours) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingHubGetUsageResponse. +func (b *BillingHubGetUsageResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextRequest": + err = unpopulate(val, "NextRequest", &b.NextRequest) + delete(rawMsg, key) + case "packageUsageEntries": + err = unpopulate(val, "PackageUsageEntries", &b.PackageUsageEntries) + delete(rawMsg, key) + case "totalCharges": + err = unpopulate(val, "TotalCharges", &b.TotalCharges) + delete(rawMsg, key) + case "totalUsedBillableHours": + err = unpopulate(val, "TotalUsedBillableHours", &b.TotalUsedBillableHours) + delete(rawMsg, key) + case "totalUsedFreeHours": + err = unpopulate(val, "TotalUsedFreeHours", &b.TotalUsedFreeHours) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingHubPackageUsage. +func (b BillingHubPackageUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationName", b.ApplicationName) + populate(objectMap, "applicationVersion", b.ApplicationVersion) + populate(objectMap, "azureResourceUri", b.AzureResourceURI) + populate(objectMap, "totalCharges", b.TotalCharges) + populate(objectMap, "totalUsedBillableHours", b.TotalUsedBillableHours) + populate(objectMap, "totalUsedFreeHours", b.TotalUsedFreeHours) + populate(objectMap, "usageEntriesGroupedByUpdateType", b.UsageEntriesGroupedByUpdateType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingHubPackageUsage. +func (b *BillingHubPackageUsage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationName": + err = unpopulate(val, "ApplicationName", &b.ApplicationName) + delete(rawMsg, key) + case "applicationVersion": + err = unpopulate(val, "ApplicationVersion", &b.ApplicationVersion) + delete(rawMsg, key) + case "azureResourceUri": + err = unpopulate(val, "AzureResourceURI", &b.AzureResourceURI) + delete(rawMsg, key) + case "totalCharges": + err = unpopulate(val, "TotalCharges", &b.TotalCharges) + delete(rawMsg, key) + case "totalUsedBillableHours": + err = unpopulate(val, "TotalUsedBillableHours", &b.TotalUsedBillableHours) + delete(rawMsg, key) + case "totalUsedFreeHours": + err = unpopulate(val, "TotalUsedFreeHours", &b.TotalUsedFreeHours) + delete(rawMsg, key) + case "usageEntriesGroupedByUpdateType": + err = unpopulate(val, "UsageEntriesGroupedByUpdateType", &b.UsageEntriesGroupedByUpdateType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingHubUsage. +func (b BillingHubUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationName", b.ApplicationName) + populate(objectMap, "applicationVersion", b.ApplicationVersion) + populate(objectMap, "azureResourceUri", b.AzureResourceURI) + populate(objectMap, "totalCharges", b.TotalCharges) + populate(objectMap, "totalUsedBillableHours", b.TotalUsedBillableHours) + populate(objectMap, "totalUsedFreeHours", b.TotalUsedFreeHours) + populate(objectMap, "usageGroups", b.UsageGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingHubUsage. +func (b *BillingHubUsage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationName": + err = unpopulate(val, "ApplicationName", &b.ApplicationName) + delete(rawMsg, key) + case "applicationVersion": + err = unpopulate(val, "ApplicationVersion", &b.ApplicationVersion) + delete(rawMsg, key) + case "azureResourceUri": + err = unpopulate(val, "AzureResourceURI", &b.AzureResourceURI) + delete(rawMsg, key) + case "totalCharges": + err = unpopulate(val, "TotalCharges", &b.TotalCharges) + delete(rawMsg, key) + case "totalUsedBillableHours": + err = unpopulate(val, "TotalUsedBillableHours", &b.TotalUsedBillableHours) + delete(rawMsg, key) + case "totalUsedFreeHours": + err = unpopulate(val, "TotalUsedFreeHours", &b.TotalUsedFreeHours) + delete(rawMsg, key) + case "usageGroups": + err = unpopulate(val, "UsageGroups", &b.UsageGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingHubUsageGroup. +func (b BillingHubUsageGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "executionUsageDetails", b.ExecutionUsageDetails) + populate(objectMap, "osBuild", b.OSBuild) + populate(objectMap, "productFamily", b.ProductFamily) + populate(objectMap, "release", b.Release) + populateTimeRFC3339(objectMap, "releaseBuildDate", b.ReleaseBuildDate) + populate(objectMap, "releaseBuildNumber", b.ReleaseBuildNumber) + populate(objectMap, "releaseBuildRevision", b.ReleaseBuildRevision) + populate(objectMap, "testType", b.TestType) + populate(objectMap, "totalCharges", b.TotalCharges) + populate(objectMap, "totalUsedBillableHours", b.TotalUsedBillableHours) + populate(objectMap, "totalUsedFreeHours", b.TotalUsedFreeHours) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingHubUsageGroup. +func (b *BillingHubUsageGroup) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "executionUsageDetails": + err = unpopulate(val, "ExecutionUsageDetails", &b.ExecutionUsageDetails) + delete(rawMsg, key) + case "osBuild": + err = unpopulate(val, "OSBuild", &b.OSBuild) + delete(rawMsg, key) + case "productFamily": + err = unpopulate(val, "ProductFamily", &b.ProductFamily) + delete(rawMsg, key) + case "release": + err = unpopulate(val, "Release", &b.Release) + delete(rawMsg, key) + case "releaseBuildDate": + err = unpopulateTimeRFC3339(val, "ReleaseBuildDate", &b.ReleaseBuildDate) + delete(rawMsg, key) + case "releaseBuildNumber": + err = unpopulate(val, "ReleaseBuildNumber", &b.ReleaseBuildNumber) + delete(rawMsg, key) + case "releaseBuildRevision": + err = unpopulate(val, "ReleaseBuildRevision", &b.ReleaseBuildRevision) + delete(rawMsg, key) + case "testType": + err = unpopulate(val, "TestType", &b.TestType) + delete(rawMsg, key) + case "totalCharges": + err = unpopulate(val, "TotalCharges", &b.TotalCharges) + delete(rawMsg, key) + case "totalUsedBillableHours": + err = unpopulate(val, "TotalUsedBillableHours", &b.TotalUsedBillableHours) + delete(rawMsg, key) + case "totalUsedFreeHours": + err = unpopulate(val, "TotalUsedFreeHours", &b.TotalUsedFreeHours) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingHubUsageGroupedByUpdateType. +func (b BillingHubUsageGroupedByUpdateType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "totalCharges", b.TotalCharges) + populate(objectMap, "totalUsedBillableHours", b.TotalUsedBillableHours) + populate(objectMap, "totalUsedFreeHours", b.TotalUsedFreeHours) + populate(objectMap, "updateType", b.UpdateType) + populate(objectMap, "usageGroups", b.UsageGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingHubUsageGroupedByUpdateType. +func (b *BillingHubUsageGroupedByUpdateType) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "totalCharges": + err = unpopulate(val, "TotalCharges", &b.TotalCharges) + delete(rawMsg, key) + case "totalUsedBillableHours": + err = unpopulate(val, "TotalUsedBillableHours", &b.TotalUsedBillableHours) + delete(rawMsg, key) + case "totalUsedFreeHours": + err = unpopulate(val, "TotalUsedFreeHours", &b.TotalUsedFreeHours) + delete(rawMsg, key) + case "updateType": + err = unpopulate(val, "UpdateType", &b.UpdateType) + delete(rawMsg, key) + case "usageGroups": + err = unpopulate(val, "UsageGroups", &b.UsageGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CPURegressionResultSingletonResourceProperties. +func (c CPURegressionResultSingletonResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["analysisResultType"] = AnalysisResultTypeCPURegression + populate(objectMap, "cpuRegressionResults", c.CPURegressionResults) + populate(objectMap, "grade", c.Grade) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CPURegressionResultSingletonResourceProperties. +func (c *CPURegressionResultSingletonResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "analysisResultType": + err = unpopulate(val, "AnalysisResultType", &c.AnalysisResultType) + delete(rawMsg, key) + case "cpuRegressionResults": + err = unpopulate(val, "CPURegressionResults", &c.CPURegressionResults) + delete(rawMsg, key) + case "grade": + err = unpopulate(val, "Grade", &c.Grade) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CPUUtilizationResultSingletonResourceProperties. +func (c CPUUtilizationResultSingletonResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["analysisResultType"] = AnalysisResultTypeCPUUtilization + populate(objectMap, "cpuUtilizationResults", c.CPUUtilizationResults) + populate(objectMap, "grade", c.Grade) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CPUUtilizationResultSingletonResourceProperties. +func (c *CPUUtilizationResultSingletonResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "analysisResultType": + err = unpopulate(val, "AnalysisResultType", &c.AnalysisResultType) + delete(rawMsg, key) + case "cpuUtilizationResults": + err = unpopulate(val, "CPUUtilizationResults", &c.CPUUtilizationResults) + delete(rawMsg, key) + case "grade": + err = unpopulate(val, "Grade", &c.Grade) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChatRequest. +func (c ChatRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "question", c.Question) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChatRequest. +func (c *ChatRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "question": + err = unpopulate(val, "Question", &c.Question) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChatResponse. +func (c ChatResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChatResponse. +func (c *ChatResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChatResponseProperties. +func (c ChatResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "answer", c.Answer) + populate(objectMap, "citations", c.Citations) + populate(objectMap, "limit", c.Limit) + populate(objectMap, "question", c.Question) + populate(objectMap, "usage", c.Usage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChatResponseProperties. +func (c *ChatResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "answer": + err = unpopulate(val, "Answer", &c.Answer) + delete(rawMsg, key) + case "citations": + err = unpopulate(val, "Citations", &c.Citations) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &c.Limit) + delete(rawMsg, key) + case "question": + err = unpopulate(val, "Question", &c.Question) + delete(rawMsg, key) + case "usage": + err = unpopulate(val, "Usage", &c.Usage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChatSessionProperties. +func (c ChatSessionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChatSessionProperties. +func (c *ChatSessionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChatSessionResource. +func (c ChatSessionResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChatSessionResource. +func (c *ChatSessionResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ChatSessionResourceListResult. +func (c ChatSessionResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ChatSessionResourceListResult. +func (c *ChatSessionResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResult. +func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", c.Message) + populate(objectMap, "nameAvailable", c.NameAvailable) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResult. +func (c *CheckNameAvailabilityResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &c.NameAvailable) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Command. +func (c Command) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", c.Action) + populate(objectMap, "alwaysRun", c.AlwaysRun) + populate(objectMap, "applyUpdateBefore", c.ApplyUpdateBefore) + populate(objectMap, "content", c.Content) + populate(objectMap, "contentType", c.ContentType) + populate(objectMap, "enrollIntuneBefore", c.EnrollIntuneBefore) + populate(objectMap, "install1PAppBefore", c.Install1PAppBefore) + populate(objectMap, "maxRunTime", c.MaxRunTime) + populate(objectMap, "name", c.Name) + populate(objectMap, "postUpgrade", c.PostUpgrade) + populate(objectMap, "preUpgrade", c.PreUpgrade) + populate(objectMap, "restartAfter", c.RestartAfter) + populate(objectMap, "runAsInteractive", c.RunAsInteractive) + populate(objectMap, "runElevated", c.RunElevated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Command. +func (c *Command) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &c.Action) + delete(rawMsg, key) + case "alwaysRun": + err = unpopulate(val, "AlwaysRun", &c.AlwaysRun) + delete(rawMsg, key) + case "applyUpdateBefore": + err = unpopulate(val, "ApplyUpdateBefore", &c.ApplyUpdateBefore) + delete(rawMsg, key) + case "content": + err = unpopulate(val, "Content", &c.Content) + delete(rawMsg, key) + case "contentType": + err = unpopulate(val, "ContentType", &c.ContentType) + delete(rawMsg, key) + case "enrollIntuneBefore": + err = unpopulate(val, "EnrollIntuneBefore", &c.EnrollIntuneBefore) + delete(rawMsg, key) + case "install1PAppBefore": + err = unpopulate(val, "Install1PAppBefore", &c.Install1PAppBefore) + delete(rawMsg, key) + case "maxRunTime": + err = unpopulate(val, "MaxRunTime", &c.MaxRunTime) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "postUpgrade": + err = unpopulate(val, "PostUpgrade", &c.PostUpgrade) + delete(rawMsg, key) + case "preUpgrade": + err = unpopulate(val, "PreUpgrade", &c.PreUpgrade) + delete(rawMsg, key) + case "restartAfter": + err = unpopulate(val, "RestartAfter", &c.RestartAfter) + delete(rawMsg, key) + case "runAsInteractive": + err = unpopulate(val, "RunAsInteractive", &c.RunAsInteractive) + delete(rawMsg, key) + case "runElevated": + err = unpopulate(val, "RunElevated", &c.RunElevated) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CopyFromPackageOperationParameters. +func (c CopyFromPackageOperationParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "packageId", c.PackageID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CopyFromPackageOperationParameters. +func (c *CopyFromPackageOperationParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "packageId": + err = unpopulate(val, "PackageID", &c.PackageID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CredentialListResult. +func (c CredentialListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialListResult. +func (c *CredentialListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CredentialProperties. +func (c CredentialProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["credentialType"] = c.CredentialType + populate(objectMap, "displayName", c.DisplayName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialProperties. +func (c *CredentialProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "credentialType": + err = unpopulate(val, "CredentialType", &c.CredentialType) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CredentialResource. +func (c CredentialResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CredentialResource. +func (c *CredentialResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + c.Properties, err = unmarshalCredentialPropertiesClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomImageListResult. +func (c CustomImageListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomImageListResult. +func (c *CustomImageListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomImageProperties. +func (c CustomImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "creationTime", c.CreationTime) + populate(objectMap, "definitionName", c.DefinitionName) + populate(objectMap, "osDiskImageSizeInGB", c.OSDiskImageSizeInGB) + populate(objectMap, "product", c.Product) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "release", c.Release) + populateTimeRFC3339(objectMap, "releaseVersionDate", c.ReleaseVersionDate) + populate(objectMap, "source", c.Source) + populate(objectMap, "status", c.Status) + populate(objectMap, "validationResults", c.ValidationResults) + populate(objectMap, "versionName", c.VersionName) + populate(objectMap, "vhdFileName", c.VhdFileName) + populate(objectMap, "vhdId", c.VhdID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomImageProperties. +func (c *CustomImageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "creationTime": + err = unpopulateTimeRFC3339(val, "CreationTime", &c.CreationTime) + delete(rawMsg, key) + case "definitionName": + err = unpopulate(val, "DefinitionName", &c.DefinitionName) + delete(rawMsg, key) + case "osDiskImageSizeInGB": + err = unpopulate(val, "OSDiskImageSizeInGB", &c.OSDiskImageSizeInGB) + delete(rawMsg, key) + case "product": + err = unpopulate(val, "Product", &c.Product) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "release": + err = unpopulate(val, "Release", &c.Release) + delete(rawMsg, key) + case "releaseVersionDate": + err = unpopulateTimeRFC3339(val, "ReleaseVersionDate", &c.ReleaseVersionDate) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &c.Source) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &c.Status) + delete(rawMsg, key) + case "validationResults": + err = unpopulate(val, "ValidationResults", &c.ValidationResults) + delete(rawMsg, key) + case "versionName": + err = unpopulate(val, "VersionName", &c.VersionName) + delete(rawMsg, key) + case "vhdFileName": + err = unpopulate(val, "VhdFileName", &c.VhdFileName) + delete(rawMsg, key) + case "vhdId": + err = unpopulate(val, "VhdID", &c.VhdID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomImageResource. +func (c CustomImageResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomImageResource. +func (c *CustomImageResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomerEventListResult. +func (c CustomerEventListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerEventListResult. +func (c *CustomerEventListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomerEventProperties. +func (c CustomerEventProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventName", c.EventName) + populate(objectMap, "receivers", c.Receivers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerEventProperties. +func (c *CustomerEventProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eventName": + err = unpopulate(val, "EventName", &c.EventName) + delete(rawMsg, key) + case "receivers": + err = unpopulate(val, "Receivers", &c.Receivers) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomerEventResource. +func (c CustomerEventResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerEventResource. +func (c *CustomerEventResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DistributionGroupListReceiverValue. +func (d DistributionGroupListReceiverValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "distributionGroups", d.DistributionGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DistributionGroupListReceiverValue. +func (d *DistributionGroupListReceiverValue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "distributionGroups": + err = unpopulate(val, "DistributionGroups", &d.DistributionGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DownloadURLResponse. +func (d DownloadURLResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "downloadUrl", d.DownloadURL) + populateTimeRFC3339(objectMap, "expirationTime", d.ExpirationTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURLResponse. +func (d *DownloadURLResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "downloadUrl": + err = unpopulate(val, "DownloadURL", &d.DownloadURL) + delete(rawMsg, key) + case "expirationTime": + err = unpopulateTimeRFC3339(val, "ExpirationTime", &d.ExpirationTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DraftPackageGetPathResponse. +func (d DraftPackageGetPathResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseUrl", d.BaseURL) + populate(objectMap, "draftPackagePath", d.DraftPackagePath) + populateTimeRFC3339(objectMap, "expirationTime", d.ExpirationTime) + populate(objectMap, "sasToken", d.SasToken) + populate(objectMap, "workingPath", d.WorkingPath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DraftPackageGetPathResponse. +func (d *DraftPackageGetPathResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseUrl": + err = unpopulate(val, "BaseURL", &d.BaseURL) + delete(rawMsg, key) + case "draftPackagePath": + err = unpopulate(val, "DraftPackagePath", &d.DraftPackagePath) + delete(rawMsg, key) + case "expirationTime": + err = unpopulateTimeRFC3339(val, "ExpirationTime", &d.ExpirationTime) + delete(rawMsg, key) + case "sasToken": + err = unpopulate(val, "SasToken", &d.SasToken) + delete(rawMsg, key) + case "workingPath": + err = unpopulate(val, "WorkingPath", &d.WorkingPath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DraftPackageIntuneAppMetadata. +func (d DraftPackageIntuneAppMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "intuneApp", d.IntuneApp) + populate(objectMap, "intuneAppDependencies", d.IntuneAppDependencies) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DraftPackageIntuneAppMetadata. +func (d *DraftPackageIntuneAppMetadata) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "intuneApp": + err = unpopulate(val, "IntuneApp", &d.IntuneApp) + delete(rawMsg, key) + case "intuneAppDependencies": + err = unpopulate(val, "IntuneAppDependencies", &d.IntuneAppDependencies) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DraftPackageIntuneAppMetadataItem. +func (d DraftPackageIntuneAppMetadataItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appId", d.AppID) + populate(objectMap, "appName", d.AppName) + populateTimeRFC3339(objectMap, "createDate", d.CreateDate) + populate(objectMap, "dependencyIds", d.DependencyIDs) + populate(objectMap, "dependentAppCount", d.DependentAppCount) + populate(objectMap, "description", d.Description) + populate(objectMap, "expectedExitCodes", d.ExpectedExitCodes) + populate(objectMap, "installCommand", d.InstallCommand) + populate(objectMap, "lastProcessed", d.LastProcessed) + populate(objectMap, "minimumSupportedOS", d.MinimumSupportedOS) + populate(objectMap, "owner", d.Owner) + populate(objectMap, "publisher", d.Publisher) + populate(objectMap, "setupFile", d.SetupFile) + populate(objectMap, "status", d.Status) + populate(objectMap, "uninstallCommand", d.UninstallCommand) + populate(objectMap, "version", d.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DraftPackageIntuneAppMetadataItem. +func (d *DraftPackageIntuneAppMetadataItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appId": + err = unpopulate(val, "AppID", &d.AppID) + delete(rawMsg, key) + case "appName": + err = unpopulate(val, "AppName", &d.AppName) + delete(rawMsg, key) + case "createDate": + err = unpopulateTimeRFC3339(val, "CreateDate", &d.CreateDate) + delete(rawMsg, key) + case "dependencyIds": + err = unpopulate(val, "DependencyIDs", &d.DependencyIDs) + delete(rawMsg, key) + case "dependentAppCount": + err = unpopulate(val, "DependentAppCount", &d.DependentAppCount) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "expectedExitCodes": + err = unpopulate(val, "ExpectedExitCodes", &d.ExpectedExitCodes) + delete(rawMsg, key) + case "installCommand": + err = unpopulate(val, "InstallCommand", &d.InstallCommand) + delete(rawMsg, key) + case "lastProcessed": + err = unpopulate(val, "LastProcessed", &d.LastProcessed) + delete(rawMsg, key) + case "minimumSupportedOS": + err = unpopulate(val, "MinimumSupportedOS", &d.MinimumSupportedOS) + delete(rawMsg, key) + case "owner": + err = unpopulate(val, "Owner", &d.Owner) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &d.Publisher) + delete(rawMsg, key) + case "setupFile": + err = unpopulate(val, "SetupFile", &d.SetupFile) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &d.Status) + delete(rawMsg, key) + case "uninstallCommand": + err = unpopulate(val, "UninstallCommand", &d.UninstallCommand) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &d.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DraftPackageListResult. +func (d DraftPackageListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DraftPackageListResult. +func (d *DraftPackageListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DraftPackageProperties. +func (d DraftPackageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appFileName", d.AppFileName) + populate(objectMap, "applicationName", d.ApplicationName) + populate(objectMap, "comments", d.Comments) + populate(objectMap, "draftPackagePath", d.DraftPackagePath) + populate(objectMap, "editPackage", d.EditPackage) + populate(objectMap, "executableLaunchCommand", d.ExecutableLaunchCommand) + populate(objectMap, "firstPartyApps", d.FirstPartyApps) + populate(objectMap, "flightingRing", d.FlightingRing) + populate(objectMap, "galleryApps", d.GalleryApps) + populate(objectMap, "highlightedFiles", d.HighlightedFiles) + populate(objectMap, "inplaceUpgradeOSPair", d.InplaceUpgradeOSPair) + populate(objectMap, "intuneEnrollmentMetadata", d.IntuneEnrollmentMetadata) + populate(objectMap, "intuneMetadata", d.IntuneMetadata) + populateTimeRFC3339(objectMap, "lastModifiedTime", d.LastModifiedTime) + populate(objectMap, "packageId", d.PackageID) + populate(objectMap, "packageTags", d.PackageTags) + populate(objectMap, "processName", d.ProcessName) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "sourceType", d.SourceType) + populate(objectMap, "tabState", d.TabState) + populate(objectMap, "targetOSList", d.TargetOSList) + populate(objectMap, "testTypes", d.TestTypes) + populate(objectMap, "tests", d.Tests) + populate(objectMap, "useAutofill", d.UseAutofill) + populate(objectMap, "useSample", d.UseSample) + populate(objectMap, "version", d.Version) + populate(objectMap, "workingPath", d.WorkingPath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DraftPackageProperties. +func (d *DraftPackageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appFileName": + err = unpopulate(val, "AppFileName", &d.AppFileName) + delete(rawMsg, key) + case "applicationName": + err = unpopulate(val, "ApplicationName", &d.ApplicationName) + delete(rawMsg, key) + case "comments": + err = unpopulate(val, "Comments", &d.Comments) + delete(rawMsg, key) + case "draftPackagePath": + err = unpopulate(val, "DraftPackagePath", &d.DraftPackagePath) + delete(rawMsg, key) + case "editPackage": + err = unpopulate(val, "EditPackage", &d.EditPackage) + delete(rawMsg, key) + case "executableLaunchCommand": + err = unpopulate(val, "ExecutableLaunchCommand", &d.ExecutableLaunchCommand) + delete(rawMsg, key) + case "firstPartyApps": + err = unpopulate(val, "FirstPartyApps", &d.FirstPartyApps) + delete(rawMsg, key) + case "flightingRing": + err = unpopulate(val, "FlightingRing", &d.FlightingRing) + delete(rawMsg, key) + case "galleryApps": + err = unpopulate(val, "GalleryApps", &d.GalleryApps) + delete(rawMsg, key) + case "highlightedFiles": + err = unpopulate(val, "HighlightedFiles", &d.HighlightedFiles) + delete(rawMsg, key) + case "inplaceUpgradeOSPair": + err = unpopulate(val, "InplaceUpgradeOSPair", &d.InplaceUpgradeOSPair) + delete(rawMsg, key) + case "intuneEnrollmentMetadata": + err = unpopulate(val, "IntuneEnrollmentMetadata", &d.IntuneEnrollmentMetadata) + delete(rawMsg, key) + case "intuneMetadata": + err = unpopulate(val, "IntuneMetadata", &d.IntuneMetadata) + delete(rawMsg, key) + case "lastModifiedTime": + err = unpopulateTimeRFC3339(val, "LastModifiedTime", &d.LastModifiedTime) + delete(rawMsg, key) + case "packageId": + err = unpopulate(val, "PackageID", &d.PackageID) + delete(rawMsg, key) + case "packageTags": + err = unpopulate(val, "PackageTags", &d.PackageTags) + delete(rawMsg, key) + case "processName": + err = unpopulate(val, "ProcessName", &d.ProcessName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "sourceType": + err = unpopulate(val, "SourceType", &d.SourceType) + delete(rawMsg, key) + case "tabState": + err = unpopulate(val, "TabState", &d.TabState) + delete(rawMsg, key) + case "targetOSList": + err = unpopulate(val, "TargetOSList", &d.TargetOSList) + delete(rawMsg, key) + case "testTypes": + err = unpopulate(val, "TestTypes", &d.TestTypes) + delete(rawMsg, key) + case "tests": + err = unpopulate(val, "Tests", &d.Tests) + delete(rawMsg, key) + case "useAutofill": + err = unpopulate(val, "UseAutofill", &d.UseAutofill) + delete(rawMsg, key) + case "useSample": + err = unpopulate(val, "UseSample", &d.UseSample) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &d.Version) + delete(rawMsg, key) + case "workingPath": + err = unpopulate(val, "WorkingPath", &d.WorkingPath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DraftPackageResource. +func (d DraftPackageResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DraftPackageResource. +func (d *DraftPackageResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DraftPackageUpdateParameterProperties. +func (d DraftPackageUpdateParameterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appFileName", d.AppFileName) + populate(objectMap, "applicationName", d.ApplicationName) + populate(objectMap, "comments", d.Comments) + populate(objectMap, "executableLaunchCommand", d.ExecutableLaunchCommand) + populate(objectMap, "firstPartyApps", d.FirstPartyApps) + populate(objectMap, "flightingRing", d.FlightingRing) + populate(objectMap, "galleryApps", d.GalleryApps) + populate(objectMap, "highlightedFiles", d.HighlightedFiles) + populate(objectMap, "inplaceUpgradeOSPair", d.InplaceUpgradeOSPair) + populate(objectMap, "intuneEnrollmentMetadata", d.IntuneEnrollmentMetadata) + populate(objectMap, "intuneMetadata", d.IntuneMetadata) + populate(objectMap, "packageId", d.PackageID) + populate(objectMap, "packageTags", d.PackageTags) + populate(objectMap, "processName", d.ProcessName) + populate(objectMap, "sourceType", d.SourceType) + populate(objectMap, "tabState", d.TabState) + populate(objectMap, "targetOSList", d.TargetOSList) + populate(objectMap, "testTypes", d.TestTypes) + populate(objectMap, "tests", d.Tests) + populate(objectMap, "useAutofill", d.UseAutofill) + populate(objectMap, "useSample", d.UseSample) + populate(objectMap, "version", d.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DraftPackageUpdateParameterProperties. +func (d *DraftPackageUpdateParameterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appFileName": + err = unpopulate(val, "AppFileName", &d.AppFileName) + delete(rawMsg, key) + case "applicationName": + err = unpopulate(val, "ApplicationName", &d.ApplicationName) + delete(rawMsg, key) + case "comments": + err = unpopulate(val, "Comments", &d.Comments) + delete(rawMsg, key) + case "executableLaunchCommand": + err = unpopulate(val, "ExecutableLaunchCommand", &d.ExecutableLaunchCommand) + delete(rawMsg, key) + case "firstPartyApps": + err = unpopulate(val, "FirstPartyApps", &d.FirstPartyApps) + delete(rawMsg, key) + case "flightingRing": + err = unpopulate(val, "FlightingRing", &d.FlightingRing) + delete(rawMsg, key) + case "galleryApps": + err = unpopulate(val, "GalleryApps", &d.GalleryApps) + delete(rawMsg, key) + case "highlightedFiles": + err = unpopulate(val, "HighlightedFiles", &d.HighlightedFiles) + delete(rawMsg, key) + case "inplaceUpgradeOSPair": + err = unpopulate(val, "InplaceUpgradeOSPair", &d.InplaceUpgradeOSPair) + delete(rawMsg, key) + case "intuneEnrollmentMetadata": + err = unpopulate(val, "IntuneEnrollmentMetadata", &d.IntuneEnrollmentMetadata) + delete(rawMsg, key) + case "intuneMetadata": + err = unpopulate(val, "IntuneMetadata", &d.IntuneMetadata) + delete(rawMsg, key) + case "packageId": + err = unpopulate(val, "PackageID", &d.PackageID) + delete(rawMsg, key) + case "packageTags": + err = unpopulate(val, "PackageTags", &d.PackageTags) + delete(rawMsg, key) + case "processName": + err = unpopulate(val, "ProcessName", &d.ProcessName) + delete(rawMsg, key) + case "sourceType": + err = unpopulate(val, "SourceType", &d.SourceType) + delete(rawMsg, key) + case "tabState": + err = unpopulate(val, "TabState", &d.TabState) + delete(rawMsg, key) + case "targetOSList": + err = unpopulate(val, "TargetOSList", &d.TargetOSList) + delete(rawMsg, key) + case "testTypes": + err = unpopulate(val, "TestTypes", &d.TestTypes) + delete(rawMsg, key) + case "tests": + err = unpopulate(val, "Tests", &d.Tests) + delete(rawMsg, key) + case "useAutofill": + err = unpopulate(val, "UseAutofill", &d.UseAutofill) + delete(rawMsg, key) + case "useSample": + err = unpopulate(val, "UseSample", &d.UseSample) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &d.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DraftPackageUpdateParameters. +func (d DraftPackageUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", d.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DraftPackageUpdateParameters. +func (d *DraftPackageUpdateParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmailEventListResult. +func (e EmailEventListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailEventListResult. +func (e *EmailEventListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmailEventProperties. +func (e EmailEventProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "eventId", e.EventID) + populate(objectMap, "eventName", e.EventName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailEventProperties. +func (e *EmailEventProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "eventId": + err = unpopulate(val, "EventID", &e.EventID) + delete(rawMsg, key) + case "eventName": + err = unpopulate(val, "EventName", &e.EventName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmailEventResource. +func (e EmailEventResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailEventResource. +func (e *EmailEventResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnrolledIntuneApp. +func (e EnrolledIntuneApp) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appId", e.AppID) + populate(objectMap, "appName", e.AppName) + populate(objectMap, "expectedInstallationPath", e.ExpectedInstallationPath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnrolledIntuneApp. +func (e *EnrolledIntuneApp) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appId": + err = unpopulate(val, "AppID", &e.AppID) + delete(rawMsg, key) + case "appName": + err = unpopulate(val, "AppName", &e.AppName) + delete(rawMsg, key) + case "expectedInstallationPath": + err = unpopulate(val, "ExpectedInstallationPath", &e.ExpectedInstallationPath) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExtractFileOperationParameters. +func (e ExtractFileOperationParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "fileType", e.FileType) + populate(objectMap, "intuneAppId", e.IntuneAppID) + populate(objectMap, "sourceFile", e.SourceFile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtractFileOperationParameters. +func (e *ExtractFileOperationParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fileType": + err = unpopulate(val, "FileType", &e.FileType) + delete(rawMsg, key) + case "intuneAppId": + err = unpopulate(val, "IntuneAppID", &e.IntuneAppID) + delete(rawMsg, key) + case "sourceFile": + err = unpopulate(val, "SourceFile", &e.SourceFile) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FavoriteProcessListResult. +func (f FavoriteProcessListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FavoriteProcessListResult. +func (f *FavoriteProcessListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FavoriteProcessProperties. +func (f FavoriteProcessProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actualProcessName", f.ActualProcessName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FavoriteProcessProperties. +func (f *FavoriteProcessProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actualProcessName": + err = unpopulate(val, "ActualProcessName", &f.ActualProcessName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FavoriteProcessResource. +func (f FavoriteProcessResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FavoriteProcessResource. +func (f *FavoriteProcessResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FeatureUpdateSupportedOsesProperties. +func (f FeatureUpdateSupportedOsesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baselineProducts", f.BaselineProducts) + populate(objectMap, "displayText", f.DisplayText) + populate(objectMap, "insiderChannel", f.InsiderChannel) + populate(objectMap, "osId", f.OSID) + populate(objectMap, "osName", f.OSName) + populateTimeRFC3339(objectMap, "startTime", f.StartTime) + populate(objectMap, "state", f.State) + populate(objectMap, "version", f.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureUpdateSupportedOsesProperties. +func (f *FeatureUpdateSupportedOsesProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baselineProducts": + err = unpopulate(val, "BaselineProducts", &f.BaselineProducts) + delete(rawMsg, key) + case "displayText": + err = unpopulate(val, "DisplayText", &f.DisplayText) + delete(rawMsg, key) + case "insiderChannel": + err = unpopulate(val, "InsiderChannel", &f.InsiderChannel) + delete(rawMsg, key) + case "osId": + err = unpopulate(val, "OSID", &f.OSID) + delete(rawMsg, key) + case "osName": + err = unpopulate(val, "OSName", &f.OSName) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &f.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &f.State) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &f.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FeatureUpdateSupportedOsesResource. +func (f FeatureUpdateSupportedOsesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureUpdateSupportedOsesResource. +func (f *FeatureUpdateSupportedOsesResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FeatureUpdateSupportedOsesResult. +func (f FeatureUpdateSupportedOsesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FeatureUpdateSupportedOsesResult. +func (f *FeatureUpdateSupportedOsesResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileUploadURLResponse. +func (f FileUploadURLResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobPath", f.BlobPath) + populate(objectMap, "uploadUrl", f.UploadURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileUploadURLResponse. +func (f *FileUploadURLResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobPath": + err = unpopulate(val, "BlobPath", &f.BlobPath) + delete(rawMsg, key) + case "uploadUrl": + err = unpopulate(val, "UploadURL", &f.UploadURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirstPartyAppDefinition. +func (f FirstPartyAppDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "architecture", f.Architecture) + populate(objectMap, "channel", f.Channel) + populate(objectMap, "interopExecutionMode", f.InteropExecutionMode) + populate(objectMap, "name", f.Name) + populate(objectMap, "ring", f.Ring) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirstPartyAppDefinition. +func (f *FirstPartyAppDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "architecture": + err = unpopulate(val, "Architecture", &f.Architecture) + delete(rawMsg, key) + case "channel": + err = unpopulate(val, "Channel", &f.Channel) + delete(rawMsg, key) + case "interopExecutionMode": + err = unpopulate(val, "InteropExecutionMode", &f.InteropExecutionMode) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "ring": + err = unpopulate(val, "Ring", &f.Ring) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirstPartyAppListResult. +func (f FirstPartyAppListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirstPartyAppListResult. +func (f *FirstPartyAppListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirstPartyAppProperties. +func (f FirstPartyAppProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "architecture", f.Architecture) + populate(objectMap, "channel", f.Channel) + populate(objectMap, "mediaType", f.MediaType) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "ring", f.Ring) + populate(objectMap, "supportedProducts", f.SupportedProducts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirstPartyAppProperties. +func (f *FirstPartyAppProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "architecture": + err = unpopulate(val, "Architecture", &f.Architecture) + delete(rawMsg, key) + case "channel": + err = unpopulate(val, "Channel", &f.Channel) + delete(rawMsg, key) + case "mediaType": + err = unpopulate(val, "MediaType", &f.MediaType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "ring": + err = unpopulate(val, "Ring", &f.Ring) + delete(rawMsg, key) + case "supportedProducts": + err = unpopulate(val, "SupportedProducts", &f.SupportedProducts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirstPartyAppResource. +func (f FirstPartyAppResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirstPartyAppResource. +func (f *FirstPartyAppResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlightingRingListResult. +func (f FlightingRingListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlightingRingListResult. +func (f *FlightingRingListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResult. -func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FlightingRingProperties. +func (f FlightingRingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "message", c.Message) - populate(objectMap, "nameAvailable", c.NameAvailable) - populate(objectMap, "reason", c.Reason) + populate(objectMap, "actualFlightingRingName", f.ActualFlightingRingName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResult. -func (c *CheckNameAvailabilityResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FlightingRingProperties. +func (f *FlightingRingProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "message": - err = unpopulate(val, "Message", &c.Message) + case "actualFlightingRingName": + err = unpopulate(val, "ActualFlightingRingName", &f.ActualFlightingRingName) delete(rawMsg, key) - case "nameAvailable": - err = unpopulate(val, "NameAvailable", &c.NameAvailable) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlightingRingResource. +func (f FlightingRingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlightingRingResource. +func (f *FlightingRingResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &c.Reason) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Command. -func (c Command) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FreeHourBalanceResource. +func (f FreeHourBalanceResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "action", c.Action) - populate(objectMap, "alwaysRun", c.AlwaysRun) - populate(objectMap, "applyUpdateBefore", c.ApplyUpdateBefore) - populate(objectMap, "content", c.Content) - populate(objectMap, "contentType", c.ContentType) - populate(objectMap, "maxRunTime", c.MaxRunTime) - populate(objectMap, "name", c.Name) - populate(objectMap, "restartAfter", c.RestartAfter) - populate(objectMap, "runAsInteractive", c.RunAsInteractive) - populate(objectMap, "runElevated", c.RunElevated) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Command. -func (c *Command) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FreeHourBalanceResource. +func (f *FreeHourBalanceResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "action": - err = unpopulate(val, "Action", &c.Action) + case "id": + err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) - case "alwaysRun": - err = unpopulate(val, "AlwaysRun", &c.AlwaysRun) + case "name": + err = unpopulate(val, "Name", &f.Name) delete(rawMsg, key) - case "applyUpdateBefore": - err = unpopulate(val, "ApplyUpdateBefore", &c.ApplyUpdateBefore) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) delete(rawMsg, key) - case "content": - err = unpopulate(val, "Content", &c.Content) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) delete(rawMsg, key) - case "contentType": - err = unpopulate(val, "ContentType", &c.ContentType) + case "type": + err = unpopulate(val, "Type", &f.Type) delete(rawMsg, key) - case "maxRunTime": - err = unpopulate(val, "MaxRunTime", &c.MaxRunTime) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FreeHourBalancesListResult. +func (f FreeHourBalancesListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FreeHourBalancesListResult. +func (f *FreeHourBalancesListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryAppDefinition. +func (g GalleryAppDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isConsented", g.IsConsented) + populate(objectMap, "skuId", g.SKUID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryAppDefinition. +func (g *GalleryAppDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "isConsented": + err = unpopulate(val, "IsConsented", &g.IsConsented) + delete(rawMsg, key) + case "skuId": + err = unpopulate(val, "SKUID", &g.SKUID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryAppListResult. +func (g GalleryAppListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryAppListResult. +func (g *GalleryAppListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryAppProperties. +func (g GalleryAppProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationId", g.ApplicationID) + populate(objectMap, "applicationName", g.ApplicationName) + populate(objectMap, "applicationType", g.ApplicationType) + populate(objectMap, "popularity", g.Popularity) + populate(objectMap, "provisioningState", g.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryAppProperties. +func (g *GalleryAppProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationId": + err = unpopulate(val, "ApplicationID", &g.ApplicationID) + delete(rawMsg, key) + case "applicationName": + err = unpopulate(val, "ApplicationName", &g.ApplicationName) + delete(rawMsg, key) + case "applicationType": + err = unpopulate(val, "ApplicationType", &g.ApplicationType) + delete(rawMsg, key) + case "popularity": + err = unpopulate(val, "Popularity", &g.Popularity) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GalleryAppResource. +func (g GalleryAppResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryAppResource. +func (g *GalleryAppResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) - case "restartAfter": - err = unpopulate(val, "RestartAfter", &c.RestartAfter) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) - case "runAsInteractive": - err = unpopulate(val, "RunAsInteractive", &c.RunAsInteractive) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) delete(rawMsg, key) - case "runElevated": - err = unpopulate(val, "RunElevated", &c.RunElevated) + case "type": + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomerEventListResult. -func (c CustomerEventListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryAppSKUListResult. +func (g GalleryAppSKUListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerEventListResult. -func (c *CustomerEventListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryAppSKUListResult. +func (g *GalleryAppSKUListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &c.Value) + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomerEventProperties. -func (c CustomerEventProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryAppSKUProperties. +func (g GalleryAppSKUProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "eventName", c.EventName) - populate(objectMap, "receivers", c.Receivers) + objectMap["applicationType"] = g.ApplicationType + populate(objectMap, "provisioningState", g.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerEventProperties. -func (c *CustomerEventProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryAppSKUProperties. +func (g *GalleryAppSKUProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "eventName": - err = unpopulate(val, "EventName", &c.EventName) + case "applicationType": + err = unpopulate(val, "ApplicationType", &g.ApplicationType) delete(rawMsg, key) - case "receivers": - err = unpopulate(val, "Receivers", &c.Receivers) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &g.ProvisioningState) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomerEventResource. -func (c CustomerEventResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GalleryAppSKUResource. +func (g GalleryAppSKUResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "type", c.Type) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerEventResource. -func (c *CustomerEventResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GalleryAppSKUResource. +func (g *GalleryAppSKUResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &c.ID) + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &c.Properties) + g.Properties, err = unmarshalGalleryAppSKUPropertiesClassification(val) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) + err = unpopulate(val, "SystemData", &g.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &c.Type) + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DistributionGroupListReceiverValue. -func (d DistributionGroupListReceiverValue) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GenerateOperationParameters. +func (g GenerateOperationParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "distributionGroups", d.DistributionGroups) + populate(objectMap, "forceGenerate", g.ForceGenerate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DistributionGroupListReceiverValue. -func (d *DistributionGroupListReceiverValue) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateOperationParameters. +func (g *GenerateOperationParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "distributionGroups": - err = unpopulate(val, "DistributionGroups", &d.DistributionGroups) + case "forceGenerate": + err = unpopulate(val, "ForceGenerate", &g.ForceGenerate) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DownloadURLResponse. -func (d DownloadURLResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GetFileUploadURLParameters. +func (g GetFileUploadURLParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "downloadUrl", d.DownloadURL) - populateTimeRFC3339(objectMap, "expirationTime", d.ExpirationTime) + populate(objectMap, "blobName", g.BlobName) + populate(objectMap, "resourceType", g.ResourceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURLResponse. -func (d *DownloadURLResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GetFileUploadURLParameters. +func (g *GetFileUploadURLParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "downloadUrl": - err = unpopulate(val, "DownloadURL", &d.DownloadURL) + case "blobName": + err = unpopulate(val, "BlobName", &g.BlobName) delete(rawMsg, key) - case "expirationTime": - err = unpopulateTimeRFC3339(val, "ExpirationTime", &d.ExpirationTime) + case "resourceType": + err = unpopulate(val, "ResourceType", &g.ResourceType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailEventListResult. -func (e EmailEventListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GetImageDefinitionParameters. +func (g GetImageDefinitionParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + populate(objectMap, "definitionName", g.DefinitionName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailEventListResult. -func (e *EmailEventListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GetImageDefinitionParameters. +func (g *GetImageDefinitionParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) + case "definitionName": + err = unpopulate(val, "DefinitionName", &g.DefinitionName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailEventProperties. -func (e EmailEventProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HighlightedFile. +func (h HighlightedFile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", e.DisplayName) - populate(objectMap, "eventId", e.EventID) - populate(objectMap, "eventName", e.EventName) + populate(objectMap, "path", h.Path) + populate(objectMap, "sections", h.Sections) + populate(objectMap, "visited", h.Visited) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailEventProperties. -func (e *EmailEventProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HighlightedFile. +func (h *HighlightedFile) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &e.DisplayName) + case "path": + err = unpopulate(val, "Path", &h.Path) delete(rawMsg, key) - case "eventId": - err = unpopulate(val, "EventID", &e.EventID) + case "sections": + err = unpopulate(val, "Sections", &h.Sections) delete(rawMsg, key) - case "eventName": - err = unpopulate(val, "EventName", &e.EventName) + case "visited": + err = unpopulate(val, "Visited", &h.Visited) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", h, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailEventResource. -func (e EmailEventResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IdentifiedFailure. +func (i IdentifiedFailure) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) + populate(objectMap, "category", i.Category) + populate(objectMap, "errorMessage", i.ErrorMessage) + populate(objectMap, "failureId", i.FailureID) + populate(objectMap, "guidance", i.Guidance) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailEventResource. -func (e *EmailEventResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IdentifiedFailure. +func (i *IdentifiedFailure) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) + case "category": + err = unpopulate(val, "Category", &i.Category) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &i.ErrorMessage) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) + case "failureId": + err = unpopulate(val, "FailureID", &i.FailureID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "guidance": + err = unpopulate(val, "Guidance", &i.Guidance) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDefinition. -func (e ErrorDefinition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionListResult. +func (i ImageDefinitionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDefinition. -func (e *ErrorDefinition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionListResult. +func (i *ImageDefinitionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "value": + err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionProperties. +func (i ImageDefinitionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) + populate(objectMap, "architecture", i.Architecture) + populate(objectMap, "osState", i.OSState) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "securityType", i.SecurityType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionProperties. +func (i *ImageDefinitionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "architecture": + err = unpopulate(val, "Architecture", &i.Architecture) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FavoriteProcessListResult. -func (f FavoriteProcessListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", f.NextLink) - populate(objectMap, "value", f.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FavoriteProcessListResult. -func (f *FavoriteProcessListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &f.NextLink) + case "osState": + err = unpopulate(val, "OSState", &i.OSState) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &f.Value) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "securityType": + err = unpopulate(val, "SecurityType", &i.SecurityType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FavoriteProcessProperties. -func (f FavoriteProcessProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionResource. +func (i ImageDefinitionResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actualProcessName", f.ActualProcessName) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FavoriteProcessProperties. -func (f *FavoriteProcessProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionResource. +func (i *ImageDefinitionResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "actualProcessName": - err = unpopulate(val, "ActualProcessName", &f.ActualProcessName) + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FavoriteProcessResource. -func (f FavoriteProcessResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageDefinitionsListResult. +func (i ImageDefinitionsListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", f.ID) - populate(objectMap, "name", f.Name) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "type", f.Type) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FavoriteProcessResource. -func (f *FavoriteProcessResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageDefinitionsListResult. +func (i *ImageDefinitionsListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &f.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &f.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &f.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &f.SystemData) + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) + case "value": + err = unpopulate(val, "Value", &i.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FileUploadURLResponse. -func (f FileUploadURLResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageNameCheckAvailabilityParameters. +func (i ImageNameCheckAvailabilityParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "blobPath", f.BlobPath) - populate(objectMap, "uploadUrl", f.UploadURL) + populate(objectMap, "definitionName", i.DefinitionName) + populate(objectMap, "versionName", i.VersionName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FileUploadURLResponse. -func (f *FileUploadURLResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageNameCheckAvailabilityParameters. +func (i *ImageNameCheckAvailabilityParameters) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "blobPath": - err = unpopulate(val, "BlobPath", &f.BlobPath) + case "definitionName": + err = unpopulate(val, "DefinitionName", &i.DefinitionName) delete(rawMsg, key) - case "uploadUrl": - err = unpopulate(val, "UploadURL", &f.UploadURL) + case "versionName": + err = unpopulate(val, "VersionName", &i.VersionName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FlightingRingListResult. -func (f FlightingRingListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ImageValidationResults. +func (i ImageValidationResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", f.NextLink) - populate(objectMap, "value", f.Value) + populate(objectMap, "results", i.Results) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FlightingRingListResult. -func (f *FlightingRingListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ImageValidationResults. +func (i *ImageValidationResults) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &f.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &f.Value) + case "results": + err = unpopulate(val, "Results", &i.Results) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FlightingRingProperties. -func (f FlightingRingProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InplaceUpgradeOSInfo. +func (i InplaceUpgradeOSInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actualFlightingRingName", f.ActualFlightingRingName) + populate(objectMap, "baselineOS", i.BaselineOS) + populate(objectMap, "targetOS", i.TargetOS) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FlightingRingProperties. -func (f *FlightingRingProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InplaceUpgradeOSInfo. +func (i *InplaceUpgradeOSInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "actualFlightingRingName": - err = unpopulate(val, "ActualFlightingRingName", &f.ActualFlightingRingName) + case "baselineOS": + err = unpopulate(val, "BaselineOS", &i.BaselineOS) + delete(rawMsg, key) + case "targetOS": + err = unpopulate(val, "TargetOS", &i.TargetOS) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FlightingRingResource. -func (f FlightingRingResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type InplaceUpgradeProperties. +func (i InplaceUpgradeProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", f.ID) - populate(objectMap, "name", f.Name) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "type", f.Type) + populate(objectMap, "baselineBuildNumber", i.BaselineBuildNumber) + populate(objectMap, "baselineBuildRevision", i.BaselineBuildRevision) + populate(objectMap, "baselineKbNumber", i.BaselineKbNumber) + populate(objectMap, "baselineOsName", i.BaselineOsName) + populate(objectMap, "baselineReleaseName", i.BaselineReleaseName) + populateTimeRFC3339(objectMap, "baselineReleaseVersionDate", i.BaselineReleaseVersionDate) + populate(objectMap, "customImageDisplayName", i.CustomImageDisplayName) + populate(objectMap, "customImageId", i.CustomImageID) + populateTimeRFC3339(objectMap, "upgradeEndTime", i.UpgradeEndTime) + populateTimeRFC3339(objectMap, "upgradeStartTime", i.UpgradeStartTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FlightingRingResource. -func (f *FlightingRingResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type InplaceUpgradeProperties. +func (i *InplaceUpgradeProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &f.ID) + case "baselineBuildNumber": + err = unpopulate(val, "BaselineBuildNumber", &i.BaselineBuildNumber) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &f.Name) + case "baselineBuildRevision": + err = unpopulate(val, "BaselineBuildRevision", &i.BaselineBuildRevision) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &f.Properties) + case "baselineKbNumber": + err = unpopulate(val, "BaselineKbNumber", &i.BaselineKbNumber) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &f.SystemData) + case "baselineOsName": + err = unpopulate(val, "BaselineOsName", &i.BaselineOsName) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) + case "baselineReleaseName": + err = unpopulate(val, "BaselineReleaseName", &i.BaselineReleaseName) + delete(rawMsg, key) + case "baselineReleaseVersionDate": + err = unpopulateTimeRFC3339(val, "BaselineReleaseVersionDate", &i.BaselineReleaseVersionDate) + delete(rawMsg, key) + case "customImageDisplayName": + err = unpopulate(val, "CustomImageDisplayName", &i.CustomImageDisplayName) + delete(rawMsg, key) + case "customImageId": + err = unpopulate(val, "CustomImageID", &i.CustomImageID) + delete(rawMsg, key) + case "upgradeEndTime": + err = unpopulateTimeRFC3339(val, "UpgradeEndTime", &i.UpgradeEndTime) + delete(rawMsg, key) + case "upgradeStartTime": + err = unpopulateTimeRFC3339(val, "UpgradeStartTime", &i.UpgradeStartTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GetFileUploadURLParameters. -func (g GetFileUploadURLParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IntuneEnrollmentMetadata. +func (i IntuneEnrollmentMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "blobName", g.BlobName) + populate(objectMap, "appList", i.AppList) + populate(objectMap, "credentialId", i.CredentialID) + populate(objectMap, "expectedDeploymentDurationInMinute", i.ExpectedDeploymentDurationInMinute) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GetFileUploadURLParameters. -func (g *GetFileUploadURLParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IntuneEnrollmentMetadata. +func (i *IntuneEnrollmentMetadata) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "blobName": - err = unpopulate(val, "BlobName", &g.BlobName) + case "appList": + err = unpopulate(val, "AppList", &i.AppList) + delete(rawMsg, key) + case "credentialId": + err = unpopulate(val, "CredentialID", &i.CredentialID) + delete(rawMsg, key) + case "expectedDeploymentDurationInMinute": + err = unpopulate(val, "ExpectedDeploymentDurationInMinute", &i.ExpectedDeploymentDurationInMinute) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type IdentifiedFailure. -func (i IdentifiedFailure) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IntuneSingletonResourceProperties. +func (i IntuneSingletonResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "category", i.Category) - populate(objectMap, "errorMessage", i.ErrorMessage) - populate(objectMap, "failureId", i.FailureID) - populate(objectMap, "guidance", i.Guidance) + objectMap["credentialType"] = CredentialTypeIntuneAccount + populate(objectMap, "displayName", i.DisplayName) + populate(objectMap, "passwordKeyVaultSecretPath", i.PasswordKeyVaultSecretPath) + populate(objectMap, "userNameKeyVaultSecretPath", i.UserNameKeyVaultSecretPath) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type IdentifiedFailure. -func (i *IdentifiedFailure) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IntuneSingletonResourceProperties. +func (i *IntuneSingletonResourceProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -1416,17 +4322,17 @@ func (i *IdentifiedFailure) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "category": - err = unpopulate(val, "Category", &i.Category) + case "credentialType": + err = unpopulate(val, "CredentialType", &i.CredentialType) delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &i.ErrorMessage) + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) delete(rawMsg, key) - case "failureId": - err = unpopulate(val, "FailureID", &i.FailureID) + case "passwordKeyVaultSecretPath": + err = unpopulate(val, "PasswordKeyVaultSecretPath", &i.PasswordKeyVaultSecretPath) delete(rawMsg, key) - case "guidance": - err = unpopulate(val, "Guidance", &i.Guidance) + case "userNameKeyVaultSecretPath": + err = unpopulate(val, "UserNameKeyVaultSecretPath", &i.UserNameKeyVaultSecretPath) delete(rawMsg, key) } if err != nil { @@ -1608,7 +4514,10 @@ func (o OSUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "buildRevision", o.BuildRevision) populate(objectMap, "buildVersion", o.BuildVersion) + populate(objectMap, "customImageDisplayName", o.CustomImageDisplayName) + populate(objectMap, "customImageId", o.CustomImageID) populate(objectMap, "flightingRing", o.FlightingRing) + populate(objectMap, "inplaceUpgradeBaselineProperties", o.InplaceUpgradeBaselineProperties) populate(objectMap, "osName", o.OSName) populate(objectMap, "release", o.Release) populateTimeRFC3339(objectMap, "releaseVersionDate", o.ReleaseVersionDate) @@ -1631,9 +4540,18 @@ func (o *OSUpdateProperties) UnmarshalJSON(data []byte) error { case "buildVersion": err = unpopulate(val, "BuildVersion", &o.BuildVersion) delete(rawMsg, key) + case "customImageDisplayName": + err = unpopulate(val, "CustomImageDisplayName", &o.CustomImageDisplayName) + delete(rawMsg, key) + case "customImageId": + err = unpopulate(val, "CustomImageID", &o.CustomImageID) + delete(rawMsg, key) case "flightingRing": err = unpopulate(val, "FlightingRing", &o.FlightingRing) delete(rawMsg, key) + case "inplaceUpgradeBaselineProperties": + err = unpopulate(val, "InplaceUpgradeBaselineProperties", &o.InplaceUpgradeBaselineProperties) + delete(rawMsg, key) case "osName": err = unpopulate(val, "OSName", &o.OSName) delete(rawMsg, key) @@ -1702,9 +4620,12 @@ func (o OSUpdateTestSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "buildRevision", o.BuildRevision) populate(objectMap, "buildVersion", o.BuildVersion) + populate(objectMap, "customImageDisplayName", o.CustomImageDisplayName) + populate(objectMap, "customImageId", o.CustomImageID) populate(objectMap, "executionStatus", o.ExecutionStatus) populate(objectMap, "flightingRing", o.FlightingRing) populate(objectMap, "grade", o.Grade) + populate(objectMap, "inplaceUpgradeBaselineProperties", o.InplaceUpgradeBaselineProperties) populate(objectMap, "osName", o.OSName) populate(objectMap, "releaseName", o.ReleaseName) populateTimeRFC3339(objectMap, "releaseVersionDate", o.ReleaseVersionDate) @@ -1729,6 +4650,12 @@ func (o *OSUpdateTestSummary) UnmarshalJSON(data []byte) error { case "buildVersion": err = unpopulate(val, "BuildVersion", &o.BuildVersion) delete(rawMsg, key) + case "customImageDisplayName": + err = unpopulate(val, "CustomImageDisplayName", &o.CustomImageDisplayName) + delete(rawMsg, key) + case "customImageId": + err = unpopulate(val, "CustomImageID", &o.CustomImageID) + delete(rawMsg, key) case "executionStatus": err = unpopulate(val, "ExecutionStatus", &o.ExecutionStatus) delete(rawMsg, key) @@ -1738,6 +4665,9 @@ func (o *OSUpdateTestSummary) UnmarshalJSON(data []byte) error { case "grade": err = unpopulate(val, "Grade", &o.Grade) delete(rawMsg, key) + case "inplaceUpgradeBaselineProperties": + err = unpopulate(val, "InplaceUpgradeBaselineProperties", &o.InplaceUpgradeBaselineProperties) + delete(rawMsg, key) case "osName": err = unpopulate(val, "OSName", &o.OSName) delete(rawMsg, key) @@ -1810,11 +4740,11 @@ func (o *OSUpdatesTestSummary) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) populate(objectMap, "display", o.Display) populate(objectMap, "isDataAction", o.IsDataAction) populate(objectMap, "name", o.Name) populate(objectMap, "origin", o.Origin) - populateAny(objectMap, "properties", o.Properties) return json.Marshal(objectMap) } @@ -1827,6 +4757,9 @@ func (o *Operation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) case "display": err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) @@ -1839,9 +4772,6 @@ func (o *Operation) UnmarshalJSON(data []byte) error { case "origin": err = unpopulate(val, "Origin", &o.Origin) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &o.Properties) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -1920,6 +4850,45 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OsProperties. +func (o OsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customImageDisplayName", o.CustomImageDisplayName) + populate(objectMap, "customImageId", o.CustomImageID) + populate(objectMap, "osName", o.OSName) + populate(objectMap, "releaseProperties", o.ReleaseProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OsProperties. +func (o *OsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customImageDisplayName": + err = unpopulate(val, "CustomImageDisplayName", &o.CustomImageDisplayName) + delete(rawMsg, key) + case "customImageId": + err = unpopulate(val, "CustomImageID", &o.CustomImageID) + delete(rawMsg, key) + case "osName": + err = unpopulate(val, "OSName", &o.OSName) + delete(rawMsg, key) + case "releaseProperties": + err = unpopulate(val, "ReleaseProperties", &o.ReleaseProperties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type PackageCheckNameAvailabilityParameters. func (p PackageCheckNameAvailabilityParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1995,7 +4964,12 @@ func (p PackageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "applicationName", p.ApplicationName) populate(objectMap, "blobPath", p.BlobPath) + populate(objectMap, "draftPackageId", p.DraftPackageID) + populate(objectMap, "firstPartyApps", p.FirstPartyApps) populate(objectMap, "flightingRing", p.FlightingRing) + populate(objectMap, "galleryApps", p.GalleryApps) + populate(objectMap, "inplaceUpgradeOSPair", p.InplaceUpgradeOSPair) + populate(objectMap, "intuneEnrollmentMetadata", p.IntuneEnrollmentMetadata) populate(objectMap, "isEnabled", p.IsEnabled) populateTimeRFC3339(objectMap, "lastModifiedTime", p.LastModifiedTime) populate(objectMap, "packageStatus", p.PackageStatus) @@ -2023,9 +4997,24 @@ func (p *PackageProperties) UnmarshalJSON(data []byte) error { case "blobPath": err = unpopulate(val, "BlobPath", &p.BlobPath) delete(rawMsg, key) + case "draftPackageId": + err = unpopulate(val, "DraftPackageID", &p.DraftPackageID) + delete(rawMsg, key) + case "firstPartyApps": + err = unpopulate(val, "FirstPartyApps", &p.FirstPartyApps) + delete(rawMsg, key) case "flightingRing": err = unpopulate(val, "FlightingRing", &p.FlightingRing) delete(rawMsg, key) + case "galleryApps": + err = unpopulate(val, "GalleryApps", &p.GalleryApps) + delete(rawMsg, key) + case "inplaceUpgradeOSPair": + err = unpopulate(val, "InplaceUpgradeOSPair", &p.InplaceUpgradeOSPair) + delete(rawMsg, key) + case "intuneEnrollmentMetadata": + err = unpopulate(val, "IntuneEnrollmentMetadata", &p.IntuneEnrollmentMetadata) + delete(rawMsg, key) case "isEnabled": err = unpopulate(val, "IsEnabled", &p.IsEnabled) delete(rawMsg, key) @@ -2064,7 +5053,6 @@ func (p *PackageProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PackageResource. func (p PackageResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "etag", p.Etag) populate(objectMap, "id", p.ID) populate(objectMap, "location", p.Location) populate(objectMap, "name", p.Name) @@ -2084,9 +5072,6 @@ func (p *PackageResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "etag": - err = unpopulate(val, "Etag", &p.Etag) - delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) @@ -2116,11 +5101,62 @@ func (p *PackageResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PackageRunTestParameters. +func (p PackageRunTestParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customImageId", p.CustomImageID) + populate(objectMap, "flightingRing", p.FlightingRing) + populate(objectMap, "osName", p.OSName) + populate(objectMap, "osUpdateType", p.OSUpdateType) + populate(objectMap, "releaseName", p.ReleaseName) + populate(objectMap, "testType", p.TestType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageRunTestParameters. +func (p *PackageRunTestParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customImageId": + err = unpopulate(val, "CustomImageID", &p.CustomImageID) + delete(rawMsg, key) + case "flightingRing": + err = unpopulate(val, "FlightingRing", &p.FlightingRing) + delete(rawMsg, key) + case "osName": + err = unpopulate(val, "OSName", &p.OSName) + delete(rawMsg, key) + case "osUpdateType": + err = unpopulate(val, "OSUpdateType", &p.OSUpdateType) + delete(rawMsg, key) + case "releaseName": + err = unpopulate(val, "ReleaseName", &p.ReleaseName) + delete(rawMsg, key) + case "testType": + err = unpopulate(val, "TestType", &p.TestType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type PackageUpdateParameterProperties. func (p PackageUpdateParameterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "blobPath", p.BlobPath) + populate(objectMap, "draftPackageId", p.DraftPackageID) + populate(objectMap, "firstPartyApps", p.FirstPartyApps) populate(objectMap, "flightingRing", p.FlightingRing) + populate(objectMap, "inplaceUpgradeOSPair", p.InplaceUpgradeOSPair) + populate(objectMap, "intuneEnrollmentMetadata", p.IntuneEnrollmentMetadata) populate(objectMap, "isEnabled", p.IsEnabled) populate(objectMap, "targetOSList", p.TargetOSList) populate(objectMap, "tests", p.Tests) @@ -2139,9 +5175,21 @@ func (p *PackageUpdateParameterProperties) UnmarshalJSON(data []byte) error { case "blobPath": err = unpopulate(val, "BlobPath", &p.BlobPath) delete(rawMsg, key) + case "draftPackageId": + err = unpopulate(val, "DraftPackageID", &p.DraftPackageID) + delete(rawMsg, key) + case "firstPartyApps": + err = unpopulate(val, "FirstPartyApps", &p.FirstPartyApps) + delete(rawMsg, key) case "flightingRing": err = unpopulate(val, "FlightingRing", &p.FlightingRing) delete(rawMsg, key) + case "inplaceUpgradeOSPair": + err = unpopulate(val, "InplaceUpgradeOSPair", &p.InplaceUpgradeOSPair) + delete(rawMsg, key) + case "intuneEnrollmentMetadata": + err = unpopulate(val, "IntuneEnrollmentMetadata", &p.IntuneEnrollmentMetadata) + delete(rawMsg, key) case "isEnabled": err = unpopulate(val, "IsEnabled", &p.IsEnabled) delete(rawMsg, key) @@ -2225,11 +5273,71 @@ func (p *PackageValidationResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PreReleaseAccessRequestSpec. +func (p PreReleaseAccessRequestSpec) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "city", p.City) + populate(objectMap, "companyWebsite", p.CompanyWebsite) + populate(objectMap, "countryAndRegion", p.CountryAndRegion) + populate(objectMap, "email", p.Email) + populate(objectMap, "engagements", p.Engagements) + populate(objectMap, "organizationName", p.OrganizationName) + populate(objectMap, "stateOrProvince", p.StateOrProvince) + populate(objectMap, "streetAddress", p.StreetAddress) + populate(objectMap, "zipCode", p.ZipCode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PreReleaseAccessRequestSpec. +func (p *PreReleaseAccessRequestSpec) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "city": + err = unpopulate(val, "City", &p.City) + delete(rawMsg, key) + case "companyWebsite": + err = unpopulate(val, "CompanyWebsite", &p.CompanyWebsite) + delete(rawMsg, key) + case "countryAndRegion": + err = unpopulate(val, "CountryAndRegion", &p.CountryAndRegion) + delete(rawMsg, key) + case "email": + err = unpopulate(val, "Email", &p.Email) + delete(rawMsg, key) + case "engagements": + err = unpopulate(val, "Engagements", &p.Engagements) + delete(rawMsg, key) + case "organizationName": + err = unpopulate(val, "OrganizationName", &p.OrganizationName) + delete(rawMsg, key) + case "stateOrProvince": + err = unpopulate(val, "StateOrProvince", &p.StateOrProvince) + delete(rawMsg, key) + case "streetAddress": + err = unpopulate(val, "StreetAddress", &p.StreetAddress) + delete(rawMsg, key) + case "zipCode": + err = unpopulate(val, "ZipCode", &p.ZipCode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -2249,6 +5357,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -2286,12 +5397,43 @@ func (r *RegressionResult) UnmarshalJSON(data []byte) error { case "diff": err = unpopulate(val, "Diff", &r.Diff) delete(rawMsg, key) - case "fileName": - err = unpopulate(val, "FileName", &r.FileName) - delete(rawMsg, key) - case "grade": - err = unpopulate(val, "Grade", &r.Grade) - delete(rawMsg, key) + case "fileName": + err = unpopulate(val, "FileName", &r.FileName) + delete(rawMsg, key) + case "grade": + err = unpopulate(val, "Grade", &r.Grade) + delete(rawMsg, key) + case "isRegressed": + err = unpopulate(val, "IsRegressed", &r.IsRegressed) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegressionTestDetails. +func (r RegressionTestDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diff", r.Diff) + populate(objectMap, "isRegressed", r.IsRegressed) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegressionTestDetails. +func (r *RegressionTestDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diff": + err = unpopulate(val, "Diff", &r.Diff) + delete(rawMsg, key) case "isRegressed": err = unpopulate(val, "IsRegressed", &r.IsRegressed) delete(rawMsg, key) @@ -2303,16 +5445,18 @@ func (r *RegressionResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RegressionTestDetails. -func (r RegressionTestDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReleaseProperties. +func (r ReleaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "diff", r.Diff) - populate(objectMap, "isRegressed", r.IsRegressed) + populate(objectMap, "buildNumber", r.BuildNumber) + populate(objectMap, "buildRevision", r.BuildRevision) + populate(objectMap, "releaseName", r.ReleaseName) + populateTimeRFC3339(objectMap, "releaseVersionDate", r.ReleaseVersionDate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RegressionTestDetails. -func (r *RegressionTestDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReleaseProperties. +func (r *ReleaseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -2320,11 +5464,17 @@ func (r *RegressionTestDetails) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "diff": - err = unpopulate(val, "Diff", &r.Diff) + case "buildNumber": + err = unpopulate(val, "BuildNumber", &r.BuildNumber) delete(rawMsg, key) - case "isRegressed": - err = unpopulate(val, "IsRegressed", &r.IsRegressed) + case "buildRevision": + err = unpopulate(val, "BuildRevision", &r.BuildRevision) + delete(rawMsg, key) + case "releaseName": + err = unpopulate(val, "ReleaseName", &r.ReleaseName) + delete(rawMsg, key) + case "releaseVersionDate": + err = unpopulateTimeRFC3339(val, "ReleaseVersionDate", &r.ReleaseVersionDate) delete(rawMsg, key) } if err != nil { @@ -2398,6 +5548,7 @@ func (r ReliabilityResultSingletonResourceProperties) MarshalJSON() ([]byte, err objectMap := make(map[string]any) objectMap["analysisResultType"] = AnalysisResultTypeReliability populate(objectMap, "grade", r.Grade) + populate(objectMap, "inplaceUpgradeBaselineReliabilityResults", r.InplaceUpgradeBaselineReliabilityResults) populate(objectMap, "reliabilityResults", r.ReliabilityResults) return json.Marshal(objectMap) } @@ -2417,6 +5568,9 @@ func (r *ReliabilityResultSingletonResourceProperties) UnmarshalJSON(data []byte case "grade": err = unpopulate(val, "Grade", &r.Grade) delete(rawMsg, key) + case "inplaceUpgradeBaselineReliabilityResults": + err = unpopulate(val, "InplaceUpgradeBaselineReliabilityResults", &r.InplaceUpgradeBaselineReliabilityResults) + delete(rawMsg, key) case "reliabilityResults": err = unpopulate(val, "ReliabilityResults", &r.ReliabilityResults) delete(rawMsg, key) @@ -2433,6 +5587,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -2452,6 +5607,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -2470,6 +5628,8 @@ func (s ScriptExecutionResult) MarshalJSON() ([]byte, error) { populate(objectMap, "exitCode", s.ExitCode) populate(objectMap, "scriptName", s.ScriptName) populateTimeRFC3339(objectMap, "startTime", s.StartTime) + populate(objectMap, "stderrLogFileName", s.StderrLogFileName) + populate(objectMap, "stdoutLogFileName", s.StdoutLogFileName) populate(objectMap, "timedOut", s.TimedOut) return json.Marshal(objectMap) } @@ -2495,6 +5655,12 @@ func (s *ScriptExecutionResult) UnmarshalJSON(data []byte) error { case "startTime": err = unpopulateTimeRFC3339(val, "StartTime", &s.StartTime) delete(rawMsg, key) + case "stderrLogFileName": + err = unpopulate(val, "StderrLogFileName", &s.StderrLogFileName) + delete(rawMsg, key) + case "stdoutLogFileName": + err = unpopulate(val, "StdoutLogFileName", &s.StdoutLogFileName) + delete(rawMsg, key) case "timedOut": err = unpopulate(val, "TimedOut", &s.TimedOut) delete(rawMsg, key) @@ -2576,6 +5742,41 @@ func (s *SubscriptionReceiverValue) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SystemAssignedServiceIdentity. +func (s SystemAssignedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", s.PrincipalID) + populate(objectMap, "tenantId", s.TenantID) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemAssignedServiceIdentity. +func (s *SystemAssignedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &s.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &s.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2623,10 +5824,44 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TabState. +func (t TabState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentTab", t.CurrentTab) + populate(objectMap, "visitedTabs", t.VisitedTabs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TabState. +func (t *TabState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentTab": + err = unpopulate(val, "CurrentTab", &t.CurrentTab) + delete(rawMsg, key) + case "visitedTabs": + err = unpopulate(val, "VisitedTabs", &t.VisitedTabs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TargetOSInfo. func (t TargetOSInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "baselineOSs", t.BaselineOSs) + populate(objectMap, "insiderChannelIds", t.InsiderChannelIDs) populate(objectMap, "osUpdateType", t.OSUpdateType) + populate(objectMap, "targetOSImageIds", t.TargetOSImageIDs) populate(objectMap, "targetOSs", t.TargetOSs) return json.Marshal(objectMap) } @@ -2640,9 +5875,18 @@ func (t *TargetOSInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "baselineOSs": + err = unpopulate(val, "BaselineOSs", &t.BaselineOSs) + delete(rawMsg, key) + case "insiderChannelIds": + err = unpopulate(val, "InsiderChannelIDs", &t.InsiderChannelIDs) + delete(rawMsg, key) case "osUpdateType": err = unpopulate(val, "OSUpdateType", &t.OSUpdateType) delete(rawMsg, key) + case "targetOSImageIds": + err = unpopulate(val, "TargetOSImageIDs", &t.TargetOSImageIDs) + delete(rawMsg, key) case "targetOSs": err = unpopulate(val, "TargetOSs", &t.TargetOSs) delete(rawMsg, key) @@ -2660,6 +5904,7 @@ func (t Test) MarshalJSON() ([]byte, error) { populate(objectMap, "commands", t.Commands) populate(objectMap, "isActive", t.IsActive) populate(objectMap, "testType", t.TestType) + populate(objectMap, "validationResultId", t.ValidationResultID) populate(objectMap, "validationRunStatus", t.ValidationRunStatus) return json.Marshal(objectMap) } @@ -2682,6 +5927,9 @@ func (t *Test) UnmarshalJSON(data []byte) error { case "testType": err = unpopulate(val, "TestType", &t.TestType) delete(rawMsg, key) + case "validationResultId": + err = unpopulate(val, "ValidationResultID", &t.ValidationResultID) + delete(rawMsg, key) case "validationRunStatus": err = unpopulate(val, "ValidationRunStatus", &t.ValidationRunStatus) delete(rawMsg, key) @@ -2798,6 +6046,76 @@ func (t *TestResultAnalysisSummary) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TestResultConsoleLogDownloadURLParameters. +func (t TestResultConsoleLogDownloadURLParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logFileName", t.LogFileName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestResultConsoleLogDownloadURLParameters. +func (t *TestResultConsoleLogDownloadURLParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logFileName": + err = unpopulate(val, "LogFileName", &t.LogFileName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TestResultFirstPartyAppDefinition. +func (t TestResultFirstPartyAppDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "architecture", t.Architecture) + populate(objectMap, "channel", t.Channel) + populate(objectMap, "name", t.Name) + populate(objectMap, "ring", t.Ring) + populate(objectMap, "version", t.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TestResultFirstPartyAppDefinition. +func (t *TestResultFirstPartyAppDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "architecture": + err = unpopulate(val, "Architecture", &t.Architecture) + delete(rawMsg, key) + case "channel": + err = unpopulate(val, "Channel", &t.Channel) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "ring": + err = unpopulate(val, "Ring", &t.Ring) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &t.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TestResultListResult. func (t TestResultListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2838,9 +6156,15 @@ func (t TestResultProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "baselineTestResultId", t.BaselineTestResultID) populate(objectMap, "buildRevision", t.BuildRevision) populate(objectMap, "buildVersion", t.BuildVersion) + populate(objectMap, "customImageDisplayName", t.CustomImageDisplayName) + populate(objectMap, "customImageId", t.CustomImageID) populate(objectMap, "executionStatus", t.ExecutionStatus) + populate(objectMap, "firstPartyApps", t.FirstPartyApps) populate(objectMap, "flightingRing", t.FlightingRing) populate(objectMap, "grade", t.Grade) + populate(objectMap, "inplaceUpgradeProperties", t.InplaceUpgradeProperties) + populate(objectMap, "interopMediaType", t.InteropMediaType) + populate(objectMap, "interopMediaVersion", t.InteropMediaVersion) populate(objectMap, "isDownloadDataAvailable", t.IsDownloadDataAvailable) populate(objectMap, "isVideoAvailable", t.IsVideoAvailable) populate(objectMap, "kbNumber", t.KbNumber) @@ -2849,7 +6173,9 @@ func (t TestResultProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "packageVersion", t.PackageVersion) populate(objectMap, "releaseName", t.ReleaseName) populateTimeRFC3339(objectMap, "releaseVersionDate", t.ReleaseVersionDate) + populateTimeRFC3339(objectMap, "testEndTime", t.TestEndTime) populate(objectMap, "testRunTime", t.TestRunTime) + populateTimeRFC3339(objectMap, "testStartTime", t.TestStartTime) populate(objectMap, "testStatus", t.TestStatus) populate(objectMap, "testType", t.TestType) return json.Marshal(objectMap) @@ -2882,15 +6208,33 @@ func (t *TestResultProperties) UnmarshalJSON(data []byte) error { case "buildVersion": err = unpopulate(val, "BuildVersion", &t.BuildVersion) delete(rawMsg, key) + case "customImageDisplayName": + err = unpopulate(val, "CustomImageDisplayName", &t.CustomImageDisplayName) + delete(rawMsg, key) + case "customImageId": + err = unpopulate(val, "CustomImageID", &t.CustomImageID) + delete(rawMsg, key) case "executionStatus": err = unpopulate(val, "ExecutionStatus", &t.ExecutionStatus) delete(rawMsg, key) + case "firstPartyApps": + err = unpopulate(val, "FirstPartyApps", &t.FirstPartyApps) + delete(rawMsg, key) case "flightingRing": err = unpopulate(val, "FlightingRing", &t.FlightingRing) delete(rawMsg, key) case "grade": err = unpopulate(val, "Grade", &t.Grade) delete(rawMsg, key) + case "inplaceUpgradeProperties": + err = unpopulate(val, "InplaceUpgradeProperties", &t.InplaceUpgradeProperties) + delete(rawMsg, key) + case "interopMediaType": + err = unpopulate(val, "InteropMediaType", &t.InteropMediaType) + delete(rawMsg, key) + case "interopMediaVersion": + err = unpopulate(val, "InteropMediaVersion", &t.InteropMediaVersion) + delete(rawMsg, key) case "isDownloadDataAvailable": err = unpopulate(val, "IsDownloadDataAvailable", &t.IsDownloadDataAvailable) delete(rawMsg, key) @@ -2915,9 +6259,15 @@ func (t *TestResultProperties) UnmarshalJSON(data []byte) error { case "releaseVersionDate": err = unpopulateTimeRFC3339(val, "ReleaseVersionDate", &t.ReleaseVersionDate) delete(rawMsg, key) + case "testEndTime": + err = unpopulateTimeRFC3339(val, "TestEndTime", &t.TestEndTime) + delete(rawMsg, key) case "testRunTime": err = unpopulate(val, "TestRunTime", &t.TestRunTime) delete(rawMsg, key) + case "testStartTime": + err = unpopulateTimeRFC3339(val, "TestStartTime", &t.TestStartTime) + delete(rawMsg, key) case "testStatus": err = unpopulate(val, "TestStatus", &t.TestStatus) delete(rawMsg, key) @@ -3014,7 +6364,9 @@ func (t TestSummaryProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "executionStatus", t.ExecutionStatus) populate(objectMap, "featureUpdatesTestSummary", t.FeatureUpdatesTestSummary) populate(objectMap, "grade", t.Grade) + populate(objectMap, "inplaceUpgradesTestSummary", t.InplaceUpgradesTestSummary) populate(objectMap, "packageId", t.PackageID) + populate(objectMap, "packageTags", t.PackageTags) populate(objectMap, "securityUpdatesTestSummary", t.SecurityUpdatesTestSummary) populate(objectMap, "testRunTime", t.TestRunTime) populate(objectMap, "testStatus", t.TestStatus) @@ -3046,9 +6398,15 @@ func (t *TestSummaryProperties) UnmarshalJSON(data []byte) error { case "grade": err = unpopulate(val, "Grade", &t.Grade) delete(rawMsg, key) + case "inplaceUpgradesTestSummary": + err = unpopulate(val, "InplaceUpgradesTestSummary", &t.InplaceUpgradesTestSummary) + delete(rawMsg, key) case "packageId": err = unpopulate(val, "PackageID", &t.PackageID) delete(rawMsg, key) + case "packageTags": + err = unpopulate(val, "PackageTags", &t.PackageTags) + delete(rawMsg, key) case "securityUpdatesTestSummary": err = unpopulate(val, "SecurityUpdatesTestSummary", &t.SecurityUpdatesTestSummary) delete(rawMsg, key) @@ -3216,10 +6574,10 @@ func (t *TestTypeResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TrackedResource. func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "etag", t.Etag) populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -3234,9 +6592,6 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "etag": - err = unpopulate(val, "Etag", &t.Etag) - delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) @@ -3246,6 +6601,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) @@ -3388,6 +6746,205 @@ func (u *UtilizationResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type VHDListResult. +func (v VHDListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", v.NextLink) + populate(objectMap, "value", v.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VHDListResult. +func (v *VHDListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &v.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &v.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VHDProperties. +func (v VHDProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "creationTime", v.CreationTime) + populate(objectMap, "fileName", v.FileName) + populate(objectMap, "fileSize", v.FileSize) + populate(objectMap, "path", v.Path) + populate(objectMap, "provisioningState", v.ProvisioningState) + populate(objectMap, "status", v.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VHDProperties. +func (v *VHDProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "creationTime": + err = unpopulateTimeRFC3339(val, "CreationTime", &v.CreationTime) + delete(rawMsg, key) + case "fileName": + err = unpopulate(val, "FileName", &v.FileName) + delete(rawMsg, key) + case "fileSize": + err = unpopulate(val, "FileSize", &v.FileSize) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &v.Path) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &v.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &v.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VHDResource. +func (v VHDResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", v.ID) + populate(objectMap, "name", v.Name) + populate(objectMap, "properties", v.Properties) + populate(objectMap, "systemData", v.SystemData) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VHDResource. +func (v *VHDResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &v.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &v.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &v.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &v.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VerificationResult. +func (v VerificationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "message", v.Message) + populate(objectMap, "result", v.Result) + populate(objectMap, "verificationName", v.VerificationName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VerificationResult. +func (v *VerificationResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &v.Message) + delete(rawMsg, key) + case "result": + err = unpopulate(val, "Result", &v.Result) + delete(rawMsg, key) + case "verificationName": + err = unpopulate(val, "VerificationName", &v.VerificationName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WingetAppSKUProperties. +func (w WingetAppSKUProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["applicationType"] = ApplicationTypeWinget + populate(objectMap, "license", w.License) + populate(objectMap, "licenseUrl", w.LicenseURL) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "version", w.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WingetAppSKUProperties. +func (w *WingetAppSKUProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationType": + err = unpopulate(val, "ApplicationType", &w.ApplicationType) + delete(rawMsg, key) + case "license": + err = unpopulate(val, "License", &w.License) + delete(rawMsg, key) + case "licenseUrl": + err = unpopulate(val, "LicenseURL", &w.LicenseURL) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &w.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return diff --git a/sdk/resourcemanager/testbase/armtestbase/operations_client.go b/sdk/resourcemanager/testbase/armtestbase/operations_client.go index ebb4b0a4284d..66e468d04d92 100644 --- a/sdk/resourcemanager/testbase/armtestbase/operations_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations of the Microsoft.TestBase provider. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/operations_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/operations_client_example_test.go deleted file mode 100644 index 1280407e19e4..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/operations_client_example_test.go +++ /dev/null @@ -1,73 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/OperationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armtestbase.OperationListResult{ - // Value: []*armtestbase.Operation{ - // { - // Name: to.Ptr("Microsoft.TestBase/testBaseAccounts/read"), - // Display: &armtestbase.OperationDisplay{ - // Description: to.Ptr("View the properties of a Test Base Account."), - // Operation: to.Ptr("View Test Base Account"), - // Provider: to.Ptr("Microsoft Test Base"), - // Resource: to.Ptr("Test Base Account"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.TestBase/testBaseAccounts/write"), - // Display: &armtestbase.OperationDisplay{ - // Description: to.Ptr("Create a new Test Base Account or update the properties of an existing Test Base Account."), - // Operation: to.Ptr("Update Test Base Account"), - // Provider: to.Ptr("Microsoft Test Base"), - // Resource: to.Ptr("Test Base Account"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.TestBase/testBaseAccounts/delete"), - // Display: &armtestbase.OperationDisplay{ - // Description: to.Ptr("Delete a Test Base Account."), - // Operation: to.Ptr("Delete Test Base Account"), - // Provider: to.Ptr("Microsoft Test Base"), - // Resource: to.Ptr("Test Base Account"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/options.go b/sdk/resourcemanager/testbase/armtestbase/options.go new file mode 100644 index 000000000000..17a3eb15afcc --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/options.go @@ -0,0 +1,536 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +// AccountsClientBeginCreateOptions contains the optional parameters for the AccountsClient.BeginCreate method. +type AccountsClientBeginCreateOptions struct { + // The flag indicating if we would like to restore the Test Base Accounts which were soft deleted before. + Restore *bool + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. +type AccountsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientBeginOffboardOptions contains the optional parameters for the AccountsClient.BeginOffboard method. +type AccountsClientBeginOffboardOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientBeginUpdateOptions contains the optional parameters for the AccountsClient.BeginUpdate method. +type AccountsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AccountsClientCheckPackageNameAvailabilityOptions contains the optional parameters for the AccountsClient.CheckPackageNameAvailability +// method. +type AccountsClientCheckPackageNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientGetFileUploadURLOptions contains the optional parameters for the AccountsClient.GetFileUploadURL method. +type AccountsClientGetFileUploadURLOptions struct { + // Parameters supplied to the Test Base Account GetFileUploadURL operation. + Parameters *GetFileUploadURLParameters +} + +// AccountsClientGetOptions contains the optional parameters for the AccountsClient.Get method. +type AccountsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AccountsClientListByResourceGroupOptions contains the optional parameters for the AccountsClient.NewListByResourceGroupPager +// method. +type AccountsClientListByResourceGroupOptions struct { + // The flag indicating if we need to include the Test Base Accounts which were soft deleted before. + GetDeleted *bool +} + +// AccountsClientListBySubscriptionOptions contains the optional parameters for the AccountsClient.NewListBySubscriptionPager +// method. +type AccountsClientListBySubscriptionOptions struct { + // The flag indicating if we need to include the Test Base Accounts which were soft deleted before. + GetDeleted *bool +} + +// ActionRequestsClientDeleteOptions contains the optional parameters for the ActionRequestsClient.Delete method. +type ActionRequestsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ActionRequestsClientGetOptions contains the optional parameters for the ActionRequestsClient.Get method. +type ActionRequestsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ActionRequestsClientListOptions contains the optional parameters for the ActionRequestsClient.NewListPager method. +type ActionRequestsClientListOptions struct { + RequestType *string + + // How many of the sorted items to consider including in the result set. + Top *int32 +} + +// ActionRequestsClientPutOptions contains the optional parameters for the ActionRequestsClient.Put method. +type ActionRequestsClientPutOptions struct { + ActionRequest *ActionRequest +} + +// AnalysisResultsClientGetOptions contains the optional parameters for the AnalysisResultsClient.Get method. +type AnalysisResultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AnalysisResultsClientListOptions contains the optional parameters for the AnalysisResultsClient.NewListPager method. +type AnalysisResultsClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailableInplaceUpgradeOSClientGetOptions contains the optional parameters for the AvailableInplaceUpgradeOSClient.Get +// method. +type AvailableInplaceUpgradeOSClientGetOptions struct { + // placeholder for future optional parameters +} + +// AvailableInplaceUpgradeOSClientListOptions contains the optional parameters for the AvailableInplaceUpgradeOSClient.NewListPager +// method. +type AvailableInplaceUpgradeOSClientListOptions struct { + // placeholder for future optional parameters +} + +// AvailableOSClientGetOptions contains the optional parameters for the AvailableOSClient.Get method. +type AvailableOSClientGetOptions struct { + // placeholder for future optional parameters +} + +// AvailableOSClientListOptions contains the optional parameters for the AvailableOSClient.NewListPager method. +type AvailableOSClientListOptions struct { + // placeholder for future optional parameters +} + +// BillingHubServiceClientGetFreeHourBalanceOptions contains the optional parameters for the BillingHubServiceClient.GetFreeHourBalance +// method. +type BillingHubServiceClientGetFreeHourBalanceOptions struct { + // placeholder for future optional parameters +} + +// BillingHubServiceClientGetUsageOptions contains the optional parameters for the BillingHubServiceClient.GetUsage method. +type BillingHubServiceClientGetUsageOptions struct { + GetUsageRequest *BillingHubGetUsageRequest +} + +// ChatSessionClientBeginChatOptions contains the optional parameters for the ChatSessionClient.BeginChat method. +type ChatSessionClientBeginChatOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ChatSessionsClientGetOptions contains the optional parameters for the ChatSessionsClient.Get method. +type ChatSessionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ChatSessionsClientListOptions contains the optional parameters for the ChatSessionsClient.NewListPager method. +type ChatSessionsClientListOptions struct { + // placeholder for future optional parameters +} + +// CredentialClientGetOptions contains the optional parameters for the CredentialClient.Get method. +type CredentialClientGetOptions struct { + // placeholder for future optional parameters +} + +// CredentialClientListByTestBaseAccountOptions contains the optional parameters for the CredentialClient.NewListByTestBaseAccountPager +// method. +type CredentialClientListByTestBaseAccountOptions struct { + // placeholder for future optional parameters +} + +// CredentialsClientCreateOptions contains the optional parameters for the CredentialsClient.Create method. +type CredentialsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// CredentialsClientDeleteOptions contains the optional parameters for the CredentialsClient.Delete method. +type CredentialsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// CredentialsClientUpdateOptions contains the optional parameters for the CredentialsClient.Update method. +type CredentialsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// CustomImagesClientBeginCreateOptions contains the optional parameters for the CustomImagesClient.BeginCreate method. +type CustomImagesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CustomImagesClientBeginDeleteOptions contains the optional parameters for the CustomImagesClient.BeginDelete method. +type CustomImagesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CustomImagesClientCheckImageNameAvailabilityOptions contains the optional parameters for the CustomImagesClient.CheckImageNameAvailability +// method. +type CustomImagesClientCheckImageNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// CustomImagesClientGetOptions contains the optional parameters for the CustomImagesClient.Get method. +type CustomImagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CustomImagesClientListByTestBaseAccountOptions contains the optional parameters for the CustomImagesClient.NewListByTestBaseAccountPager +// method. +type CustomImagesClientListByTestBaseAccountOptions struct { + // placeholder for future optional parameters +} + +// CustomerEventsClientBeginCreateOptions contains the optional parameters for the CustomerEventsClient.BeginCreate method. +type CustomerEventsClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CustomerEventsClientBeginDeleteOptions contains the optional parameters for the CustomerEventsClient.BeginDelete method. +type CustomerEventsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CustomerEventsClientGetOptions contains the optional parameters for the CustomerEventsClient.Get method. +type CustomerEventsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CustomerEventsClientListByTestBaseAccountOptions contains the optional parameters for the CustomerEventsClient.NewListByTestBaseAccountPager +// method. +type CustomerEventsClientListByTestBaseAccountOptions struct { + // placeholder for future optional parameters +} + +// DraftPackagesClientBeginCopyFromPackageOptions contains the optional parameters for the DraftPackagesClient.BeginCopyFromPackage +// method. +type DraftPackagesClientBeginCopyFromPackageOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DraftPackagesClientBeginExtractFileOptions contains the optional parameters for the DraftPackagesClient.BeginExtractFile +// method. +type DraftPackagesClientBeginExtractFileOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DraftPackagesClientBeginGenerateFoldersAndScriptsOptions contains the optional parameters for the DraftPackagesClient.BeginGenerateFoldersAndScripts +// method. +type DraftPackagesClientBeginGenerateFoldersAndScriptsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DraftPackagesClientCreateOptions contains the optional parameters for the DraftPackagesClient.Create method. +type DraftPackagesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// DraftPackagesClientDeleteOptions contains the optional parameters for the DraftPackagesClient.Delete method. +type DraftPackagesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// DraftPackagesClientGetOptions contains the optional parameters for the DraftPackagesClient.Get method. +type DraftPackagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DraftPackagesClientGetPathOptions contains the optional parameters for the DraftPackagesClient.GetPath method. +type DraftPackagesClientGetPathOptions struct { + // placeholder for future optional parameters +} + +// DraftPackagesClientListByTestBaseAccountOptions contains the optional parameters for the DraftPackagesClient.NewListByTestBaseAccountPager +// method. +type DraftPackagesClientListByTestBaseAccountOptions struct { + // Parameter used to filter draft packages by editPackage property. + EditPackage *bool + + // Parameter used to filter draft packages by linked Test Base Package. + PackageName *string +} + +// DraftPackagesClientUpdateOptions contains the optional parameters for the DraftPackagesClient.Update method. +type DraftPackagesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// EmailEventsClientGetOptions contains the optional parameters for the EmailEventsClient.Get method. +type EmailEventsClientGetOptions struct { + // placeholder for future optional parameters +} + +// EmailEventsClientListOptions contains the optional parameters for the EmailEventsClient.NewListPager method. +type EmailEventsClientListOptions struct { + // placeholder for future optional parameters +} + +// FavoriteProcessesClientCreateOptions contains the optional parameters for the FavoriteProcessesClient.Create method. +type FavoriteProcessesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// FavoriteProcessesClientDeleteOptions contains the optional parameters for the FavoriteProcessesClient.Delete method. +type FavoriteProcessesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// FavoriteProcessesClientGetOptions contains the optional parameters for the FavoriteProcessesClient.Get method. +type FavoriteProcessesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FavoriteProcessesClientListOptions contains the optional parameters for the FavoriteProcessesClient.NewListPager method. +type FavoriteProcessesClientListOptions struct { + // placeholder for future optional parameters +} + +// FeatureUpdateSupportedOsesClientListOptions contains the optional parameters for the FeatureUpdateSupportedOsesClient.NewListPager +// method. +type FeatureUpdateSupportedOsesClientListOptions struct { + // placeholder for future optional parameters +} + +// FirstPartyAppsClientGetOptions contains the optional parameters for the FirstPartyAppsClient.Get method. +type FirstPartyAppsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirstPartyAppsClientListOptions contains the optional parameters for the FirstPartyAppsClient.NewListPager method. +type FirstPartyAppsClientListOptions struct { + // placeholder for future optional parameters +} + +// FlightingRingsClientGetOptions contains the optional parameters for the FlightingRingsClient.Get method. +type FlightingRingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FlightingRingsClientListOptions contains the optional parameters for the FlightingRingsClient.NewListPager method. +type FlightingRingsClientListOptions struct { + // placeholder for future optional parameters +} + +// FreeHourBalancesClientGetOptions contains the optional parameters for the FreeHourBalancesClient.Get method. +type FreeHourBalancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FreeHourBalancesClientListOptions contains the optional parameters for the FreeHourBalancesClient.NewListPager method. +type FreeHourBalancesClientListOptions struct { + // placeholder for future optional parameters +} + +// GalleryAppSKUsClientGetOptions contains the optional parameters for the GalleryAppSKUsClient.Get method. +type GalleryAppSKUsClientGetOptions struct { + // placeholder for future optional parameters +} + +// GalleryAppSKUsClientListOptions contains the optional parameters for the GalleryAppSKUsClient.NewListPager method. +type GalleryAppSKUsClientListOptions struct { + // placeholder for future optional parameters +} + +// GalleryAppsClientGetOptions contains the optional parameters for the GalleryAppsClient.Get method. +type GalleryAppsClientGetOptions struct { + // placeholder for future optional parameters +} + +// GalleryAppsClientListOptions contains the optional parameters for the GalleryAppsClient.NewListPager method. +type GalleryAppsClientListOptions struct { + // The type of the gallery application. + ApplicationType *ApplicationType + + // The keywords which listed results should be related to. + Keyword *string + + // The order of result list. + OrderBy *OrderBy + + // How many of the sorted items to consider including in the result set. + Top *int32 +} + +// ImageDefinitionsClientCreateOptions contains the optional parameters for the ImageDefinitionsClient.Create method. +type ImageDefinitionsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// ImageDefinitionsClientDeleteOptions contains the optional parameters for the ImageDefinitionsClient.Delete method. +type ImageDefinitionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ImageDefinitionsClientGetOptions contains the optional parameters for the ImageDefinitionsClient.Get method. +type ImageDefinitionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ImageDefinitionsClientListByTestBaseAccountOptions contains the optional parameters for the ImageDefinitionsClient.NewListByTestBaseAccountPager +// method. +type ImageDefinitionsClientListByTestBaseAccountOptions struct { + // placeholder for future optional parameters +} + +// OSUpdatesClientGetOptions contains the optional parameters for the OSUpdatesClient.Get method. +type OSUpdatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// OSUpdatesClientListOptions contains the optional parameters for the OSUpdatesClient.NewListPager method. +type OSUpdatesClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PackagesClientBeginCreateOptions contains the optional parameters for the PackagesClient.BeginCreate method. +type PackagesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PackagesClientBeginDeleteOptions contains the optional parameters for the PackagesClient.BeginDelete method. +type PackagesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PackagesClientBeginHardDeleteOptions contains the optional parameters for the PackagesClient.BeginHardDelete method. +type PackagesClientBeginHardDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PackagesClientBeginUpdateOptions contains the optional parameters for the PackagesClient.BeginUpdate method. +type PackagesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PackagesClientGetDownloadURLOptions contains the optional parameters for the PackagesClient.GetDownloadURL method. +type PackagesClientGetDownloadURLOptions struct { + // placeholder for future optional parameters +} + +// PackagesClientGetOptions contains the optional parameters for the PackagesClient.Get method. +type PackagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PackagesClientListByTestBaseAccountOptions contains the optional parameters for the PackagesClient.NewListByTestBaseAccountPager +// method. +type PackagesClientListByTestBaseAccountOptions struct { + // placeholder for future optional parameters +} + +// PackagesClientRunTestOptions contains the optional parameters for the PackagesClient.RunTest method. +type PackagesClientRunTestOptions struct { + // The parameters supplied to the Test Base Package to start a Test Run. + Parameters *PackageRunTestParameters +} + +// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. +type SKUsClientListOptions struct { + // placeholder for future optional parameters +} + +// TestResultsClientGetConsoleLogDownloadURLOptions contains the optional parameters for the TestResultsClient.GetConsoleLogDownloadURL +// method. +type TestResultsClientGetConsoleLogDownloadURLOptions struct { + // placeholder for future optional parameters +} + +// TestResultsClientGetDownloadURLOptions contains the optional parameters for the TestResultsClient.GetDownloadURL method. +type TestResultsClientGetDownloadURLOptions struct { + // placeholder for future optional parameters +} + +// TestResultsClientGetOptions contains the optional parameters for the TestResultsClient.Get method. +type TestResultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TestResultsClientGetVideoDownloadURLOptions contains the optional parameters for the TestResultsClient.GetVideoDownloadURL +// method. +type TestResultsClientGetVideoDownloadURLOptions struct { + // placeholder for future optional parameters +} + +// TestResultsClientListOptions contains the optional parameters for the TestResultsClient.NewListPager method. +type TestResultsClientListOptions struct { + // Odata filter + Filter *string +} + +// TestSummariesClientGetOptions contains the optional parameters for the TestSummariesClient.Get method. +type TestSummariesClientGetOptions struct { + // placeholder for future optional parameters +} + +// TestSummariesClientListOptions contains the optional parameters for the TestSummariesClient.NewListPager method. +type TestSummariesClientListOptions struct { + // placeholder for future optional parameters +} + +// TestTypesClientGetOptions contains the optional parameters for the TestTypesClient.Get method. +type TestTypesClientGetOptions struct { + // placeholder for future optional parameters +} + +// TestTypesClientListOptions contains the optional parameters for the TestTypesClient.NewListPager method. +type TestTypesClientListOptions struct { + // placeholder for future optional parameters +} + +// UsageClientListOptions contains the optional parameters for the UsageClient.NewListPager method. +type UsageClientListOptions struct { + // Odata filter + Filter *string +} + +// VHDsClientDeleteOptions contains the optional parameters for the VHDsClient.Delete method. +type VHDsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// VHDsClientGetOptions contains the optional parameters for the VHDsClient.Get method. +type VHDsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VHDsClientListByTestBaseAccountOptions contains the optional parameters for the VHDsClient.NewListByTestBaseAccountPager +// method. +type VHDsClientListByTestBaseAccountOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/testbase/armtestbase/osupdates_client.go b/sdk/resourcemanager/testbase/armtestbase/osupdates_client.go index d914c9bc1545..55483aa556a0 100644 --- a/sdk/resourcemanager/testbase/armtestbase/osupdates_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/osupdates_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type OSUpdatesClient struct { } // NewOSUpdatesClient creates a new instance of OSUpdatesClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOSUpdatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OSUpdatesClient, error) { @@ -47,33 +46,33 @@ func NewOSUpdatesClient(subscriptionID string, credential azcore.TokenCredential // Get - Gets an OS Update by name in which the package was tested before. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - osUpdateResourceName - The resource name of an OS Update. // - options - OSUpdatesClientGetOptions contains the optional parameters for the OSUpdatesClient.Get method. func (client *OSUpdatesClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, osUpdateResourceName string, options *OSUpdatesClientGetOptions) (OSUpdatesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, osUpdateResourceName, options) if err != nil { return OSUpdatesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OSUpdatesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OSUpdatesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OSUpdatesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *OSUpdatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, osUpdateResourceName string, options *OSUpdatesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates/{osUpdateResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -96,7 +95,7 @@ func (client *OSUpdatesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -113,8 +112,8 @@ func (client *OSUpdatesClient) getHandleResponse(resp *http.Response) (OSUpdates // NewListPager - Lists the OS Updates in which the package were tested before. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - osUpdateType - The type of the OS Update. @@ -150,9 +149,6 @@ func (client *OSUpdatesClient) NewListPager(resourceGroupName string, testBaseAc // listCreateRequest creates the List request. func (client *OSUpdatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, osUpdateType OsUpdateType, options *OSUpdatesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -172,7 +168,7 @@ func (client *OSUpdatesClient) listCreateRequest(ctx context.Context, resourceGr } reqQP := req.Raw().URL.Query() reqQP.Set("osUpdateType", string(osUpdateType)) - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/osupdates_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/osupdates_client_example_test.go deleted file mode 100644 index f76cdc62671e..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/osupdates_client_example_test.go +++ /dev/null @@ -1,110 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/OSUpdatesList.json -func ExampleOSUpdatesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOSUpdatesClient().NewListPager("contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", armtestbase.OsUpdateTypeSecurityUpdate, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OSUpdateListResult = armtestbase.OSUpdateListResult{ - // Value: []*armtestbase.OSUpdateResource{ - // { - // Name: to.Ptr("Windows-10-2004-2020-12-B-505"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/osUpdates"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/osUpdates/Windows-10-2004-2020-12-B-505"), - // Properties: &armtestbase.OSUpdateProperties{ - // Type: to.Ptr(armtestbase.TypeSecurityUpdate), - // BuildRevision: to.Ptr("505"), - // OSName: to.Ptr("Windows 10 2004"), - // Release: to.Ptr("2020.12B"), - // }, - // }, - // { - // Name: to.Ptr("Windows-10-2004-2020-10-B-413"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/osUpdates"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/osUpdates/Windows-10-2004-2020-10-B-413"), - // Properties: &armtestbase.OSUpdateProperties{ - // Type: to.Ptr(armtestbase.TypeSecurityUpdate), - // BuildRevision: to.Ptr("413"), - // OSName: to.Ptr("Windows 10 2004"), - // Release: to.Ptr("2020.10B"), - // }, - // }, - // { - // Name: to.Ptr("Windows-10-2004-2020-08-B-226"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/osUpdates"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/osUpdates/Windows-10-2004-2020-08-B-226"), - // Properties: &armtestbase.OSUpdateProperties{ - // Type: to.Ptr(armtestbase.TypeSecurityUpdate), - // BuildRevision: to.Ptr("226"), - // OSName: to.Ptr("Windows 10 2004"), - // Release: to.Ptr("2020.08B"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/OSUpdateGet.json -func ExampleOSUpdatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOSUpdatesClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-2004-2020-12-B-505", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OSUpdateResource = armtestbase.OSUpdateResource{ - // Name: to.Ptr("Windows-10-2004-2020-12-B-505"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/osUpdates"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/osUpdates/Windows-10-2004-2020-12-B-505"), - // Properties: &armtestbase.OSUpdateProperties{ - // Type: to.Ptr(armtestbase.TypeSecurityUpdate), - // BuildRevision: to.Ptr("505"), - // OSName: to.Ptr("Windows 10 2004"), - // Release: to.Ptr("2020.12B"), - // }, - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/packages_client.go b/sdk/resourcemanager/testbase/armtestbase/packages_client.go index be3b52971604..a85ac092e3e5 100644 --- a/sdk/resourcemanager/testbase/armtestbase/packages_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/packages_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type PackagesClient struct { } // NewPackagesClient creates a new instance of PackagesClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPackagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PackagesClient, error) { @@ -47,8 +46,8 @@ func NewPackagesClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - parameters - Parameters supplied to create a Test Base Package. @@ -59,9 +58,10 @@ func (client *PackagesClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PackagesClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PackagesClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PackagesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,28 +70,27 @@ func (client *PackagesClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview func (client *PackagesClient) create(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, parameters PackageResource, options *PackagesClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. func (client *PackagesClient) createCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, parameters PackageResource, options *PackagesClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -110,17 +109,20 @@ func (client *PackagesClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - options - PackagesClientBeginDeleteOptions contains the optional parameters for the PackagesClient.BeginDelete method. @@ -130,9 +132,10 @@ func (client *PackagesClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PackagesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PackagesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PackagesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,28 +144,27 @@ func (client *PackagesClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview func (client *PackagesClient) deleteOperation(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *PackagesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. func (client *PackagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *PackagesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -181,7 +183,7 @@ func (client *PackagesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,32 +192,32 @@ func (client *PackagesClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets a Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - options - PackagesClientGetOptions contains the optional parameters for the PackagesClient.Get method. func (client *PackagesClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *PackagesClientGetOptions) (PackagesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, options) if err != nil { return PackagesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PackagesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PackagesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PackagesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *PackagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *PackagesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -234,7 +236,7 @@ func (client *PackagesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,32 +254,32 @@ func (client *PackagesClient) getHandleResponse(resp *http.Response) (PackagesCl // GetDownloadURL - Gets the download URL of a package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - options - PackagesClientGetDownloadURLOptions contains the optional parameters for the PackagesClient.GetDownloadURL method. func (client *PackagesClient) GetDownloadURL(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *PackagesClientGetDownloadURLOptions) (PackagesClientGetDownloadURLResponse, error) { + var err error req, err := client.getDownloadURLCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, options) if err != nil { return PackagesClientGetDownloadURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PackagesClientGetDownloadURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PackagesClientGetDownloadURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PackagesClientGetDownloadURLResponse{}, err } - return client.getDownloadURLHandleResponse(resp) + resp, err := client.getDownloadURLHandleResponse(httpResp) + return resp, err } // getDownloadURLCreateRequest creates the GetDownloadURL request. func (client *PackagesClient) getDownloadURLCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *PackagesClientGetDownloadURLOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/getDownloadUrl" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -296,7 +298,7 @@ func (client *PackagesClient) getDownloadURLCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -314,8 +316,8 @@ func (client *PackagesClient) getDownloadURLHandleResponse(resp *http.Response) // BeginHardDelete - Hard Delete a Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - options - PackagesClientBeginHardDeleteOptions contains the optional parameters for the PackagesClient.BeginHardDelete @@ -326,9 +328,10 @@ func (client *PackagesClient) BeginHardDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PackagesClientHardDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PackagesClientHardDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PackagesClientHardDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -337,28 +340,27 @@ func (client *PackagesClient) BeginHardDelete(ctx context.Context, resourceGroup // HardDelete - Hard Delete a Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview func (client *PackagesClient) hardDelete(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *PackagesClientBeginHardDeleteOptions) (*http.Response, error) { + var err error req, err := client.hardDeleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // hardDeleteCreateRequest creates the HardDelete request. func (client *PackagesClient) hardDeleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *PackagesClientBeginHardDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -377,7 +379,7 @@ func (client *PackagesClient) hardDeleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,8 +387,8 @@ func (client *PackagesClient) hardDeleteCreateRequest(ctx context.Context, resou // NewListByTestBaseAccountPager - Lists all the packages under a Test Base Account. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - PackagesClientListByTestBaseAccountOptions contains the optional parameters for the PackagesClient.NewListByTestBaseAccountPager // method. @@ -421,9 +423,6 @@ func (client *PackagesClient) NewListByTestBaseAccountPager(resourceGroupName st // listByTestBaseAccountCreateRequest creates the ListByTestBaseAccount request. func (client *PackagesClient) listByTestBaseAccountCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *PackagesClientListByTestBaseAccountOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -438,7 +437,7 @@ func (client *PackagesClient) listByTestBaseAccountCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -453,11 +452,82 @@ func (client *PackagesClient) listByTestBaseAccountHandleResponse(resp *http.Res return result, nil } +// RunTest - Trigger a test run on the package. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - packageName - The resource name of the Test Base Package. +// - options - PackagesClientRunTestOptions contains the optional parameters for the PackagesClient.RunTest method. +func (client *PackagesClient) RunTest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *PackagesClientRunTestOptions) (PackagesClientRunTestResponse, error) { + var err error + req, err := client.runTestCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, options) + if err != nil { + return PackagesClientRunTestResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PackagesClientRunTestResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return PackagesClientRunTestResponse{}, err + } + resp, err := client.runTestHandleResponse(httpResp) + return resp, err +} + +// runTestCreateRequest creates the RunTest request. +func (client *PackagesClient) runTestCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, options *PackagesClientRunTestOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/runTest" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if packageName == "" { + return nil, errors.New("parameter packageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageName}", url.PathEscape(packageName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Parameters != nil { + if err := runtime.MarshalAsJSON(req, *options.Parameters); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// runTestHandleResponse handles the RunTest response. +func (client *PackagesClient) runTestHandleResponse(resp *http.Response) (PackagesClientRunTestResponse, error) { + result := PackagesClientRunTestResponse{} + if val := resp.Header.Get("Azure-AsyncOperation"); val != "" { + result.AzureAsyncOperation = &val + } + if val := resp.Header.Get("Location"); val != "" { + result.Location = &val + } + return result, nil +} + // BeginUpdate - Update an existing Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - parameters - Parameters supplied to update a Test Base Package. @@ -468,9 +538,10 @@ func (client *PackagesClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PackagesClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PackagesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PackagesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -479,28 +550,27 @@ func (client *PackagesClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Update an existing Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview func (client *PackagesClient) update(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, parameters PackageUpdateParameters, options *PackagesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. func (client *PackagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, parameters PackageUpdateParameters, options *PackagesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -519,8 +589,11 @@ func (client *PackagesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/testbase/armtestbase/packages_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/packages_client_example_test.go deleted file mode 100644 index 7b1fe634fb76..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/packages_client_example_test.go +++ /dev/null @@ -1,812 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/PackagesList.json -func ExamplePackagesClient_NewListByTestBaseAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPackagesClient().NewListByTestBaseAccountPager("contoso-rg1", "contoso-testBaseAccount1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PackageListResult = armtestbase.PackageListResult{ - // Value: []*armtestbase.PackageResource{ - // { - // Name: to.Ptr("contoso-package1"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package1"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.PackageProperties{ - // ApplicationName: to.Ptr("contoso-package1"), - // BlobPath: to.Ptr("storageAccountPath/package.zip"), - // FlightingRing: to.Ptr("Insider Beta Channel"), - // IsEnabled: to.Ptr(true), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // PackageStatus: to.Ptr(armtestbase.PackageStatusReady), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // TargetOSList: []*armtestbase.TargetOSInfo{ - // { - // OSUpdateType: to.Ptr("Security updates"), - // TargetOSs: []*string{ - // to.Ptr("Windows 10 2004"), - // to.Ptr("Windows 10 1903")}, - // }, - // { - // OSUpdateType: to.Ptr("Feature updates"), - // TargetOSs: []*string{ - // to.Ptr("Windows 10 2004"), - // to.Ptr("Windows 10 1903"), - // to.Ptr("Windows 10 1809")}, - // }}, - // TestTypes: []*armtestbase.TestType{ - // to.Ptr(armtestbase.TestTypeOutOfBoxTest), - // to.Ptr(armtestbase.TestTypeFunctionalTest)}, - // Tests: []*armtestbase.Test{ - // { - // IsActive: to.Ptr(true), - // TestType: to.Ptr(armtestbase.TestTypeOutOfBoxTest), - // ValidationRunStatus: to.Ptr(armtestbase.ValidationRunStatusPassed), - // Commands: []*armtestbase.Command{ - // { - // Name: to.Ptr("Install"), - // Action: to.Ptr(armtestbase.ActionInstall), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/install/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(true), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Launch"), - // Action: to.Ptr(armtestbase.ActionLaunch), - // AlwaysRun: to.Ptr(false), - // ApplyUpdateBefore: to.Ptr(true), - // Content: to.Ptr("app/scripts/launch/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Close"), - // Action: to.Ptr(armtestbase.ActionClose), - // AlwaysRun: to.Ptr(false), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/close/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Uninstall"), - // Action: to.Ptr(armtestbase.ActionUninstall), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/uninstall/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }}, - // }, - // { - // IsActive: to.Ptr(true), - // TestType: to.Ptr(armtestbase.TestTypeFunctionalTest), - // ValidationRunStatus: to.Ptr(armtestbase.ValidationRunStatusPassed), - // Commands: []*armtestbase.Command{ - // { - // Name: to.Ptr("Custom1"), - // Action: to.Ptr(armtestbase.ActionCustom), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/custom/custom1.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Custom2"), - // Action: to.Ptr(armtestbase.ActionCustom), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(true), - // Content: to.Ptr("app/scripts/custom/custom2.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }}, - // }}, - // ValidationResults: []*armtestbase.PackageValidationResult{ - // { - // IsValid: to.Ptr(true), - // ValidationName: to.Ptr("Syntax Validation"), - // }, - // { - // IsValid: to.Ptr(true), - // ValidationName: to.Ptr("Package Run Validation"), - // }}, - // Version: to.Ptr("1.0.0"), - // }, - // }, - // { - // Name: to.Ptr("contoso-package2"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.PackageProperties{ - // ApplicationName: to.Ptr("contoso-package2"), - // BlobPath: to.Ptr("storageAccountPath/package.zip"), - // FlightingRing: to.Ptr("Insider Beta Channel"), - // IsEnabled: to.Ptr(true), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // PackageStatus: to.Ptr(armtestbase.PackageStatusReady), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // TargetOSList: []*armtestbase.TargetOSInfo{ - // { - // OSUpdateType: to.Ptr("Security updates"), - // TargetOSs: []*string{ - // to.Ptr("Windows 10 2004"), - // to.Ptr("Windows 10 1903")}, - // }}, - // TestTypes: []*armtestbase.TestType{ - // to.Ptr(armtestbase.TestTypeOutOfBoxTest)}, - // Tests: []*armtestbase.Test{ - // { - // IsActive: to.Ptr(true), - // TestType: to.Ptr(armtestbase.TestTypeOutOfBoxTest), - // ValidationRunStatus: to.Ptr(armtestbase.ValidationRunStatusPassed), - // Commands: []*armtestbase.Command{ - // { - // Name: to.Ptr("Install"), - // Action: to.Ptr(armtestbase.ActionInstall), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/install/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(true), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Launch"), - // Action: to.Ptr(armtestbase.ActionLaunch), - // AlwaysRun: to.Ptr(false), - // ApplyUpdateBefore: to.Ptr(true), - // Content: to.Ptr("app/scripts/launch/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Close"), - // Action: to.Ptr(armtestbase.ActionClose), - // AlwaysRun: to.Ptr(false), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/close/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Uninstall"), - // Action: to.Ptr(armtestbase.ActionUninstall), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/uninstall/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }}, - // }}, - // ValidationResults: []*armtestbase.PackageValidationResult{ - // { - // IsValid: to.Ptr(true), - // ValidationName: to.Ptr("Syntax Validation"), - // }, - // { - // IsValid: to.Ptr(true), - // ValidationName: to.Ptr("Package Run Validation"), - // }}, - // Version: to.Ptr("1.0.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/PackageCreate.json -func ExamplePackagesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPackagesClient().BeginCreate(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", armtestbase.PackageResource{ - Location: to.Ptr("westus"), - Tags: map[string]*string{}, - Properties: &armtestbase.PackageProperties{ - ApplicationName: to.Ptr("contoso-package2"), - BlobPath: to.Ptr("storageAccountPath/package.zip"), - FlightingRing: to.Ptr("Insider Beta Channel"), - TargetOSList: []*armtestbase.TargetOSInfo{ - { - OSUpdateType: to.Ptr("Security updates"), - TargetOSs: []*string{ - to.Ptr("Windows 10 2004"), - to.Ptr("Windows 10 1903")}, - }}, - Tests: []*armtestbase.Test{ - { - IsActive: to.Ptr(true), - TestType: to.Ptr(armtestbase.TestTypeOutOfBoxTest), - Commands: []*armtestbase.Command{ - { - Name: to.Ptr("Install"), - Action: to.Ptr(armtestbase.ActionInstall), - AlwaysRun: to.Ptr(true), - ApplyUpdateBefore: to.Ptr(false), - Content: to.Ptr("app/scripts/install/job.ps1"), - ContentType: to.Ptr(armtestbase.ContentTypePath), - MaxRunTime: to.Ptr[int32](1800), - RestartAfter: to.Ptr(true), - RunAsInteractive: to.Ptr(true), - RunElevated: to.Ptr(true), - }, - { - Name: to.Ptr("Launch"), - Action: to.Ptr(armtestbase.ActionLaunch), - AlwaysRun: to.Ptr(false), - ApplyUpdateBefore: to.Ptr(true), - Content: to.Ptr("app/scripts/launch/job.ps1"), - ContentType: to.Ptr(armtestbase.ContentTypePath), - MaxRunTime: to.Ptr[int32](1800), - RestartAfter: to.Ptr(false), - RunAsInteractive: to.Ptr(true), - RunElevated: to.Ptr(true), - }, - { - Name: to.Ptr("Close"), - Action: to.Ptr(armtestbase.ActionClose), - AlwaysRun: to.Ptr(false), - ApplyUpdateBefore: to.Ptr(false), - Content: to.Ptr("app/scripts/close/job.ps1"), - ContentType: to.Ptr(armtestbase.ContentTypePath), - MaxRunTime: to.Ptr[int32](1800), - RestartAfter: to.Ptr(false), - RunAsInteractive: to.Ptr(true), - RunElevated: to.Ptr(true), - }, - { - Name: to.Ptr("Uninstall"), - Action: to.Ptr(armtestbase.ActionUninstall), - AlwaysRun: to.Ptr(true), - ApplyUpdateBefore: to.Ptr(false), - Content: to.Ptr("app/scripts/uninstall/job.ps1"), - ContentType: to.Ptr(armtestbase.ContentTypePath), - MaxRunTime: to.Ptr[int32](1800), - RestartAfter: to.Ptr(false), - RunAsInteractive: to.Ptr(true), - RunElevated: to.Ptr(true), - }}, - }}, - Version: to.Ptr("1.0.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PackageResource = armtestbase.PackageResource{ - // Name: to.Ptr("contoso-package2"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.PackageProperties{ - // ApplicationName: to.Ptr("contoso-package2"), - // BlobPath: to.Ptr("storageAccountPath/package.zip"), - // FlightingRing: to.Ptr("Insider Beta Channel"), - // IsEnabled: to.Ptr(true), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // PackageStatus: to.Ptr(armtestbase.PackageStatusReady), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // TargetOSList: []*armtestbase.TargetOSInfo{ - // { - // OSUpdateType: to.Ptr("Security updates"), - // TargetOSs: []*string{ - // to.Ptr("Windows 10 2004"), - // to.Ptr("Windows 10 1903")}, - // }}, - // TestTypes: []*armtestbase.TestType{ - // to.Ptr(armtestbase.TestTypeOutOfBoxTest)}, - // Tests: []*armtestbase.Test{ - // { - // IsActive: to.Ptr(true), - // TestType: to.Ptr(armtestbase.TestTypeOutOfBoxTest), - // ValidationRunStatus: to.Ptr(armtestbase.ValidationRunStatusPassed), - // Commands: []*armtestbase.Command{ - // { - // Name: to.Ptr("Install"), - // Action: to.Ptr(armtestbase.ActionInstall), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/install/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(true), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Launch"), - // Action: to.Ptr(armtestbase.ActionLaunch), - // AlwaysRun: to.Ptr(false), - // ApplyUpdateBefore: to.Ptr(true), - // Content: to.Ptr("app/scripts/launch/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Close"), - // Action: to.Ptr(armtestbase.ActionClose), - // AlwaysRun: to.Ptr(false), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/close/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Uninstall"), - // Action: to.Ptr(armtestbase.ActionUninstall), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/uninstall/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }}, - // }}, - // ValidationResults: []*armtestbase.PackageValidationResult{ - // { - // IsValid: to.Ptr(true), - // ValidationName: to.Ptr("Syntax Validation"), - // }, - // { - // IsValid: to.Ptr(true), - // ValidationName: to.Ptr("Package Run Validation"), - // }}, - // Version: to.Ptr("1.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/PackageUpdate.json -func ExamplePackagesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPackagesClient().BeginUpdate(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", armtestbase.PackageUpdateParameters{ - Properties: &armtestbase.PackageUpdateParameterProperties{ - BlobPath: to.Ptr("storageAccountPath/package.zip"), - FlightingRing: to.Ptr("Insider Beta Channel"), - IsEnabled: to.Ptr(false), - TargetOSList: []*armtestbase.TargetOSInfo{ - { - OSUpdateType: to.Ptr("Security updates"), - TargetOSs: []*string{ - to.Ptr("Windows 10 2004"), - to.Ptr("Windows 10 1903")}, - }}, - Tests: []*armtestbase.Test{ - { - IsActive: to.Ptr(true), - TestType: to.Ptr(armtestbase.TestTypeOutOfBoxTest), - Commands: []*armtestbase.Command{ - { - Name: to.Ptr("Install"), - Action: to.Ptr(armtestbase.ActionInstall), - AlwaysRun: to.Ptr(true), - ApplyUpdateBefore: to.Ptr(false), - Content: to.Ptr("app/scripts/install/job.ps1"), - ContentType: to.Ptr(armtestbase.ContentTypePath), - MaxRunTime: to.Ptr[int32](1800), - RestartAfter: to.Ptr(true), - RunAsInteractive: to.Ptr(true), - RunElevated: to.Ptr(true), - }, - { - Name: to.Ptr("Launch"), - Action: to.Ptr(armtestbase.ActionLaunch), - AlwaysRun: to.Ptr(false), - ApplyUpdateBefore: to.Ptr(true), - Content: to.Ptr("app/scripts/launch/job.ps1"), - ContentType: to.Ptr(armtestbase.ContentTypePath), - MaxRunTime: to.Ptr[int32](1800), - RestartAfter: to.Ptr(false), - RunAsInteractive: to.Ptr(true), - RunElevated: to.Ptr(true), - }, - { - Name: to.Ptr("Close"), - Action: to.Ptr(armtestbase.ActionClose), - AlwaysRun: to.Ptr(false), - ApplyUpdateBefore: to.Ptr(false), - Content: to.Ptr("app/scripts/close/job.ps1"), - ContentType: to.Ptr(armtestbase.ContentTypePath), - MaxRunTime: to.Ptr[int32](1800), - RestartAfter: to.Ptr(false), - RunAsInteractive: to.Ptr(true), - RunElevated: to.Ptr(true), - }, - { - Name: to.Ptr("Uninstall"), - Action: to.Ptr(armtestbase.ActionUninstall), - AlwaysRun: to.Ptr(true), - ApplyUpdateBefore: to.Ptr(false), - Content: to.Ptr("app/scripts/uninstall/job.ps1"), - ContentType: to.Ptr(armtestbase.ContentTypePath), - MaxRunTime: to.Ptr[int32](1800), - RestartAfter: to.Ptr(false), - RunAsInteractive: to.Ptr(true), - RunElevated: to.Ptr(true), - }}, - }}, - }, - Tags: map[string]*string{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PackageResource = armtestbase.PackageResource{ - // Name: to.Ptr("contoso-package2"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.PackageProperties{ - // ApplicationName: to.Ptr("contoso-package2"), - // BlobPath: to.Ptr("storageAccountPath/package.zip"), - // FlightingRing: to.Ptr("Insider Beta Channel"), - // IsEnabled: to.Ptr(false), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // PackageStatus: to.Ptr(armtestbase.PackageStatusReady), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // TargetOSList: []*armtestbase.TargetOSInfo{ - // { - // OSUpdateType: to.Ptr("Security updates"), - // TargetOSs: []*string{ - // to.Ptr("Windows 10 2004"), - // to.Ptr("Windows 10 1903")}, - // }}, - // TestTypes: []*armtestbase.TestType{ - // to.Ptr(armtestbase.TestTypeOutOfBoxTest)}, - // Tests: []*armtestbase.Test{ - // { - // IsActive: to.Ptr(true), - // TestType: to.Ptr(armtestbase.TestTypeOutOfBoxTest), - // ValidationRunStatus: to.Ptr(armtestbase.ValidationRunStatusPassed), - // Commands: []*armtestbase.Command{ - // { - // Name: to.Ptr("Install"), - // Action: to.Ptr(armtestbase.ActionInstall), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/install/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(true), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Launch"), - // Action: to.Ptr(armtestbase.ActionLaunch), - // AlwaysRun: to.Ptr(false), - // ApplyUpdateBefore: to.Ptr(true), - // Content: to.Ptr("app/scripts/launch/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Close"), - // Action: to.Ptr(armtestbase.ActionClose), - // AlwaysRun: to.Ptr(false), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/close/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Uninstall"), - // Action: to.Ptr(armtestbase.ActionUninstall), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/uninstall/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }}, - // }}, - // ValidationResults: []*armtestbase.PackageValidationResult{ - // { - // IsValid: to.Ptr(true), - // ValidationName: to.Ptr("Syntax Validation"), - // }, - // { - // IsValid: to.Ptr(true), - // ValidationName: to.Ptr("Package Run Validation"), - // }}, - // Version: to.Ptr("1.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/PackageDelete.json -func ExamplePackagesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPackagesClient().BeginDelete(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/PackageGet.json -func ExamplePackagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPackagesClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PackageResource = armtestbase.PackageResource{ - // Name: to.Ptr("contoso-package2"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Properties: &armtestbase.PackageProperties{ - // ApplicationName: to.Ptr("contoso-package2"), - // BlobPath: to.Ptr("storageAccountPath/package.zip"), - // FlightingRing: to.Ptr("Insider Beta Channel"), - // IsEnabled: to.Ptr(true), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // PackageStatus: to.Ptr(armtestbase.PackageStatusReady), - // ProvisioningState: to.Ptr(armtestbase.ProvisioningStateSucceeded), - // TargetOSList: []*armtestbase.TargetOSInfo{ - // { - // OSUpdateType: to.Ptr("Security updates"), - // TargetOSs: []*string{ - // to.Ptr("Windows 10 2004"), - // to.Ptr("Windows 10 1903")}, - // }}, - // TestTypes: []*armtestbase.TestType{ - // to.Ptr(armtestbase.TestTypeOutOfBoxTest)}, - // Tests: []*armtestbase.Test{ - // { - // IsActive: to.Ptr(true), - // TestType: to.Ptr(armtestbase.TestTypeOutOfBoxTest), - // ValidationRunStatus: to.Ptr(armtestbase.ValidationRunStatusPassed), - // Commands: []*armtestbase.Command{ - // { - // Name: to.Ptr("Install"), - // Action: to.Ptr(armtestbase.ActionInstall), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/install/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(true), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Launch"), - // Action: to.Ptr(armtestbase.ActionLaunch), - // AlwaysRun: to.Ptr(false), - // ApplyUpdateBefore: to.Ptr(true), - // Content: to.Ptr("app/scripts/launch/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Close"), - // Action: to.Ptr(armtestbase.ActionClose), - // AlwaysRun: to.Ptr(false), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/close/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Uninstall"), - // Action: to.Ptr(armtestbase.ActionUninstall), - // AlwaysRun: to.Ptr(true), - // ApplyUpdateBefore: to.Ptr(false), - // Content: to.Ptr("app/scripts/uninstall/job.ps1"), - // ContentType: to.Ptr(armtestbase.ContentTypePath), - // MaxRunTime: to.Ptr[int32](1800), - // RestartAfter: to.Ptr(false), - // RunAsInteractive: to.Ptr(true), - // RunElevated: to.Ptr(true), - // }}, - // }}, - // ValidationResults: []*armtestbase.PackageValidationResult{ - // { - // IsValid: to.Ptr(true), - // ValidationName: to.Ptr("Syntax Validation"), - // }, - // { - // IsValid: to.Ptr(true), - // ValidationName: to.Ptr("Package Run Validation"), - // }}, - // Version: to.Ptr("1.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/PackageHardDelete.json -func ExamplePackagesClient_BeginHardDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPackagesClient().BeginHardDelete(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/PackageGetDownloadURL.json -func ExamplePackagesClient_GetDownloadURL() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPackagesClient().GetDownloadURL(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DownloadURLResponse = armtestbase.DownloadURLResponse{ - // DownloadURL: to.Ptr("some URL"), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-10T06:00:00Z"); return t}()), - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/polymorphic_helpers.go b/sdk/resourcemanager/testbase/armtestbase/polymorphic_helpers.go index 6ce1935bb832..6de46a5a9c23 100644 --- a/sdk/resourcemanager/testbase/armtestbase/polymorphic_helpers.go +++ b/sdk/resourcemanager/testbase/armtestbase/polymorphic_helpers.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -38,5 +37,50 @@ func unmarshalAnalysisResultSingletonResourcePropertiesClassification(rawMsg jso default: b = &AnalysisResultSingletonResourceProperties{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalCredentialPropertiesClassification(rawMsg json.RawMessage) (CredentialPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b CredentialPropertiesClassification + switch m["credentialType"] { + case string(CredentialTypeIntuneAccount): + b = &IntuneSingletonResourceProperties{} + default: + b = &CredentialProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalGalleryAppSKUPropertiesClassification(rawMsg json.RawMessage) (GalleryAppSKUPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b GalleryAppSKUPropertiesClassification + switch m["applicationType"] { + case string(ApplicationTypeWinget): + b = &WingetAppSKUProperties{} + default: + b = &GalleryAppSKUProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } diff --git a/sdk/resourcemanager/testbase/armtestbase/response_types.go b/sdk/resourcemanager/testbase/armtestbase/response_types.go index 340c6bc4d728..fa4e595e9e9d 100644 --- a/sdk/resourcemanager/testbase/armtestbase/response_types.go +++ b/sdk/resourcemanager/testbase/armtestbase/response_types.go @@ -3,19 +3,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase // AccountsClientCheckPackageNameAvailabilityResponse contains the response from method AccountsClient.CheckPackageNameAvailability. type AccountsClientCheckPackageNameAvailabilityResponse struct { + // Description of a Check Name availability response properties. CheckNameAvailabilityResult } // AccountsClientCreateResponse contains the response from method AccountsClient.BeginCreate. type AccountsClientCreateResponse struct { + // The Test Base Account resource. AccountResource } @@ -26,21 +27,25 @@ type AccountsClientDeleteResponse struct { // AccountsClientGetFileUploadURLResponse contains the response from method AccountsClient.GetFileUploadURL. type AccountsClientGetFileUploadURLResponse struct { + // The URL response FileUploadURLResponse } // AccountsClientGetResponse contains the response from method AccountsClient.Get. type AccountsClientGetResponse struct { + // The Test Base Account resource. AccountResource } // AccountsClientListByResourceGroupResponse contains the response from method AccountsClient.NewListByResourceGroupPager. type AccountsClientListByResourceGroupResponse struct { + // A list of Test Base Accounts. AccountListResult } // AccountsClientListBySubscriptionResponse contains the response from method AccountsClient.NewListBySubscriptionPager. type AccountsClientListBySubscriptionResponse struct { + // A list of Test Base Accounts. AccountListResult } @@ -51,31 +56,155 @@ type AccountsClientOffboardResponse struct { // AccountsClientUpdateResponse contains the response from method AccountsClient.BeginUpdate. type AccountsClientUpdateResponse struct { + // The Test Base Account resource. AccountResource } +// ActionRequestsClientDeleteResponse contains the response from method ActionRequestsClient.Delete. +type ActionRequestsClientDeleteResponse struct { + // placeholder for future response values +} + +// ActionRequestsClientGetResponse contains the response from method ActionRequestsClient.Get. +type ActionRequestsClientGetResponse struct { + ActionRequest +} + +// ActionRequestsClientListResponse contains the response from method ActionRequestsClient.NewListPager. +type ActionRequestsClientListResponse struct { + ActionRequests +} + +// ActionRequestsClientPutResponse contains the response from method ActionRequestsClient.Put. +type ActionRequestsClientPutResponse struct { + ActionRequest +} + // AnalysisResultsClientGetResponse contains the response from method AnalysisResultsClient.Get. type AnalysisResultsClientGetResponse struct { + // The Analysis Result Singleton Resource. AnalysisResultSingletonResource } // AnalysisResultsClientListResponse contains the response from method AnalysisResultsClient.NewListPager. type AnalysisResultsClientListResponse struct { + // A list of Analysis Results. It will only contain one element as all the data will be nested in a singleton object. AnalysisResultListResult } +// AvailableInplaceUpgradeOSClientGetResponse contains the response from method AvailableInplaceUpgradeOSClient.Get. +type AvailableInplaceUpgradeOSClientGetResponse struct { + // The Available In-place Upgrade OS Map resource. + AvailableInplaceUpgradeOSResource +} + +// AvailableInplaceUpgradeOSClientListResponse contains the response from method AvailableInplaceUpgradeOSClient.NewListPager. +type AvailableInplaceUpgradeOSClientListResponse struct { + // A list of available In-place Upgrade OSs. + AvailableInplaceUpgradeOSListResult +} + // AvailableOSClientGetResponse contains the response from method AvailableOSClient.Get. type AvailableOSClientGetResponse struct { + // The Available OS resource. AvailableOSResource } // AvailableOSClientListResponse contains the response from method AvailableOSClient.NewListPager. type AvailableOSClientListResponse struct { + // A list of available OSs. AvailableOSListResult } +// BillingHubServiceClientGetFreeHourBalanceResponse contains the response from method BillingHubServiceClient.GetFreeHourBalance. +type BillingHubServiceClientGetFreeHourBalanceResponse struct { + BillingHubGetFreeHourBalanceResponse +} + +// BillingHubServiceClientGetUsageResponse contains the response from method BillingHubServiceClient.GetUsage. +type BillingHubServiceClientGetUsageResponse struct { + BillingHubGetUsageResponse +} + +// ChatSessionClientChatResponse contains the response from method ChatSessionClient.BeginChat. +type ChatSessionClientChatResponse struct { + // The chat response payload. + ChatResponse +} + +// ChatSessionsClientGetResponse contains the response from method ChatSessionsClient.Get. +type ChatSessionsClientGetResponse struct { + // The chat session resource. + ChatSessionResource +} + +// ChatSessionsClientListResponse contains the response from method ChatSessionsClient.NewListPager. +type ChatSessionsClientListResponse struct { + // A list of chat session. + ChatSessionResourceListResult +} + +// CredentialClientGetResponse contains the response from method CredentialClient.Get. +type CredentialClientGetResponse struct { + // The test base credential resource. + CredentialResource +} + +// CredentialClientListByTestBaseAccountResponse contains the response from method CredentialClient.NewListByTestBaseAccountPager. +type CredentialClientListByTestBaseAccountResponse struct { + // A list of credential resources. + CredentialListResult +} + +// CredentialsClientCreateResponse contains the response from method CredentialsClient.Create. +type CredentialsClientCreateResponse struct { + // The test base credential resource. + CredentialResource +} + +// CredentialsClientDeleteResponse contains the response from method CredentialsClient.Delete. +type CredentialsClientDeleteResponse struct { + // placeholder for future response values +} + +// CredentialsClientUpdateResponse contains the response from method CredentialsClient.Update. +type CredentialsClientUpdateResponse struct { + // The test base credential resource. + CredentialResource +} + +// CustomImagesClientCheckImageNameAvailabilityResponse contains the response from method CustomImagesClient.CheckImageNameAvailability. +type CustomImagesClientCheckImageNameAvailabilityResponse struct { + // The detailed result of a validation or rule checking. + VerificationResult +} + +// CustomImagesClientCreateResponse contains the response from method CustomImagesClient.BeginCreate. +type CustomImagesClientCreateResponse struct { + // The test base custom image resource. + CustomImageResource +} + +// CustomImagesClientDeleteResponse contains the response from method CustomImagesClient.BeginDelete. +type CustomImagesClientDeleteResponse struct { + // placeholder for future response values +} + +// CustomImagesClientGetResponse contains the response from method CustomImagesClient.Get. +type CustomImagesClientGetResponse struct { + // The test base custom image resource. + CustomImageResource +} + +// CustomImagesClientListByTestBaseAccountResponse contains the response from method CustomImagesClient.NewListByTestBaseAccountPager. +type CustomImagesClientListByTestBaseAccountResponse struct { + // A list of Test Base custom images. + CustomImageListResult +} + // CustomerEventsClientCreateResponse contains the response from method CustomerEventsClient.BeginCreate. type CustomerEventsClientCreateResponse struct { + // The Customer Notification Event resource. CustomerEventResource } @@ -86,26 +215,81 @@ type CustomerEventsClientDeleteResponse struct { // CustomerEventsClientGetResponse contains the response from method CustomerEventsClient.Get. type CustomerEventsClientGetResponse struct { + // The Customer Notification Event resource. CustomerEventResource } // CustomerEventsClientListByTestBaseAccountResponse contains the response from method CustomerEventsClient.NewListByTestBaseAccountPager. type CustomerEventsClientListByTestBaseAccountResponse struct { + // A list of Test Base Customer Events. CustomerEventListResult } +// DraftPackagesClientCopyFromPackageResponse contains the response from method DraftPackagesClient.BeginCopyFromPackage. +type DraftPackagesClientCopyFromPackageResponse struct { + // placeholder for future response values +} + +// DraftPackagesClientCreateResponse contains the response from method DraftPackagesClient.Create. +type DraftPackagesClientCreateResponse struct { + // The Test Base Draft Package resource. + DraftPackageResource +} + +// DraftPackagesClientDeleteResponse contains the response from method DraftPackagesClient.Delete. +type DraftPackagesClientDeleteResponse struct { + // placeholder for future response values +} + +// DraftPackagesClientExtractFileResponse contains the response from method DraftPackagesClient.BeginExtractFile. +type DraftPackagesClientExtractFileResponse struct { + // placeholder for future response values +} + +// DraftPackagesClientGenerateFoldersAndScriptsResponse contains the response from method DraftPackagesClient.BeginGenerateFoldersAndScripts. +type DraftPackagesClientGenerateFoldersAndScriptsResponse struct { + // placeholder for future response values +} + +// DraftPackagesClientGetPathResponse contains the response from method DraftPackagesClient.GetPath. +type DraftPackagesClientGetPathResponse struct { + // The response of getting a download URL. + DraftPackageGetPathResponse +} + +// DraftPackagesClientGetResponse contains the response from method DraftPackagesClient.Get. +type DraftPackagesClientGetResponse struct { + // The Test Base Draft Package resource. + DraftPackageResource +} + +// DraftPackagesClientListByTestBaseAccountResponse contains the response from method DraftPackagesClient.NewListByTestBaseAccountPager. +type DraftPackagesClientListByTestBaseAccountResponse struct { + // A list of Test Base Draft Packages. + DraftPackageListResult +} + +// DraftPackagesClientUpdateResponse contains the response from method DraftPackagesClient.Update. +type DraftPackagesClientUpdateResponse struct { + // The Test Base Draft Package resource. + DraftPackageResource +} + // EmailEventsClientGetResponse contains the response from method EmailEventsClient.Get. type EmailEventsClientGetResponse struct { + // The email event resource. EmailEventResource } // EmailEventsClientListResponse contains the response from method EmailEventsClient.NewListPager. type EmailEventsClientListResponse struct { + // A list of email events. EmailEventListResult } // FavoriteProcessesClientCreateResponse contains the response from method FavoriteProcessesClient.Create. type FavoriteProcessesClientCreateResponse struct { + // A favorite process identifier. FavoriteProcessResource } @@ -116,41 +300,127 @@ type FavoriteProcessesClientDeleteResponse struct { // FavoriteProcessesClientGetResponse contains the response from method FavoriteProcessesClient.Get. type FavoriteProcessesClientGetResponse struct { + // A favorite process identifier. FavoriteProcessResource } // FavoriteProcessesClientListResponse contains the response from method FavoriteProcessesClient.NewListPager. type FavoriteProcessesClientListResponse struct { + // A list of favorite processes for a package. FavoriteProcessListResult } +// FeatureUpdateSupportedOsesClientListResponse contains the response from method FeatureUpdateSupportedOsesClient.NewListPager. +type FeatureUpdateSupportedOsesClientListResponse struct { + // Response schema of feature update supported OSes list API. + FeatureUpdateSupportedOsesResult +} + +// FirstPartyAppsClientGetResponse contains the response from method FirstPartyAppsClient.Get. +type FirstPartyAppsClientGetResponse struct { + // The first party application resource. + FirstPartyAppResource +} + +// FirstPartyAppsClientListResponse contains the response from method FirstPartyAppsClient.NewListPager. +type FirstPartyAppsClientListResponse struct { + // A list of currently available first party applications. + FirstPartyAppListResult +} + // FlightingRingsClientGetResponse contains the response from method FlightingRingsClient.Get. type FlightingRingsClientGetResponse struct { + // The flighting ring resource. FlightingRingResource } // FlightingRingsClientListResponse contains the response from method FlightingRingsClient.NewListPager. type FlightingRingsClientListResponse struct { + // A list of flighting rings. FlightingRingListResult } +// FreeHourBalancesClientGetResponse contains the response from method FreeHourBalancesClient.Get. +type FreeHourBalancesClientGetResponse struct { + // The Free Hour Balance Resource. + FreeHourBalanceResource +} + +// FreeHourBalancesClientListResponse contains the response from method FreeHourBalancesClient.NewListPager. +type FreeHourBalancesClientListResponse struct { + // A list of Test Base Free Hour Balances. It will only contain one element as all the data will be nested in a singleton + // object. + FreeHourBalancesListResult +} + +// GalleryAppSKUsClientGetResponse contains the response from method GalleryAppSKUsClient.Get. +type GalleryAppSKUsClientGetResponse struct { + // The gallery application resource. + GalleryAppSKUResource +} + +// GalleryAppSKUsClientListResponse contains the response from method GalleryAppSKUsClient.NewListPager. +type GalleryAppSKUsClientListResponse struct { + // A list of currently available SKUs of a gallery application. + GalleryAppSKUListResult +} + +// GalleryAppsClientGetResponse contains the response from method GalleryAppsClient.Get. +type GalleryAppsClientGetResponse struct { + // The gallery application resource. + GalleryAppResource +} + +// GalleryAppsClientListResponse contains the response from method GalleryAppsClient.NewListPager. +type GalleryAppsClientListResponse struct { + // A list of currently available gallery applications. + GalleryAppListResult +} + +// ImageDefinitionsClientCreateResponse contains the response from method ImageDefinitionsClient.Create. +type ImageDefinitionsClientCreateResponse struct { + // The test base image definition resource. + ImageDefinitionResource +} + +// ImageDefinitionsClientDeleteResponse contains the response from method ImageDefinitionsClient.Delete. +type ImageDefinitionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ImageDefinitionsClientGetResponse contains the response from method ImageDefinitionsClient.Get. +type ImageDefinitionsClientGetResponse struct { + // The test base image definition resource. + ImageDefinitionResource +} + +// ImageDefinitionsClientListByTestBaseAccountResponse contains the response from method ImageDefinitionsClient.NewListByTestBaseAccountPager. +type ImageDefinitionsClientListByTestBaseAccountResponse struct { + // The result of all available image definition under a test base account. + ImageDefinitionsListResult +} + // OSUpdatesClientGetResponse contains the response from method OSUpdatesClient.Get. type OSUpdatesClientGetResponse struct { + // An OS Update. OSUpdateResource } // OSUpdatesClientListResponse contains the response from method OSUpdatesClient.NewListPager. type OSUpdatesClientListResponse struct { + // A list of OS Updates. OSUpdateListResult } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } // PackagesClientCreateResponse contains the response from method PackagesClient.BeginCreate. type PackagesClientCreateResponse struct { + // The Test Base Package resource. PackageResource } @@ -161,11 +431,13 @@ type PackagesClientDeleteResponse struct { // PackagesClientGetDownloadURLResponse contains the response from method PackagesClient.GetDownloadURL. type PackagesClientGetDownloadURLResponse struct { + // The response of getting a download URL. DownloadURLResponse } // PackagesClientGetResponse contains the response from method PackagesClient.Get. type PackagesClientGetResponse struct { + // The Test Base Package resource. PackageResource } @@ -176,60 +448,104 @@ type PackagesClientHardDeleteResponse struct { // PackagesClientListByTestBaseAccountResponse contains the response from method PackagesClient.NewListByTestBaseAccountPager. type PackagesClientListByTestBaseAccountResponse struct { + // A list of Test Base Packages. PackageListResult } +// PackagesClientRunTestResponse contains the response from method PackagesClient.RunTest. +type PackagesClientRunTestResponse struct { + // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. + AzureAsyncOperation *string + + // Location contains the information returned from the Location header response. + Location *string +} + // PackagesClientUpdateResponse contains the response from method PackagesClient.BeginUpdate. type PackagesClientUpdateResponse struct { + // The Test Base Package resource. PackageResource } // SKUsClientListResponse contains the response from method SKUsClient.NewListPager. type SKUsClientListResponse struct { + // A list of Test Base Account SKUs. AccountSKUListResult } +// TestResultsClientGetConsoleLogDownloadURLResponse contains the response from method TestResultsClient.GetConsoleLogDownloadURL. +type TestResultsClientGetConsoleLogDownloadURLResponse struct { + // The response of getting a download URL. + DownloadURLResponse +} + // TestResultsClientGetDownloadURLResponse contains the response from method TestResultsClient.GetDownloadURL. type TestResultsClientGetDownloadURLResponse struct { + // The response of getting a download URL. DownloadURLResponse } // TestResultsClientGetResponse contains the response from method TestResultsClient.Get. type TestResultsClientGetResponse struct { + // The Test Result Resource. TestResultResource } // TestResultsClientGetVideoDownloadURLResponse contains the response from method TestResultsClient.GetVideoDownloadURL. type TestResultsClientGetVideoDownloadURLResponse struct { + // The response of getting a download URL. DownloadURLResponse } // TestResultsClientListResponse contains the response from method TestResultsClient.NewListPager. type TestResultsClientListResponse struct { + // A list of Test Results. TestResultListResult } // TestSummariesClientGetResponse contains the response from method TestSummariesClient.Get. type TestSummariesClientGetResponse struct { + // Summary of a Test. TestSummaryResource } // TestSummariesClientListResponse contains the response from method TestSummariesClient.NewListPager. type TestSummariesClientListResponse struct { + // A list of Test Summaries. TestSummaryListResult } // TestTypesClientGetResponse contains the response from method TestTypesClient.Get. type TestTypesClientGetResponse struct { + // The test type resource. TestTypeResource } // TestTypesClientListResponse contains the response from method TestTypesClient.NewListPager. type TestTypesClientListResponse struct { + // A list of test types. TestTypeListResult } // UsageClientListResponse contains the response from method UsageClient.NewListPager. type UsageClientListResponse struct { + // A list of Test Base Account usage data. AccountUsageDataList } + +// VHDsClientDeleteResponse contains the response from method VHDsClient.Delete. +type VHDsClientDeleteResponse struct { + // placeholder for future response values +} + +// VHDsClientGetResponse contains the response from method VHDsClient.Get. +type VHDsClientGetResponse struct { + // The Test Base VHD resource. + VHDResource +} + +// VHDsClientListByTestBaseAccountResponse contains the response from method VHDsClient.NewListByTestBaseAccountPager. +type VHDsClientListByTestBaseAccountResponse struct { + // A list of VHD resource. + VHDListResult +} diff --git a/sdk/resourcemanager/testbase/armtestbase/skus_client.go b/sdk/resourcemanager/testbase/armtestbase/skus_client.go index 56d51db602e7..8c2d725f1383 100644 --- a/sdk/resourcemanager/testbase/armtestbase/skus_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/skus_client.go @@ -3,15 +3,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase import ( "context" - "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -29,7 +27,7 @@ type SKUsClient struct { } // NewSKUsClient creates a new instance of SKUsClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) { @@ -46,7 +44,7 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt // NewListPager - Lists the available SKUs of Test Base Account in a subscription. // -// Generated from API version 2020-12-16-preview +// Generated from API version 2023-11-01-preview // - options - SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ @@ -79,16 +77,13 @@ func (client *SKUsClient) NewListPager(options *SKUsClientListOptions) *runtime. // listCreateRequest creates the List request. func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/skus" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/skus_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/skus_client_example_test.go deleted file mode 100644 index 930eb7ad91d2..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/skus_client_example_test.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountSKUsList.json -func ExampleSKUsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSKUsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AccountSKUListResult = armtestbase.AccountSKUListResult{ - // Value: []*armtestbase.AccountSKU{ - // { - // Name: to.Ptr("S0"), - // Capabilities: []*armtestbase.AccountSKUCapability{ - // }, - // Locations: []*string{ - // to.Ptr("global")}, - // ResourceType: to.Ptr("testBaseAccounts"), - // Tier: to.Ptr(armtestbase.TierStandard), - // }, - // { - // Name: to.Ptr("S0"), - // Capabilities: []*armtestbase.AccountSKUCapability{ - // }, - // Locations: []*string{ - // to.Ptr("global")}, - // ResourceType: to.Ptr("testBaseAccounts"), - // Tier: to.Ptr(armtestbase.TierStandard), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/testresults_client.go b/sdk/resourcemanager/testbase/armtestbase/testresults_client.go index 22b350a82b4b..6337336b6342 100644 --- a/sdk/resourcemanager/testbase/armtestbase/testresults_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/testresults_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type TestResultsClient struct { } // NewTestResultsClient creates a new instance of TestResultsClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTestResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TestResultsClient, error) { @@ -47,33 +46,33 @@ func NewTestResultsClient(subscriptionID string, credential azcore.TokenCredenti // Get - Get the Test Result by Id with specified OS Update type for a Test Base Package. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. -// - testResultName - The Test Result Name. It equals to {osName}-{TestResultId} string. +// - testResultName - The Test Result Name. It equals to TestResult-{TestResultId} string. // - options - TestResultsClientGetOptions contains the optional parameters for the TestResultsClient.Get method. func (client *TestResultsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, options *TestResultsClientGetOptions) (TestResultsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, testResultName, options) if err != nil { return TestResultsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TestResultsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TestResultsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TestResultsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *TestResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, options *TestResultsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -96,7 +95,7 @@ func (client *TestResultsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -111,37 +110,109 @@ func (client *TestResultsClient) getHandleResponse(resp *http.Response) (TestRes return result, nil } +// GetConsoleLogDownloadURL - Gets the download URL of the test execution console log file. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - packageName - The resource name of the Test Base Package. +// - testResultName - The Test Result Name. It equals to TestResult-{TestResultId} string. +// - parameters - Parameters supplied to the Test Result GetConsoleLogDownloadUrl operation. +// - options - TestResultsClientGetConsoleLogDownloadURLOptions contains the optional parameters for the TestResultsClient.GetConsoleLogDownloadURL +// method. +func (client *TestResultsClient) GetConsoleLogDownloadURL(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, parameters TestResultConsoleLogDownloadURLParameters, options *TestResultsClientGetConsoleLogDownloadURLOptions) (TestResultsClientGetConsoleLogDownloadURLResponse, error) { + var err error + req, err := client.getConsoleLogDownloadURLCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, testResultName, parameters, options) + if err != nil { + return TestResultsClientGetConsoleLogDownloadURLResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TestResultsClientGetConsoleLogDownloadURLResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TestResultsClientGetConsoleLogDownloadURLResponse{}, err + } + resp, err := client.getConsoleLogDownloadURLHandleResponse(httpResp) + return resp, err +} + +// getConsoleLogDownloadURLCreateRequest creates the GetConsoleLogDownloadURL request. +func (client *TestResultsClient) getConsoleLogDownloadURLCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, parameters TestResultConsoleLogDownloadURLParameters, options *TestResultsClientGetConsoleLogDownloadURLOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getConsoleLogDownloadUrl" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if packageName == "" { + return nil, errors.New("parameter packageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageName}", url.PathEscape(packageName)) + if testResultName == "" { + return nil, errors.New("parameter testResultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testResultName}", url.PathEscape(testResultName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// getConsoleLogDownloadURLHandleResponse handles the GetConsoleLogDownloadURL response. +func (client *TestResultsClient) getConsoleLogDownloadURLHandleResponse(resp *http.Response) (TestResultsClientGetConsoleLogDownloadURLResponse, error) { + result := TestResultsClientGetConsoleLogDownloadURLResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DownloadURLResponse); err != nil { + return TestResultsClientGetConsoleLogDownloadURLResponse{}, err + } + return result, nil +} + // GetDownloadURL - Gets the download URL of the test result. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. -// - testResultName - The Test Result Name. It equals to {osName}-{TestResultId} string. +// - testResultName - The Test Result Name. It equals to TestResult-{TestResultId} string. // - options - TestResultsClientGetDownloadURLOptions contains the optional parameters for the TestResultsClient.GetDownloadURL // method. func (client *TestResultsClient) GetDownloadURL(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, options *TestResultsClientGetDownloadURLOptions) (TestResultsClientGetDownloadURLResponse, error) { + var err error req, err := client.getDownloadURLCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, testResultName, options) if err != nil { return TestResultsClientGetDownloadURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TestResultsClientGetDownloadURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TestResultsClientGetDownloadURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TestResultsClientGetDownloadURLResponse{}, err } - return client.getDownloadURLHandleResponse(resp) + resp, err := client.getDownloadURLHandleResponse(httpResp) + return resp, err } // getDownloadURLCreateRequest creates the GetDownloadURL request. func (client *TestResultsClient) getDownloadURLCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, options *TestResultsClientGetDownloadURLOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getDownloadUrl" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -164,7 +235,7 @@ func (client *TestResultsClient) getDownloadURLCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,34 +253,34 @@ func (client *TestResultsClient) getDownloadURLHandleResponse(resp *http.Respons // GetVideoDownloadURL - Gets the download URL of the test execution screen recording. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. -// - testResultName - The Test Result Name. It equals to {osName}-{TestResultId} string. +// - testResultName - The Test Result Name. It equals to TestResult-{TestResultId} string. // - options - TestResultsClientGetVideoDownloadURLOptions contains the optional parameters for the TestResultsClient.GetVideoDownloadURL // method. func (client *TestResultsClient) GetVideoDownloadURL(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, options *TestResultsClientGetVideoDownloadURLOptions) (TestResultsClientGetVideoDownloadURLResponse, error) { + var err error req, err := client.getVideoDownloadURLCreateRequest(ctx, resourceGroupName, testBaseAccountName, packageName, testResultName, options) if err != nil { return TestResultsClientGetVideoDownloadURLResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TestResultsClientGetVideoDownloadURLResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TestResultsClientGetVideoDownloadURLResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TestResultsClientGetVideoDownloadURLResponse{}, err } - return client.getVideoDownloadURLHandleResponse(resp) + resp, err := client.getVideoDownloadURLHandleResponse(httpResp) + return resp, err } // getVideoDownloadURLCreateRequest creates the GetVideoDownloadURL request. func (client *TestResultsClient) getVideoDownloadURLCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, testResultName string, options *TestResultsClientGetVideoDownloadURLOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}/getVideoDownloadUrl" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -232,7 +303,7 @@ func (client *TestResultsClient) getVideoDownloadURLCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,8 +321,8 @@ func (client *TestResultsClient) getVideoDownloadURLHandleResponse(resp *http.Re // NewListPager - Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, // releaseName, flightingRing, buildVersion, buildRevision. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - packageName - The resource name of the Test Base Package. // - osUpdateType - The type of the OS Update. @@ -287,9 +358,6 @@ func (client *TestResultsClient) NewListPager(resourceGroupName string, testBase // listCreateRequest creates the List request. func (client *TestResultsClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, packageName string, osUpdateType OsUpdateType, options *TestResultsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -312,7 +380,7 @@ func (client *TestResultsClient) listCreateRequest(ctx context.Context, resource if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/testresults_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/testresults_client_example_test.go deleted file mode 100644 index dc2f842e6cd5..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/testresults_client_example_test.go +++ /dev/null @@ -1,247 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestResultsList.json -func ExampleTestResultsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTestResultsClient().NewListPager("contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", armtestbase.OsUpdateTypeSecurityUpdate, &armtestbase.TestResultsClientListOptions{Filter: to.Ptr("osName eq 'Windows 10 2004' and releaseName eq '2020.11B'")}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TestResultListResult = armtestbase.TestResultListResult{ - // Value: []*armtestbase.TestResultResource{ - // { - // Name: to.Ptr("Windows-10-2004-8e8e3200-284b-4a99-8c30-cb46c54d4c1e"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-2004-8e8e3200-284b-4a99-8c30-cb46c54d4c1e"), - // Properties: &armtestbase.TestResultProperties{ - // AnalysisSummaries: []*armtestbase.TestResultAnalysisSummary{ - // { - // Name: to.Ptr("Memory Regression Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // }, - // { - // Name: to.Ptr("CPU Regression Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // }, - // { - // Name: to.Ptr("Memory Utilization Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // }, - // { - // Name: to.Ptr("CPU Utilization Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // }}, - // ApplicationName: to.Ptr("contoso-package2"), - // ApplicationVersion: to.Ptr("1.0.0"), - // BaselineTestResultID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/anotherId"), - // BuildRevision: to.Ptr("478"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // IsDownloadDataAvailable: to.Ptr(true), - // KbNumber: to.Ptr("KB1984839"), - // OSName: to.Ptr("Windows 10 2004"), - // PackageID: to.Ptr("b5ed1bcc-e74c-40d8-82f2-1773f616f93e"), - // PackageVersion: to.Ptr("3.0.1"), - // ReleaseName: to.Ptr("2020.11B"), - // ReleaseVersionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-28T17:30:00Z"); return t}()), - // TestRunTime: to.Ptr("00:21:30"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("Out of box test"), - // }, - // }, - // { - // Name: to.Ptr("Windows-10-2004-d19baae0-9ab4-432b-a752-878343fa4481"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-2004-d19baae0-9ab4-432b-a752-878343fa4481"), - // Properties: &armtestbase.TestResultProperties{ - // AnalysisSummaries: []*armtestbase.TestResultAnalysisSummary{ - // { - // Name: to.Ptr("Memory Regression Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusNotAvailable), - // Grade: to.Ptr(armtestbase.GradeNotAvailable), - // }, - // { - // Name: to.Ptr("CPU Regression Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusNotAvailable), - // Grade: to.Ptr(armtestbase.GradeNotAvailable), - // }, - // { - // Name: to.Ptr("Memory Utilization Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusNotAvailable), - // Grade: to.Ptr(armtestbase.GradeNotAvailable), - // }, - // { - // Name: to.Ptr("CPU Utilization Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusNotAvailable), - // Grade: to.Ptr(armtestbase.GradeNotAvailable), - // }}, - // ApplicationName: to.Ptr("contoso-package2"), - // ApplicationVersion: to.Ptr("1.0.0"), - // BaselineTestResultID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/anotherId"), - // BuildRevision: to.Ptr("309"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusFailed), - // Grade: to.Ptr(armtestbase.GradeFail), - // IsDownloadDataAvailable: to.Ptr(false), - // KbNumber: to.Ptr("KB1784831"), - // OSName: to.Ptr("Windows 10 2004"), - // PackageID: to.Ptr("b5ed1bcc-e74c-40d8-82f2-1773f616f93e"), - // PackageVersion: to.Ptr("3.0.1"), - // ReleaseName: to.Ptr("2020.11B"), - // ReleaseVersionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-28T17:30:00Z"); return t}()), - // TestRunTime: to.Ptr("01:00:00"), - // TestStatus: to.Ptr(armtestbase.TestStatusTestFailure), - // TestType: to.Ptr("Out of box test"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestResultGet.json -func ExampleTestResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTestResultsClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-99b1f80d-03a9-4148-997f-806ba5bac8e0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TestResultResource = armtestbase.TestResultResource{ - // Name: to.Ptr("Windows-10-1909-99b1f80d-03a9-4148-997f-806ba5bac8e0"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/packages/testResults"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/Windows-10-1909-99b1f80d-03a9-4148-997f-806ba5bac8e0"), - // Properties: &armtestbase.TestResultProperties{ - // AnalysisSummaries: []*armtestbase.TestResultAnalysisSummary{ - // { - // Name: to.Ptr("Memory Regression Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // }, - // { - // Name: to.Ptr("CPU Regression Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // }, - // { - // Name: to.Ptr("Memory Utilization Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // }, - // { - // Name: to.Ptr("CPU Utilization Analysis Result"), - // AnalysisStatus: to.Ptr(armtestbase.AnalysisStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // }}, - // ApplicationName: to.Ptr("contoso-package2"), - // ApplicationVersion: to.Ptr("1.0.0"), - // BaselineTestResultID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/packages/contoso-package2/testResults/anotherId"), - // BuildRevision: to.Ptr("505"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // IsDownloadDataAvailable: to.Ptr(true), - // KbNumber: to.Ptr("KB1984839"), - // OSName: to.Ptr("Windows 10 1909"), - // PackageID: to.Ptr("b5ed1bcc-e74c-40d8-82f2-1773f616f93e"), - // PackageVersion: to.Ptr("3.0.1"), - // ReleaseName: to.Ptr("2020.12B"), - // ReleaseVersionDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-28T17:30:00Z"); return t}()), - // TestRunTime: to.Ptr("00:21:30"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("Out of box test"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestResultGetDownloadURL.json -func ExampleTestResultsClient_GetDownloadURL() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTestResultsClient().GetDownloadURL(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-99b1f80d-03a9-4148-997f-806ba5bac8e0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DownloadURLResponse = armtestbase.DownloadURLResponse{ - // DownloadURL: to.Ptr("test result download URL"), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-10T06:00:00Z"); return t}()), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestResultGetVideoDownloadURL.json -func ExampleTestResultsClient_GetVideoDownloadURL() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTestResultsClient().GetVideoDownloadURL(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2", "Windows-10-1909-99b1f80d-03a9-4148-997f-806ba5bac8e0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DownloadURLResponse = armtestbase.DownloadURLResponse{ - // DownloadURL: to.Ptr("test result video download URL"), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-01-10T06:00:00Z"); return t}()), - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/testsummaries_client.go b/sdk/resourcemanager/testbase/armtestbase/testsummaries_client.go index 30547b947770..2c7aca001c99 100644 --- a/sdk/resourcemanager/testbase/armtestbase/testsummaries_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/testsummaries_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type TestSummariesClient struct { } // NewTestSummariesClient creates a new instance of TestSummariesClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTestSummariesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TestSummariesClient, error) { @@ -47,32 +46,32 @@ func NewTestSummariesClient(subscriptionID string, credential azcore.TokenCreden // Get - Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - testSummaryName - The name of the Test Summary. // - options - TestSummariesClientGetOptions contains the optional parameters for the TestSummariesClient.Get method. func (client *TestSummariesClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, testSummaryName string, options *TestSummariesClientGetOptions) (TestSummariesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, testSummaryName, options) if err != nil { return TestSummariesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TestSummariesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TestSummariesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TestSummariesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *TestSummariesClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, testSummaryName string, options *TestSummariesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries/{testSummaryName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -91,7 +90,7 @@ func (client *TestSummariesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,8 +107,8 @@ func (client *TestSummariesClient) getHandleResponse(resp *http.Response) (TestS // NewListPager - Lists the Test Summaries of all the packages under a Test Base Account. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - TestSummariesClientListOptions contains the optional parameters for the TestSummariesClient.NewListPager method. func (client *TestSummariesClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *TestSummariesClientListOptions) *runtime.Pager[TestSummariesClientListResponse] { @@ -143,9 +142,6 @@ func (client *TestSummariesClient) NewListPager(resourceGroupName string, testBa // listCreateRequest creates the List request. func (client *TestSummariesClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *TestSummariesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testSummaries" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -160,7 +156,7 @@ func (client *TestSummariesClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/testsummaries_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/testsummaries_client_example_test.go deleted file mode 100644 index 675add2edaa2..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/testsummaries_client_example_test.go +++ /dev/null @@ -1,333 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestSummariesList.json -func ExampleTestSummariesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTestSummariesClient().NewListPager("contoso-rg1", "contoso-testBaseAccount1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TestSummaryListResult = armtestbase.TestSummaryListResult{ - // Value: []*armtestbase.TestSummaryResource{ - // { - // Name: to.Ptr("contoso-package1-38960b32-3541-4cf1-8ccc-fd22774395cc"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/testSummaries"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/testSummaries/contoso-package1-38960b32-3541-4cf1-8ccc-fd22774395cc"), - // Properties: &armtestbase.TestSummaryProperties{ - // ApplicationName: to.Ptr("contoso-package1"), - // ApplicationVersion: to.Ptr("1.0.0"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // FeatureUpdatesTestSummary: &armtestbase.OSUpdatesTestSummary{ - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSUpdateTestSummaries: []*armtestbase.OSUpdateTestSummary{ - // { - // BuildVersion: to.Ptr("513"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1909"), - // ReleaseName: to.Ptr("2020.12.B"), - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }, - // { - // BuildVersion: to.Ptr("765"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1903"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:13:28"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }, - // { - // BuildVersion: to.Ptr("313"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1809"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:42:08"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }}, - // TestRunTime: to.Ptr("00:33:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // }, - // Grade: to.Ptr(armtestbase.GradePass), - // PackageID: to.Ptr("57199102-9738-42e0-9fec-db7709d62a71"), - // SecurityUpdatesTestSummary: &armtestbase.OSUpdatesTestSummary{ - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSUpdateTestSummaries: []*armtestbase.OSUpdateTestSummary{ - // { - // BuildVersion: to.Ptr("513"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1909"), - // ReleaseName: to.Ptr("2020.12.B"), - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }, - // { - // BuildVersion: to.Ptr("765"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1903"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:13:28"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }, - // { - // BuildVersion: to.Ptr("313"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1809"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:42:08"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }}, - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // }, - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestSummaryID: to.Ptr("38960b32-3541-4cf1-8ccc-fd22774395cc"), - // }, - // }, - // { - // Name: to.Ptr("contoso-package2-096bffb5-5d3d-4305-a66a-953372ed6e88"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/testSummaries"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/testSummaries/contoso-package2-096bffb5-5d3d-4305-a66a-953372ed6e88"), - // Properties: &armtestbase.TestSummaryProperties{ - // ApplicationName: to.Ptr("contoso-package2"), - // ApplicationVersion: to.Ptr("1.0.0"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // FeatureUpdatesTestSummary: &armtestbase.OSUpdatesTestSummary{ - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSUpdateTestSummaries: []*armtestbase.OSUpdateTestSummary{ - // { - // BuildVersion: to.Ptr("513"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1909"), - // ReleaseName: to.Ptr("2020.12.B"), - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("FunctionalTest"), - // }, - // { - // BuildVersion: to.Ptr("765"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1903"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:13:28"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("FunctionalTest"), - // }, - // { - // BuildVersion: to.Ptr("313"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1809"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:42:08"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("FunctionalTest"), - // }}, - // TestRunTime: to.Ptr("00:33:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // }, - // Grade: to.Ptr(armtestbase.GradePass), - // PackageID: to.Ptr("b5ed1bcc-e74c-40d8-82f2-1773f616f93e"), - // SecurityUpdatesTestSummary: &armtestbase.OSUpdatesTestSummary{ - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSUpdateTestSummaries: []*armtestbase.OSUpdateTestSummary{ - // { - // BuildVersion: to.Ptr("513"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1909"), - // ReleaseName: to.Ptr("2020.12.B"), - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("FunctionalTest"), - // }, - // { - // BuildVersion: to.Ptr("765"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1903"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:13:28"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("FunctionalTest"), - // }, - // { - // BuildVersion: to.Ptr("313"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1809"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:42:08"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("FunctionalTest"), - // }}, - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // }, - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestSummaryID: to.Ptr("096bffb5-5d3d-4305-a66a-953372ed6e88"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestSummaryGet.json -func ExampleTestSummariesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTestSummariesClient().Get(ctx, "contoso-rg1", "contoso-testBaseAccount1", "contoso-package2-096bffb5-5d3d-4305-a66a-953372ed6e88", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TestSummaryResource = armtestbase.TestSummaryResource{ - // Name: to.Ptr("contoso-package2-096bffb5-5d3d-4305-a66a-953372ed6e88"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/testSummaries"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/testSummaries/contoso-package2-096bffb5-5d3d-4305-a66a-953372ed6e88"), - // Properties: &armtestbase.TestSummaryProperties{ - // ApplicationName: to.Ptr("contoso-package2"), - // ApplicationVersion: to.Ptr("1.0.0"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // FeatureUpdatesTestSummary: &armtestbase.OSUpdatesTestSummary{ - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSUpdateTestSummaries: []*armtestbase.OSUpdateTestSummary{ - // { - // BuildVersion: to.Ptr("513"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1909"), - // ReleaseName: to.Ptr("2020.12.B"), - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }, - // { - // BuildVersion: to.Ptr("765"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1903"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:13:28"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }, - // { - // BuildVersion: to.Ptr("313"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1809"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:42:08"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }}, - // TestRunTime: to.Ptr("00:33:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // }, - // Grade: to.Ptr(armtestbase.GradePass), - // PackageID: to.Ptr("b5ed1bcc-e74c-40d8-82f2-1773f616f93e"), - // SecurityUpdatesTestSummary: &armtestbase.OSUpdatesTestSummary{ - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSUpdateTestSummaries: []*armtestbase.OSUpdateTestSummary{ - // { - // BuildVersion: to.Ptr("513"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1909"), - // ReleaseName: to.Ptr("2020.12.B"), - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }, - // { - // BuildVersion: to.Ptr("765"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1903"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:13:28"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }, - // { - // BuildVersion: to.Ptr("313"), - // ExecutionStatus: to.Ptr(armtestbase.ExecutionStatusSucceeded), - // Grade: to.Ptr(armtestbase.GradePass), - // OSName: to.Ptr("Windows 10 1809"), - // ReleaseName: to.Ptr("2020.11.B"), - // TestRunTime: to.Ptr("00:42:08"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestType: to.Ptr("OutOfBoxTest"), - // }}, - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // }, - // TestRunTime: to.Ptr("00:43:21"), - // TestStatus: to.Ptr(armtestbase.TestStatusCompleted), - // TestSummaryID: to.Ptr("096bffb5-5d3d-4305-a66a-953372ed6e88"), - // }, - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/testtypes_client.go b/sdk/resourcemanager/testbase/armtestbase/testtypes_client.go index 778781d1f0aa..818d0b8c051b 100644 --- a/sdk/resourcemanager/testbase/armtestbase/testtypes_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/testtypes_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type TestTypesClient struct { } // NewTestTypesClient creates a new instance of TestTypesClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewTestTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TestTypesClient, error) { @@ -47,32 +46,32 @@ func NewTestTypesClient(subscriptionID string, credential azcore.TokenCredential // Get - Gets a test type of a Test Base Account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - testTypeResourceName - The resource name of a test type. // - options - TestTypesClientGetOptions contains the optional parameters for the TestTypesClient.Get method. func (client *TestTypesClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, testTypeResourceName string, options *TestTypesClientGetOptions) (TestTypesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, testTypeResourceName, options) if err != nil { return TestTypesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TestTypesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TestTypesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TestTypesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. func (client *TestTypesClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, testTypeResourceName string, options *TestTypesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes/{testTypeResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -91,7 +90,7 @@ func (client *TestTypesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,8 +107,8 @@ func (client *TestTypesClient) getHandleResponse(resp *http.Response) (TestTypes // NewListPager - Lists all the test types of a Test Base Account. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - TestTypesClientListOptions contains the optional parameters for the TestTypesClient.NewListPager method. func (client *TestTypesClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *TestTypesClientListOptions) *runtime.Pager[TestTypesClientListResponse] { @@ -143,9 +142,6 @@ func (client *TestTypesClient) NewListPager(resourceGroupName string, testBaseAc // listCreateRequest creates the List request. func (client *TestTypesClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *TestTypesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/testTypes" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -160,7 +156,7 @@ func (client *TestTypesClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/testtypes_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/testtypes_client_example_test.go deleted file mode 100644 index d1dd06fa1a1f..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/testtypes_client_example_test.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestTypesList.json -func ExampleTestTypesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTestTypesClient().NewListPager("contoso-rg", "contoso-testBaseAccount", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TestTypeListResult = armtestbase.TestTypeListResult{ - // Value: []*armtestbase.TestTypeResource{ - // { - // Name: to.Ptr("Functional-Test"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/testTypes"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/testTypes/Functional-Test"), - // Properties: &armtestbase.TestTypeProperties{ - // ActualTestTypeName: to.Ptr("Functional Test"), - // }, - // }, - // { - // Name: to.Ptr("Out-of-Box-Test"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/testTypes"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/testTypes/Out-of-Box-Test"), - // Properties: &armtestbase.TestTypeProperties{ - // ActualTestTypeName: to.Ptr("Out of Box Test"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestTypeGet.json -func ExampleTestTypesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTestTypesClient().Get(ctx, "contoso-rg", "contoso-testBaseAccount", "Functional-Test", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TestTypeResource = armtestbase.TestTypeResource{ - // Name: to.Ptr("Functional-Test"), - // Type: to.Ptr("Microsoft.TestBase/testBaseAccounts/testTypes"), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount/testTypes/Functional-Test"), - // Properties: &armtestbase.TestTypeProperties{ - // ActualTestTypeName: to.Ptr("Functional Test"), - // }, - // } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/time_rfc3339.go b/sdk/resourcemanager/testbase/armtestbase/time_rfc3339.go index b370d95244c6..dfd092c17fde 100644 --- a/sdk/resourcemanager/testbase/armtestbase/time_rfc3339.go +++ b/sdk/resourcemanager/testbase/armtestbase/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase diff --git a/sdk/resourcemanager/testbase/armtestbase/usage_client.go b/sdk/resourcemanager/testbase/armtestbase/usage_client.go index 59a6c8152852..809db97b5013 100644 --- a/sdk/resourcemanager/testbase/armtestbase/usage_client.go +++ b/sdk/resourcemanager/testbase/armtestbase/usage_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armtestbase @@ -29,7 +28,7 @@ type UsageClient struct { } // NewUsageClient creates a new instance of UsageClient with the specified values. -// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewUsageClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsageClient, error) { @@ -46,8 +45,8 @@ func NewUsageClient(subscriptionID string, credential azcore.TokenCredential, op // NewListPager - Lists the usage data of a Test Base Account. // -// Generated from API version 2020-12-16-preview -// - resourceGroupName - The name of the resource group that contains the resource. +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - testBaseAccountName - The resource name of the Test Base Account. // - options - UsageClientListOptions contains the optional parameters for the UsageClient.NewListPager method. func (client *UsageClient) NewListPager(resourceGroupName string, testBaseAccountName string, options *UsageClientListOptions) *runtime.Pager[UsageClientListResponse] { @@ -81,9 +80,6 @@ func (client *UsageClient) NewListPager(resourceGroupName string, testBaseAccoun // listCreateRequest creates the List request. func (client *UsageClient) listCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *UsageClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/usages" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -101,7 +97,7 @@ func (client *UsageClient) listCreateRequest(ctx context.Context, resourceGroupN if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2020-12-16-preview") + reqQP.Set("api-version", "2023-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/testbase/armtestbase/usage_client_example_test.go b/sdk/resourcemanager/testbase/armtestbase/usage_client_example_test.go deleted file mode 100644 index 86adca849c9a..000000000000 --- a/sdk/resourcemanager/testbase/armtestbase/usage_client_example_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armtestbase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/testbase/armtestbase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/testbase/resource-manager/Microsoft.TestBase/preview/2020-12-16-preview/examples/TestBaseAccountUsagesList.json -func ExampleUsageClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armtestbase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsageClient().NewListPager("contoso-rg1", "contoso-testBaseAccount1", &armtestbase.UsageClientListOptions{Filter: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AccountUsageDataList = armtestbase.AccountUsageDataList{ - // Value: []*armtestbase.AccountUsageData{ - // { - // Name: &armtestbase.AccountUsageName{ - // LocalizedValue: to.Ptr("contoso-package1-usage"), - // Value: to.Ptr("contoso-package1-usage"), - // }, - // CurrentValue: to.Ptr[int64](7531), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/usages/contoso-package1-usage"), - // Limit: to.Ptr[int64](-1), - // Unit: to.Ptr("Seconds"), - // }, - // { - // Name: &armtestbase.AccountUsageName{ - // LocalizedValue: to.Ptr("contoso-package2-usage"), - // Value: to.Ptr("contoso-package2-usage"), - // }, - // CurrentValue: to.Ptr[int64](3157), - // ID: to.Ptr("/subscriptions/476f61a4-952c-422a-b4db-568a828f35df/resourceGroups/contoso-rg1/providers/Microsoft.TestBase/testBaseAccounts/contoso-testBaseAccount1/usages/contoso-package2-usage"), - // Limit: to.Ptr[int64](-1), - // Unit: to.Ptr("Seconds"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/testbase/armtestbase/vhds_client.go b/sdk/resourcemanager/testbase/armtestbase/vhds_client.go new file mode 100644 index 000000000000..49e9379bdd31 --- /dev/null +++ b/sdk/resourcemanager/testbase/armtestbase/vhds_client.go @@ -0,0 +1,225 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armtestbase + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// VHDsClient contains the methods for the VHDs group. +// Don't use this type directly, use NewVHDsClient() instead. +type VHDsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewVHDsClient creates a new instance of VHDsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewVHDsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VHDsClient, error) { + cl, err := arm.NewClient(moduleName+".VHDsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &VHDsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Delete - Deletes a Test Base VHD. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - vhdName - The resource name of the Test Base VHD. +// - options - VHDsClientDeleteOptions contains the optional parameters for the VHDsClient.Delete method. +func (client *VHDsClient) Delete(ctx context.Context, resourceGroupName string, testBaseAccountName string, vhdName string, options *VHDsClientDeleteOptions) (VHDsClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, testBaseAccountName, vhdName, options) + if err != nil { + return VHDsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VHDsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return VHDsClientDeleteResponse{}, err + } + return VHDsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *VHDsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, vhdName string, options *VHDsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds/{vhdName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if vhdName == "" { + return nil, errors.New("parameter vhdName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vhdName}", url.PathEscape(vhdName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a Test Base VHD. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - vhdName - The resource name of the Test Base VHD. +// - options - VHDsClientGetOptions contains the optional parameters for the VHDsClient.Get method. +func (client *VHDsClient) Get(ctx context.Context, resourceGroupName string, testBaseAccountName string, vhdName string, options *VHDsClientGetOptions) (VHDsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, testBaseAccountName, vhdName, options) + if err != nil { + return VHDsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VHDsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VHDsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *VHDsClient) getCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, vhdName string, options *VHDsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds/{vhdName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + if vhdName == "" { + return nil, errors.New("parameter vhdName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vhdName}", url.PathEscape(vhdName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VHDsClient) getHandleResponse(resp *http.Response) (VHDsClientGetResponse, error) { + result := VHDsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VHDResource); err != nil { + return VHDsClientGetResponse{}, err + } + return result, nil +} + +// NewListByTestBaseAccountPager - Lists all the VHDs under a test base account. +// +// Generated from API version 2023-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - testBaseAccountName - The resource name of the Test Base Account. +// - options - VHDsClientListByTestBaseAccountOptions contains the optional parameters for the VHDsClient.NewListByTestBaseAccountPager +// method. +func (client *VHDsClient) NewListByTestBaseAccountPager(resourceGroupName string, testBaseAccountName string, options *VHDsClientListByTestBaseAccountOptions) *runtime.Pager[VHDsClientListByTestBaseAccountResponse] { + return runtime.NewPager(runtime.PagingHandler[VHDsClientListByTestBaseAccountResponse]{ + More: func(page VHDsClientListByTestBaseAccountResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *VHDsClientListByTestBaseAccountResponse) (VHDsClientListByTestBaseAccountResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByTestBaseAccountCreateRequest(ctx, resourceGroupName, testBaseAccountName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return VHDsClientListByTestBaseAccountResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return VHDsClientListByTestBaseAccountResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VHDsClientListByTestBaseAccountResponse{}, runtime.NewResponseError(resp) + } + return client.listByTestBaseAccountHandleResponse(resp) + }, + }) +} + +// listByTestBaseAccountCreateRequest creates the ListByTestBaseAccount request. +func (client *VHDsClient) listByTestBaseAccountCreateRequest(ctx context.Context, resourceGroupName string, testBaseAccountName string, options *VHDsClientListByTestBaseAccountOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase/testBaseAccounts/{testBaseAccountName}/vhds" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if testBaseAccountName == "" { + return nil, errors.New("parameter testBaseAccountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{testBaseAccountName}", url.PathEscape(testBaseAccountName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByTestBaseAccountHandleResponse handles the ListByTestBaseAccount response. +func (client *VHDsClient) listByTestBaseAccountHandleResponse(resp *http.Response) (VHDsClientListByTestBaseAccountResponse, error) { + result := VHDsClientListByTestBaseAccountResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.VHDListResult); err != nil { + return VHDsClientListByTestBaseAccountResponse{}, err + } + return result, nil +}