From 1b88054b37ee036f0a8e5b7d3f8145dab78dcf1c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 12 Jan 2023 19:59:10 +0000 Subject: [PATCH] CodeGen from PR 21964 in Azure/azure-rest-api-specs Merge 63d6de9670c84075586b67e106cbb5d6a6e5cc13 into db511f9fb764f11d9fe17422ea56a6db87477b37 --- .../search/armsearch/CHANGELOG.md | 28 + ...dminkeys_client.go => adminkeys_client.go} | 9 +- .../search/armsearch/autorest.md | 6 +- ...zz_generated_constants.go => constants.go} | 172 ++- sdk/resourcemanager/search/armsearch/go.mod | 16 +- sdk/resourcemanager/search/armsearch/go.sum | 24 +- .../{zz_generated_models.go => models.go} | 107 +- .../search/armsearch/models_serde.go | 1131 +++++++++++++++++ ...rations_client.go => operations_client.go} | 6 +- ...o => privateendpointconnections_client.go} | 18 +- ...ient.go => privatelinkresources_client.go} | 6 +- ...uerykeys_client.go => querykeys_client.go} | 14 +- ...ed_response_types.go => response_types.go} | 1 + ..._services_client.go => services_client.go} | 37 +- ...o => sharedprivatelinkresources_client.go} | 22 +- ...generated_example_adminkeys_client_test.go | 64 - ..._privateendpointconnections_client_test.go | 125 -- ...xample_privatelinkresources_client_test.go | 44 - ...generated_example_querykeys_client_test.go | 90 -- ..._generated_example_services_client_test.go | 211 --- ..._sharedprivatelinkresources_client_test.go | 130 -- .../armsearch/zz_generated_models_serde.go | 97 -- 22 files changed, 1423 insertions(+), 935 deletions(-) rename sdk/resourcemanager/search/armsearch/{zz_generated_adminkeys_client.go => adminkeys_client.go} (98%) rename sdk/resourcemanager/search/armsearch/{zz_generated_constants.go => constants.go} (52%) rename sdk/resourcemanager/search/armsearch/{zz_generated_models.go => models.go} (89%) create mode 100644 sdk/resourcemanager/search/armsearch/models_serde.go rename sdk/resourcemanager/search/armsearch/{zz_generated_operations_client.go => operations_client.go} (96%) rename sdk/resourcemanager/search/armsearch/{zz_generated_privateendpointconnections_client.go => privateendpointconnections_client.go} (97%) rename sdk/resourcemanager/search/armsearch/{zz_generated_privatelinkresources_client.go => privatelinkresources_client.go} (97%) rename sdk/resourcemanager/search/armsearch/{zz_generated_querykeys_client.go => querykeys_client.go} (97%) rename sdk/resourcemanager/search/armsearch/{zz_generated_response_types.go => response_types.go} (99%) rename sdk/resourcemanager/search/armsearch/{zz_generated_services_client.go => services_client.go} (96%) rename sdk/resourcemanager/search/armsearch/{zz_generated_sharedprivatelinkresources_client.go => sharedprivatelinkresources_client.go} (97%) delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_adminkeys_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_privateendpointconnections_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_privatelinkresources_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_querykeys_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_services_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/ze_generated_example_sharedprivatelinkresources_client_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/search/armsearch/CHANGELOG.md b/sdk/resourcemanager/search/armsearch/CHANGELOG.md index 59c3a45100c8..4d0c898513c9 100644 --- a/sdk/resourcemanager/search/armsearch/CHANGELOG.md +++ b/sdk/resourcemanager/search/armsearch/CHANGELOG.md @@ -1,5 +1,33 @@ # Release History +## 2.0.0 (2023-01-12) +### Breaking Changes + +- Struct `CloudError` has been removed +- Struct `CloudErrorBody` has been removed +- Struct `ListQueryKeysResult` has been removed +- Struct `PrivateEndpointConnectionListResult` has been removed +- Struct `PrivateLinkResourcesResult` has been removed +- Struct `ServiceListResult` has been removed +- Struct `SharedPrivateLinkResourceListResult` has been removed + +### Features Added + +- New value `SearchServiceStatusStopped` added to type alias `SearchServiceStatus` +- New type alias `AADAuthFailureMode` with values `AADAuthFailureModeHttp401WithBearerChallenge`, `AADAuthFailureModeHttp403` +- New type alias `PrivateLinkServiceConnectionProvisioningState` with values `PrivateLinkServiceConnectionProvisioningStateCanceled`, `PrivateLinkServiceConnectionProvisioningStateDeleting`, `PrivateLinkServiceConnectionProvisioningStateFailed`, `PrivateLinkServiceConnectionProvisioningStateIncomplete`, `PrivateLinkServiceConnectionProvisioningStateSucceeded`, `PrivateLinkServiceConnectionProvisioningStateUpdating` +- New type alias `SearchEncryptionComplianceStatus` with values `SearchEncryptionComplianceStatusCompliant`, `SearchEncryptionComplianceStatusNonCompliant` +- New type alias `SearchEncryptionWithCmk` with values `SearchEncryptionWithCmkDisabled`, `SearchEncryptionWithCmkEnabled`, `SearchEncryptionWithCmkUnspecified` +- New struct `DataPlaneAADOrAPIKeyAuthOption` +- New struct `DataPlaneAuthOptions` +- New struct `EncryptionWithCmk` +- New field `GroupID` in struct `PrivateEndpointConnectionProperties` +- New field `ProvisioningState` in struct `PrivateEndpointConnectionProperties` +- New field `AuthOptions` in struct `ServiceProperties` +- New field `DisableLocalAuth` in struct `ServiceProperties` +- New field `EncryptionWithCmk` in struct `ServiceProperties` + + ## 1.0.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_adminkeys_client.go b/sdk/resourcemanager/search/armsearch/adminkeys_client.go similarity index 98% rename from sdk/resourcemanager/search/armsearch/zz_generated_adminkeys_client.go rename to sdk/resourcemanager/search/armsearch/adminkeys_client.go index d11c8a558678..13b207e92ca8 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_adminkeys_client.go +++ b/sdk/resourcemanager/search/armsearch/adminkeys_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -57,7 +58,7 @@ func NewAdminKeysClient(subscriptionID string, credential azcore.TokenCredential // Get - Gets the primary and secondary admin API keys for the specified Azure Cognitive Search service. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -99,7 +100,7 @@ func (client *AdminKeysClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -119,7 +120,7 @@ func (client *AdminKeysClient) getHandleResponse(resp *http.Response) (AdminKeys // Regenerate - Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -166,7 +167,7 @@ func (client *AdminKeysClient) regenerateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} diff --git a/sdk/resourcemanager/search/armsearch/autorest.md b/sdk/resourcemanager/search/armsearch/autorest.md index 4bc3e1d36335..5592bc8a9236 100644 --- a/sdk/resourcemanager/search/armsearch/autorest.md +++ b/sdk/resourcemanager/search/armsearch/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/search/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/search/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/search/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/search/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_constants.go b/sdk/resourcemanager/search/armsearch/constants.go similarity index 52% rename from sdk/resourcemanager/search/armsearch/zz_generated_constants.go rename to sdk/resourcemanager/search/armsearch/constants.go index 90e2a0978f44..92f1de33879f 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_constants.go +++ b/sdk/resourcemanager/search/armsearch/constants.go @@ -5,18 +5,42 @@ // 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 armsearch const ( moduleName = "armsearch" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) +// AADAuthFailureMode - Describes what response the data plane API of a Search service would send for requests that failed +// authentication. +type AADAuthFailureMode string + +const ( + // AADAuthFailureModeHttp403 - Indicates that requests that failed authentication should be presented with an HTTP status + // code of 403 (Forbidden). + AADAuthFailureModeHttp403 AADAuthFailureMode = "http403" + // AADAuthFailureModeHttp401WithBearerChallenge - Indicates that requests that failed authentication should be presented with + // an HTTP status code of 401 (Unauthorized) and present a Bearer Challenge. + AADAuthFailureModeHttp401WithBearerChallenge AADAuthFailureMode = "http401WithBearerChallenge" +) + +// PossibleAADAuthFailureModeValues returns the possible values for the AADAuthFailureMode const type. +func PossibleAADAuthFailureModeValues() []AADAuthFailureMode { + return []AADAuthFailureMode{ + AADAuthFailureModeHttp403, + AADAuthFailureModeHttp401WithBearerChallenge, + } +} + type AdminKeyKind string const ( - AdminKeyKindPrimary AdminKeyKind = "primary" + // AdminKeyKindPrimary - The primary API key for the search service. + AdminKeyKindPrimary AdminKeyKind = "primary" + // AdminKeyKindSecondary - The secondary API key for the search service. AdminKeyKindSecondary AdminKeyKind = "secondary" ) @@ -35,7 +59,9 @@ func PossibleAdminKeyKindValues() []AdminKeyKind { type HostingMode string const ( - HostingModeDefault HostingMode = "default" + // HostingModeDefault - The limit on number of indexes is determined by the default limits for the SKU. + HostingModeDefault HostingMode = "default" + // HostingModeHighDensity - Only application for standard3 SKU, where the search service can have up to 1000 indexes. HostingModeHighDensity HostingMode = "highDensity" ) @@ -63,14 +89,55 @@ func PossibleIdentityTypeValues() []IdentityType { } } +// PrivateLinkServiceConnectionProvisioningState - The provisioning state of the private link service connection. Can be Updating, +// Deleting, Failed, Succeeded, or Incomplete +type PrivateLinkServiceConnectionProvisioningState string + +const ( + // PrivateLinkServiceConnectionProvisioningStateCanceled - Provisioning request for the private link service connection resource + // has been canceled + PrivateLinkServiceConnectionProvisioningStateCanceled PrivateLinkServiceConnectionProvisioningState = "Canceled" + // PrivateLinkServiceConnectionProvisioningStateDeleting - The private link service connection is in the process of being + // deleted. + PrivateLinkServiceConnectionProvisioningStateDeleting PrivateLinkServiceConnectionProvisioningState = "Deleting" + // PrivateLinkServiceConnectionProvisioningStateFailed - The private link service connection has failed to be provisioned + // or deleted. + PrivateLinkServiceConnectionProvisioningStateFailed PrivateLinkServiceConnectionProvisioningState = "Failed" + // PrivateLinkServiceConnectionProvisioningStateIncomplete - Provisioning request for the private link service connection + // resource has been accepted but the process of creation has not commenced yet. + PrivateLinkServiceConnectionProvisioningStateIncomplete PrivateLinkServiceConnectionProvisioningState = "Incomplete" + // PrivateLinkServiceConnectionProvisioningStateSucceeded - The private link service connection has finished provisioning + // and is ready for approval. + PrivateLinkServiceConnectionProvisioningStateSucceeded PrivateLinkServiceConnectionProvisioningState = "Succeeded" + // PrivateLinkServiceConnectionProvisioningStateUpdating - The private link service connection is in the process of being + // created along with other resources for it to be fully functional. + PrivateLinkServiceConnectionProvisioningStateUpdating PrivateLinkServiceConnectionProvisioningState = "Updating" +) + +// PossiblePrivateLinkServiceConnectionProvisioningStateValues returns the possible values for the PrivateLinkServiceConnectionProvisioningState const type. +func PossiblePrivateLinkServiceConnectionProvisioningStateValues() []PrivateLinkServiceConnectionProvisioningState { + return []PrivateLinkServiceConnectionProvisioningState{ + PrivateLinkServiceConnectionProvisioningStateCanceled, + PrivateLinkServiceConnectionProvisioningStateDeleting, + PrivateLinkServiceConnectionProvisioningStateFailed, + PrivateLinkServiceConnectionProvisioningStateIncomplete, + PrivateLinkServiceConnectionProvisioningStateSucceeded, + PrivateLinkServiceConnectionProvisioningStateUpdating, + } +} + // PrivateLinkServiceConnectionStatus - Status of the the private link service connection. Can be Pending, Approved, Rejected, // or Disconnected. type PrivateLinkServiceConnectionStatus string const ( - PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" - PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" - PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" + // PrivateLinkServiceConnectionStatusPending - The private endpoint connection has been created and is pending approval. + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + // PrivateLinkServiceConnectionStatusApproved - The private endpoint connection is approved and is ready for use. + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + // PrivateLinkServiceConnectionStatusRejected - The private endpoint connection has been rejected and cannot be used. + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" + // PrivateLinkServiceConnectionStatusDisconnected - The private endpoint connection has been removed from the service. PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" ) @@ -94,9 +161,12 @@ func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConn type ProvisioningState string const ( - ProvisioningStateSucceeded ProvisioningState = "succeeded" + // ProvisioningStateSucceeded - The last provisioning operation has completed successfully. + ProvisioningStateSucceeded ProvisioningState = "succeeded" + // ProvisioningStateProvisioning - The search service is being provisioned or scaled up or down. ProvisioningStateProvisioning ProvisioningState = "provisioning" - ProvisioningStateFailed ProvisioningState = "failed" + // ProvisioningStateFailed - The last provisioning operation has failed. + ProvisioningStateFailed ProvisioningState = "failed" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. @@ -136,12 +206,20 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { type SKUName string const ( - SKUNameFree SKUName = "free" - SKUNameBasic SKUName = "basic" - SKUNameStandard SKUName = "standard" - SKUNameStandard2 SKUName = "standard2" - SKUNameStandard3 SKUName = "standard3" + // SKUNameFree - Free tier, with no SLA guarantees and a subset of features offered to paid tiers. + SKUNameFree SKUName = "free" + // SKUNameBasic - Paid tier dedicated service with up to 3 replicas. + SKUNameBasic SKUName = "basic" + // SKUNameStandard - Paid tier dedicated service with up to 12 partitions and 12 replicas. + SKUNameStandard SKUName = "standard" + // SKUNameStandard2 - Similar to 'standard', but with more capacity per search unit. + SKUNameStandard2 SKUName = "standard2" + // SKUNameStandard3 - The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 partitions with more + // indexes if you also set the hostingMode property to 'highDensity'). + SKUNameStandard3 SKUName = "standard3" + // SKUNameStorageOptimizedL1 - Paid tier dedicated service that supports 1TB per partition, up to 12 partitions. SKUNameStorageOptimizedL1 SKUName = "storage_optimized_l1" + // SKUNameStorageOptimizedL2 - Paid tier dedicated service that supports 2TB per partition, up to 12 partitions. SKUNameStorageOptimizedL2 SKUName = "storage_optimized_l2" ) @@ -158,6 +236,51 @@ func PossibleSKUNameValues() []SKUName { } } +// SearchEncryptionComplianceStatus - Describes whether the search service is compliant or not with respect to having non +// customer encrypted resources. If a service has more than one non customer encrypted resource and 'Enforcement' is +// 'enabled' then the service will be marked as 'nonCompliant'. +type SearchEncryptionComplianceStatus string + +const ( + // SearchEncryptionComplianceStatusCompliant - Indicates that the search service is compliant, either because number of non + // customer encrypted resources is zero or enforcement is disabled. + SearchEncryptionComplianceStatusCompliant SearchEncryptionComplianceStatus = "Compliant" + // SearchEncryptionComplianceStatusNonCompliant - Indicates that the search service has more than 1 non customer encrypted + // resources. + SearchEncryptionComplianceStatusNonCompliant SearchEncryptionComplianceStatus = "NonCompliant" +) + +// PossibleSearchEncryptionComplianceStatusValues returns the possible values for the SearchEncryptionComplianceStatus const type. +func PossibleSearchEncryptionComplianceStatusValues() []SearchEncryptionComplianceStatus { + return []SearchEncryptionComplianceStatus{ + SearchEncryptionComplianceStatusCompliant, + SearchEncryptionComplianceStatusNonCompliant, + } +} + +// SearchEncryptionWithCmk - Describes how a search service should enforce having one or more non customer encrypted resources. +type SearchEncryptionWithCmk string + +const ( + // SearchEncryptionWithCmkDisabled - No enforcement will be made and the search service can have non customer encrypted resources. + SearchEncryptionWithCmkDisabled SearchEncryptionWithCmk = "Disabled" + // SearchEncryptionWithCmkEnabled - Search service will be marked as non-compliant if there are one or more non customer encrypted + // resources. + SearchEncryptionWithCmkEnabled SearchEncryptionWithCmk = "Enabled" + // SearchEncryptionWithCmkUnspecified - Enforcement policy is not explicitly specified, with the behavior being the same as + // if it were set to 'Disabled'. + SearchEncryptionWithCmkUnspecified SearchEncryptionWithCmk = "Unspecified" +) + +// PossibleSearchEncryptionWithCmkValues returns the possible values for the SearchEncryptionWithCmk const type. +func PossibleSearchEncryptionWithCmkValues() []SearchEncryptionWithCmk { + return []SearchEncryptionWithCmk{ + SearchEncryptionWithCmkDisabled, + SearchEncryptionWithCmkEnabled, + SearchEncryptionWithCmkUnspecified, + } +} + // SearchServiceStatus - The status of the search service. Possible values include: 'running': The search service is running // and no provisioning operations are underway. 'provisioning': The search service is being provisioned // or scaled up or down. 'deleting': The search service is being deleted. 'degraded': The search service is degraded. This @@ -170,12 +293,20 @@ func PossibleSKUNameValues() []SKUName { type SearchServiceStatus string const ( - SearchServiceStatusRunning SearchServiceStatus = "running" + // SearchServiceStatusRunning - The search service is running and no provisioning operations are underway. + SearchServiceStatusRunning SearchServiceStatus = "running" + // SearchServiceStatusProvisioning - The search service is being provisioned or scaled up or down. SearchServiceStatusProvisioning SearchServiceStatus = "provisioning" - SearchServiceStatusDeleting SearchServiceStatus = "deleting" - SearchServiceStatusDegraded SearchServiceStatus = "degraded" - SearchServiceStatusDisabled SearchServiceStatus = "disabled" - SearchServiceStatusError SearchServiceStatus = "error" + // SearchServiceStatusDeleting - The search service is being deleted. + SearchServiceStatusDeleting SearchServiceStatus = "deleting" + // SearchServiceStatusDegraded - The search service is degraded because underlying search units are not healthy. + SearchServiceStatusDegraded SearchServiceStatus = "degraded" + // SearchServiceStatusDisabled - The search service is disabled and all API requests will be rejected. + SearchServiceStatusDisabled SearchServiceStatus = "disabled" + // SearchServiceStatusError - The search service is in error state, indicating either a failure to provision or to be deleted. + SearchServiceStatusError SearchServiceStatus = "error" + // SearchServiceStatusStopped - The search service is in a subscription that's disabled. + SearchServiceStatusStopped SearchServiceStatus = "stopped" ) // PossibleSearchServiceStatusValues returns the possible values for the SearchServiceStatus const type. @@ -187,6 +318,7 @@ func PossibleSearchServiceStatusValues() []SearchServiceStatus { SearchServiceStatusDegraded, SearchServiceStatusDisabled, SearchServiceStatusError, + SearchServiceStatusStopped, } } @@ -258,8 +390,10 @@ func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResource type UnavailableNameReason string const ( + // UnavailableNameReasonAlreadyExists - The search service name is already assigned to a different search service. UnavailableNameReasonAlreadyExists UnavailableNameReason = "AlreadyExists" - UnavailableNameReasonInvalid UnavailableNameReason = "Invalid" + // UnavailableNameReasonInvalid - The search service name does not match naming requirements. + UnavailableNameReasonInvalid UnavailableNameReason = "Invalid" ) // PossibleUnavailableNameReasonValues returns the possible values for the UnavailableNameReason const type. diff --git a/sdk/resourcemanager/search/armsearch/go.mod b/sdk/resourcemanager/search/armsearch/go.mod index f504edc08a77..f6e5eb7256ac 100644 --- a/sdk/resourcemanager/search/armsearch/go.mod +++ b/sdk/resourcemanager/search/armsearch/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/search/armsearch/go.sum b/sdk/resourcemanager/search/armsearch/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/search/armsearch/go.sum +++ b/sdk/resourcemanager/search/armsearch/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= 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 v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +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.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +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/search/armsearch/zz_generated_models.go b/sdk/resourcemanager/search/armsearch/models.go similarity index 89% rename from sdk/resourcemanager/search/armsearch/zz_generated_models.go rename to sdk/resourcemanager/search/armsearch/models.go index b6fbc3be7788..a1e2dc91357d 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_models.go +++ b/sdk/resourcemanager/search/armsearch/models.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -40,7 +41,8 @@ type CheckNameAvailabilityInput struct { // dashes, and must be between 2 and 60 characters in length. Name *string `json:"name,omitempty"` - // REQUIRED; The type of the resource whose name is to be validated. This value must always be 'searchServices'. + // CONSTANT; The type of the resource whose name is to be validated. This value must always be 'searchServices'. + // Field has constant value "searchServices", any specified value is ignored. Type *string `json:"type,omitempty"` } @@ -59,26 +61,33 @@ type CheckNameAvailabilityOutput struct { Reason *UnavailableNameReason `json:"reason,omitempty" azure:"ro"` } -// CloudError - Contains information about an API error. -type CloudError struct { - // Describes a particular API error with an error code and a message. - Error *CloudErrorBody `json:"error,omitempty"` +// DataPlaneAADOrAPIKeyAuthOption - Indicates that either the API key or an access token from Azure Active Directory can be +// used for authentication. +type DataPlaneAADOrAPIKeyAuthOption struct { + // Describes what response the data plane API of a Search service would send for requests that failed authentication. + AADAuthFailureMode *AADAuthFailureMode `json:"aadAuthFailureMode,omitempty"` } -// CloudErrorBody - Describes a particular API error with an error code and a message. -type CloudErrorBody struct { - // An error code that describes the error condition more precisely than an HTTP status code. Can be used to programmatically - // handle specific error cases. - Code *string `json:"code,omitempty"` +// DataPlaneAuthOptions - Defines the options for how the data plane API of a Search service authenticates requests. This +// cannot be set if 'disableLocalAuth' is set to true. +type DataPlaneAuthOptions struct { + // Indicates that either the API key or an access token from Azure Active Directory can be used for authentication. + AADOrAPIKey *DataPlaneAADOrAPIKeyAuthOption `json:"aadOrApiKey,omitempty"` - // Contains nested errors that are related to this error. - Details []*CloudErrorBody `json:"details,omitempty"` + // Indicates that only the API key needs to be used for authentication. + APIKeyOnly interface{} `json:"apiKeyOnly,omitempty"` +} - // A message that describes the error in detail and provides debugging information. - Message *string `json:"message,omitempty"` +// EncryptionWithCmk - Describes a policy that determines how resources within the search service are to be encrypted with +// Customer Managed Keys. +type EncryptionWithCmk struct { + // Describes how a search service should enforce having one or more non customer encrypted resources. + Enforcement *SearchEncryptionWithCmk `json:"enforcement,omitempty"` - // The target of the particular error (for example, the name of the property in error). - Target *string `json:"target,omitempty"` + // READ-ONLY; Describes whether the search service is compliant or not with respect to having non customer encrypted resources. + // If a service has more than one non customer encrypted resource and 'Enforcement' is + // 'enabled' then the service will be marked as 'nonCompliant'. + EncryptionComplianceStatus *SearchEncryptionComplianceStatus `json:"encryptionComplianceStatus,omitempty" azure:"ro"` } // IPRule - The IP restriction rule of the Azure Cognitive Search service. @@ -92,23 +101,13 @@ type Identity struct { // REQUIRED; The identity type. Type *IdentityType `json:"type,omitempty"` - // READ-ONLY; The principal ID of resource identity. + // READ-ONLY; The principal ID of the system-assigned identity of the search service. PrincipalID *string `json:"principalId,omitempty" azure:"ro"` - // READ-ONLY; The tenant ID of resource. + // READ-ONLY; The tenant ID of the system-assigned identity of the search service. TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// ListQueryKeysResult - Response containing the query API keys for a given Azure Cognitive Search service. -type ListQueryKeysResult struct { - // READ-ONLY; Request URL that can be used to query next page of query keys. Returned when the total number of requested query - // keys exceed maximum page size. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; The query keys for the Azure Cognitive Search service. - Value []*QueryKey `json:"value,omitempty" azure:"ro"` -} - // NetworkRuleSet - Network specific rules that determine how the Azure Cognitive Search service may be reached. type NetworkRuleSet struct { // A list of IP restriction rules that defines the inbound network(s) with allowing access to the search service endpoint. @@ -173,24 +172,20 @@ type PrivateEndpointConnection struct { Type *string `json:"type,omitempty" azure:"ro"` } -// PrivateEndpointConnectionListResult - Response containing a list of Private Endpoint connections. -type PrivateEndpointConnectionListResult struct { - // READ-ONLY; Request URL that can be used to query next page of private endpoint connections. Returned when the total number - // of requested private endpoint connections exceed maximum page size. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; The list of Private Endpoint connections. - Value []*PrivateEndpointConnection `json:"value,omitempty" azure:"ro"` -} - // PrivateEndpointConnectionProperties - Describes the properties of an existing Private Endpoint connection to the Azure // Cognitive Search service. type PrivateEndpointConnectionProperties struct { + // The group id from the provider of resource the private link service connection is for. + GroupID *string `json:"groupId,omitempty"` + // The private endpoint resource from Microsoft.Network provider. PrivateEndpoint *PrivateEndpointConnectionPropertiesPrivateEndpoint `json:"privateEndpoint,omitempty"` // Describes the current state of an existing Private Link Service connection to the Azure Private Endpoint. PrivateLinkServiceConnectionState *PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + + // The provisioning state of the private link service connection. Can be Updating, Deleting, Failed, Succeeded, or Incomplete + ProvisioningState *PrivateLinkServiceConnectionProvisioningState `json:"provisioningState,omitempty"` } // PrivateEndpointConnectionPropertiesPrivateEndpoint - The private endpoint resource from Microsoft.Network provider. @@ -274,12 +269,6 @@ type PrivateLinkResourcesClientListSupportedOptions struct { // placeholder for future optional parameters } -// PrivateLinkResourcesResult - Response containing a list of supported Private Link Resources. -type PrivateLinkResourcesResult struct { - // READ-ONLY; The list of supported Private Link Resources. - Value []*PrivateLinkResource `json:"value,omitempty" azure:"ro"` -} - // QueryKey - Describes an API key for a given Azure Cognitive Search service that has permissions for query operations only. type QueryKey struct { // READ-ONLY; The value of the query API key. @@ -364,18 +353,19 @@ type Service struct { Type *string `json:"type,omitempty" azure:"ro"` } -// ServiceListResult - Response containing a list of Azure Cognitive Search services. -type ServiceListResult struct { - // READ-ONLY; Request URL that can be used to query next page of search services. Returned when the total number of requested - // search services exceed maximum page size. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` - - // READ-ONLY; The list of search services. - Value []*Service `json:"value,omitempty" azure:"ro"` -} - // ServiceProperties - Properties of the search service. type ServiceProperties struct { + // Defines the options for how the data plane API of a search service authenticates requests. This cannot be set if 'disableLocalAuth' + // is set to true. + AuthOptions *DataPlaneAuthOptions `json:"authOptions,omitempty"` + + // When set to true, calls to the search service will not be permitted to utilize API keys for authentication. This cannot + // be set to true if 'dataPlaneAuthOptions' are defined. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + + // Specifies any policy regarding encryption of resources (such as indexes) using customer manager keys within a search service. + EncryptionWithCmk *EncryptionWithCmk `json:"encryptionWithCmk,omitempty"` + // Applicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow up // to 1000 indexes, which is much higher than the maximum indexes allowed for any // other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this value must be @@ -539,15 +529,6 @@ type SharedPrivateLinkResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// SharedPrivateLinkResourceListResult - Response containing a list of Shared Private Link Resources. -type SharedPrivateLinkResourceListResult struct { - // The URL to get the next set of shared private link resources, if there are any. - NextLink *string `json:"nextLink,omitempty"` - - // READ-ONLY; The list of Shared Private Link Resources. - Value []*SharedPrivateLinkResource `json:"value,omitempty" azure:"ro"` -} - // SharedPrivateLinkResourceProperties - Describes the properties of an existing Shared Private Link Resource managed by the // Azure Cognitive Search service. type SharedPrivateLinkResourceProperties struct { diff --git a/sdk/resourcemanager/search/armsearch/models_serde.go b/sdk/resourcemanager/search/armsearch/models_serde.go new file mode 100644 index 000000000000..a5cf61e2882c --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/models_serde.go @@ -0,0 +1,1131 @@ +//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 armsearch + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AdminKeyResult. +func (a AdminKeyResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "primaryKey", a.PrimaryKey) + populate(objectMap, "secondaryKey", a.SecondaryKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdminKeyResult. +func (a *AdminKeyResult) 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 "primaryKey": + err = unpopulate(val, "PrimaryKey", &a.PrimaryKey) + delete(rawMsg, key) + case "secondaryKey": + err = unpopulate(val, "SecondaryKey", &a.SecondaryKey) + 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 AsyncOperationResult. +func (a AsyncOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AsyncOperationResult. +func (a *AsyncOperationResult) 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 "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 CheckNameAvailabilityInput. +func (c CheckNameAvailabilityInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + objectMap["type"] = "searchServices" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityInput. +func (c *CheckNameAvailabilityInput) 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 "name": + err = unpopulate(val, "Name", &c.Name) + 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 CheckNameAvailabilityOutput. +func (c CheckNameAvailabilityOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nameAvailable", c.IsNameAvailable) + populate(objectMap, "message", c.Message) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityOutput. +func (c *CheckNameAvailabilityOutput) 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 "nameAvailable": + err = unpopulate(val, "IsNameAvailable", &c.IsNameAvailable) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + 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 DataPlaneAADOrAPIKeyAuthOption. +func (d DataPlaneAADOrAPIKeyAuthOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadAuthFailureMode", d.AADAuthFailureMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataPlaneAADOrAPIKeyAuthOption. +func (d *DataPlaneAADOrAPIKeyAuthOption) 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 "aadAuthFailureMode": + err = unpopulate(val, "AADAuthFailureMode", &d.AADAuthFailureMode) + 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 DataPlaneAuthOptions. +func (d DataPlaneAuthOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadOrApiKey", d.AADOrAPIKey) + populate(objectMap, "apiKeyOnly", &d.APIKeyOnly) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataPlaneAuthOptions. +func (d *DataPlaneAuthOptions) 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 "aadOrApiKey": + err = unpopulate(val, "AADOrAPIKey", &d.AADOrAPIKey) + delete(rawMsg, key) + case "apiKeyOnly": + err = unpopulate(val, "APIKeyOnly", &d.APIKeyOnly) + 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 EncryptionWithCmk. +func (e EncryptionWithCmk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "encryptionComplianceStatus", e.EncryptionComplianceStatus) + populate(objectMap, "enforcement", e.Enforcement) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EncryptionWithCmk. +func (e *EncryptionWithCmk) 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 "encryptionComplianceStatus": + err = unpopulate(val, "EncryptionComplianceStatus", &e.EncryptionComplianceStatus) + delete(rawMsg, key) + case "enforcement": + err = unpopulate(val, "Enforcement", &e.Enforcement) + 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 IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. +func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipRules", n.IPRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. +func (n *NetworkRuleSet) 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", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "name", o.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) 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 "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + 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 OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) 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 "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + 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 OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + 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 PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) 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 "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + 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 PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) 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 "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + 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 PrivateEndpointConnectionPropertiesPrivateEndpoint. +func (p PrivateEndpointConnectionPropertiesPrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionPropertiesPrivateEndpoint. +func (p *PrivateEndpointConnectionPropertiesPrivateEndpoint) 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 "id": + err = unpopulate(val, "ID", &p.ID) + 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 PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState. +func (p PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState. +func (p *PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState) 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 "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + 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 PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) 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 "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + 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 PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + populate(objectMap, "shareablePrivateLinkResourceTypes", p.ShareablePrivateLinkResourceTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) 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 "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + case "shareablePrivateLinkResourceTypes": + err = unpopulate(val, "ShareablePrivateLinkResourceTypes", &p.ShareablePrivateLinkResourceTypes) + 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 QueryKey. +func (q QueryKey) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "key", q.Key) + populate(objectMap, "name", q.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryKey. +func (q *QueryKey) 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "key": + err = unpopulate(val, "Key", &q.Key) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) 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 "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + 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 SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) 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 "name": + err = unpopulate(val, "Name", &s.Name) + 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 Service. +func (s Service) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Service. +func (s *Service) 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 "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 ServiceProperties. +func (s ServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authOptions", s.AuthOptions) + populate(objectMap, "disableLocalAuth", s.DisableLocalAuth) + populate(objectMap, "encryptionWithCmk", s.EncryptionWithCmk) + populate(objectMap, "hostingMode", s.HostingMode) + populate(objectMap, "networkRuleSet", s.NetworkRuleSet) + populate(objectMap, "partitionCount", s.PartitionCount) + populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) + populate(objectMap, "replicaCount", s.ReplicaCount) + populate(objectMap, "sharedPrivateLinkResources", s.SharedPrivateLinkResources) + populate(objectMap, "status", s.Status) + populate(objectMap, "statusDetails", s.StatusDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceProperties. +func (s *ServiceProperties) 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 "authOptions": + err = unpopulate(val, "AuthOptions", &s.AuthOptions) + delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &s.DisableLocalAuth) + delete(rawMsg, key) + case "encryptionWithCmk": + err = unpopulate(val, "EncryptionWithCmk", &s.EncryptionWithCmk) + delete(rawMsg, key) + case "hostingMode": + err = unpopulate(val, "HostingMode", &s.HostingMode) + delete(rawMsg, key) + case "networkRuleSet": + err = unpopulate(val, "NetworkRuleSet", &s.NetworkRuleSet) + delete(rawMsg, key) + case "partitionCount": + err = unpopulate(val, "PartitionCount", &s.PartitionCount) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &s.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) + delete(rawMsg, key) + case "replicaCount": + err = unpopulate(val, "ReplicaCount", &s.ReplicaCount) + delete(rawMsg, key) + case "sharedPrivateLinkResources": + err = unpopulate(val, "SharedPrivateLinkResources", &s.SharedPrivateLinkResources) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "statusDetails": + err = unpopulate(val, "StatusDetails", &s.StatusDetails) + 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 ServiceUpdate. +func (s ServiceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceUpdate. +func (s *ServiceUpdate) 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 "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &s.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 ShareablePrivateLinkResourceProperties. +func (s ShareablePrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", s.Description) + populate(objectMap, "groupId", s.GroupID) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ShareablePrivateLinkResourceProperties. +func (s *ShareablePrivateLinkResourceProperties) 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 "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "groupId": + err = unpopulate(val, "GroupID", &s.GroupID) + 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 ShareablePrivateLinkResourceType. +func (s ShareablePrivateLinkResourceType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ShareablePrivateLinkResourceType. +func (s *ShareablePrivateLinkResourceType) 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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + 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 SharedPrivateLinkResource. +func (s SharedPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedPrivateLinkResource. +func (s *SharedPrivateLinkResource) 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 "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + 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 SharedPrivateLinkResourceProperties. +func (s SharedPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", s.GroupID) + populate(objectMap, "privateLinkResourceId", s.PrivateLinkResourceID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "requestMessage", s.RequestMessage) + populate(objectMap, "resourceRegion", s.ResourceRegion) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedPrivateLinkResourceProperties. +func (s *SharedPrivateLinkResourceProperties) 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 "groupId": + err = unpopulate(val, "GroupID", &s.GroupID) + delete(rawMsg, key) + case "privateLinkResourceId": + err = unpopulate(val, "PrivateLinkResourceID", &s.PrivateLinkResourceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "requestMessage": + err = unpopulate(val, "RequestMessage", &s.RequestMessage) + delete(rawMsg, key) + case "resourceRegion": + err = unpopulate(val, "ResourceRegion", &s.ResourceRegion) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) 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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_operations_client.go b/sdk/resourcemanager/search/armsearch/operations_client.go similarity index 96% rename from sdk/resourcemanager/search/armsearch/zz_generated_operations_client.go rename to sdk/resourcemanager/search/armsearch/operations_client.go index 2d8cdd2165c0..9ca3ee694cf5 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_operations_client.go +++ b/sdk/resourcemanager/search/armsearch/operations_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available REST API operations of the Microsoft.Search provider. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -82,7 +82,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/search/armsearch/privateendpointconnections_client.go similarity index 97% rename from sdk/resourcemanager/search/armsearch/zz_generated_privateendpointconnections_client.go rename to sdk/resourcemanager/search/armsearch/privateendpointconnections_client.go index 886b36cdac0f..525fbf685369 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/search/armsearch/privateendpointconnections_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -57,7 +58,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // Delete - Disconnects the private endpoint connection and deletes it from the search service. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -106,7 +107,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -126,7 +127,7 @@ func (client *PrivateEndpointConnectionsClient) deleteHandleResponse(resp *http. // Get - Gets the details of the private endpoint connection to the search service in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -175,7 +176,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -194,8 +195,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res } // NewListByServicePager - Gets a list of all private endpoint connections in the given service. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -251,7 +251,7 @@ func (client *PrivateEndpointConnectionsClient) listByServiceCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -271,7 +271,7 @@ func (client *PrivateEndpointConnectionsClient) listByServiceHandleResponse(resp // Update - Updates a Private Endpoint connection to the search service in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -321,7 +321,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/search/armsearch/privatelinkresources_client.go similarity index 97% rename from sdk/resourcemanager/search/armsearch/zz_generated_privatelinkresources_client.go rename to sdk/resourcemanager/search/armsearch/privatelinkresources_client.go index 4ff36d1393a1..e988091ec4dc 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/search/armsearch/privatelinkresources_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -56,8 +57,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke } // NewListSupportedPager - Gets a list of all supported private link resource types for the given service. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -107,7 +107,7 @@ func (client *PrivateLinkResourcesClient) listSupportedCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_querykeys_client.go b/sdk/resourcemanager/search/armsearch/querykeys_client.go similarity index 97% rename from sdk/resourcemanager/search/armsearch/zz_generated_querykeys_client.go rename to sdk/resourcemanager/search/armsearch/querykeys_client.go index 30842402447e..73145d6dbb4a 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_querykeys_client.go +++ b/sdk/resourcemanager/search/armsearch/querykeys_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -57,7 +58,7 @@ func NewQueryKeysClient(subscriptionID string, credential azcore.TokenCredential // Create - Generates a new query key for the specified search service. You can create up to 50 query keys per service. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -104,7 +105,7 @@ func (client *QueryKeysClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -125,7 +126,7 @@ func (client *QueryKeysClient) createHandleResponse(resp *http.Response) (QueryK // Delete - Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating // a query key is to delete and then recreate it. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -172,7 +173,7 @@ func (client *QueryKeysClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -182,8 +183,7 @@ func (client *QueryKeysClient) deleteCreateRequest(ctx context.Context, resource } // NewListBySearchServicePager - Returns the list of query API keys for the given Azure Cognitive Search service. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -239,7 +239,7 @@ func (client *QueryKeysClient) listBySearchServiceCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_response_types.go b/sdk/resourcemanager/search/armsearch/response_types.go similarity index 99% rename from sdk/resourcemanager/search/armsearch/zz_generated_response_types.go rename to sdk/resourcemanager/search/armsearch/response_types.go index 228fb6e48b10..0eb5ae83dfc8 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_response_types.go +++ b/sdk/resourcemanager/search/armsearch/response_types.go @@ -5,6 +5,7 @@ // 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 armsearch diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_services_client.go b/sdk/resourcemanager/search/armsearch/services_client.go similarity index 96% rename from sdk/resourcemanager/search/armsearch/zz_generated_services_client.go rename to sdk/resourcemanager/search/armsearch/services_client.go index aeacb32522e9..6da58d0e7b4b 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_services_client.go +++ b/sdk/resourcemanager/search/armsearch/services_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -58,7 +59,7 @@ func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Checks whether or not the given search service name is available for use. Search service names // must be globally unique since they are part of the service URI (https://.search.windows.net). // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // checkNameAvailabilityInput - The resource name and type to check. // SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get // method. @@ -91,7 +92,7 @@ func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -112,7 +113,7 @@ func (client *ServicesClient) checkNameAvailabilityHandleResponse(resp *http.Res // BeginCreateOrUpdate - Creates or updates a search service in the given resource group. If the search service already exists, // all properties will be updated with the given values. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service to create or update. Search service names must only @@ -140,7 +141,7 @@ func (client *ServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Creates or updates a search service in the given resource group. If the search service already exists, // all properties will be updated with the given values. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 func (client *ServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, searchServiceName string, service Service, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, searchServiceName, service, searchManagementRequestOptions, options) if err != nil { @@ -176,7 +177,7 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -187,7 +188,7 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r // Delete - Deletes a search service in the given resource group, along with its associated resources. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -229,7 +230,7 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -240,7 +241,7 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Gets the search service with the given name in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -282,7 +283,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -300,9 +301,8 @@ func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesCl return result, nil } -// NewListByResourceGroupPager - Gets a list of all search services in the given resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// NewListByResourceGroupPager - Gets a list of all Search services in the given resource group. +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get @@ -353,7 +353,7 @@ func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -371,9 +371,8 @@ func (client *ServicesClient) listByResourceGroupHandleResponse(resp *http.Respo return result, nil } -// NewListBySubscriptionPager - Gets a list of all search services in the given subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// NewListBySubscriptionPager - Gets a list of all Search services in the given subscription. +// Generated from API version 2022-09-01 // SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get // method. // options - ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.ListBySubscription @@ -418,7 +417,7 @@ func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -438,7 +437,7 @@ func (client *ServicesClient) listBySubscriptionHandleResponse(resp *http.Respon // Update - Updates an existing search service in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service to update. @@ -481,7 +480,7 @@ func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_sharedprivatelinkresources_client.go b/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client.go similarity index 97% rename from sdk/resourcemanager/search/armsearch/zz_generated_sharedprivatelinkresources_client.go rename to sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client.go index 18effa1a45fa..687e41efcf6b 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client.go @@ -5,6 +5,7 @@ // 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 armsearch @@ -58,7 +59,7 @@ func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Initiates the creation or update of a shared private link resource managed by the search service // in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -86,7 +87,7 @@ func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Initiates the creation or update of a shared private link resource managed by the search service in the // given resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 func (client *SharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, resourceGroupName string, searchServiceName string, sharedPrivateLinkResourceName string, sharedPrivateLinkResource SharedPrivateLinkResource, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, sharedPrivateLinkResource, searchManagementRequestOptions, options) if err != nil { @@ -126,7 +127,7 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -137,7 +138,7 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx // BeginDelete - Initiates the deletion of the shared private link resource from the search service. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -163,7 +164,7 @@ func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, // Delete - Initiates the deletion of the shared private link resource from the search service. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, searchServiceName string, sharedPrivateLinkResourceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, searchManagementRequestOptions, options) if err != nil { @@ -203,7 +204,7 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -214,7 +215,7 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. // Get - Gets the details of the shared private link resource managed by the search service in the given resource group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -263,7 +264,7 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -282,8 +283,7 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res } // NewListByServicePager - Gets a list of all shared private link resources managed by the given service. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-08-01 +// Generated from API version 2022-09-01 // resourceGroupName - The name of the resource group within the current subscription. You can obtain this value from the // Azure Resource Manager API or the portal. // searchServiceName - The name of the Azure Cognitive Search service associated with the specified resource group. @@ -339,7 +339,7 @@ func (client *SharedPrivateLinkResourcesClient) listByServiceCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2022-09-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_adminkeys_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_adminkeys_client_test.go deleted file mode 100644 index f42eb919a4b7..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_adminkeys_client_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. - -package armsearch_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchGetAdminKeys.json -func ExampleAdminKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewAdminKeysClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchRegenerateAdminKey.json -func ExampleAdminKeysClient_Regenerate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewAdminKeysClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Regenerate(ctx, - "rg1", - "mysearchservice", - armsearch.AdminKeyKindPrimary, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_privateendpointconnections_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_privateendpointconnections_client_test.go deleted file mode 100644 index aacebce1391c..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_privateendpointconnections_client_test.go +++ /dev/null @@ -1,125 +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. - -package armsearch_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/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/UpdatePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewPrivateEndpointConnectionsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "rg1", - "mysearchservice", - "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", - armsearch.PrivateEndpointConnection{ - Properties: &armsearch.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ - Description: to.Ptr("Rejected for some reason"), - Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusRejected), - }, - }, - }, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/GetPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewPrivateEndpointConnectionsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "mysearchservice", - "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/DeletePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewPrivateEndpointConnectionsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Delete(ctx, - "rg1", - "mysearchservice", - "testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/ListPrivateEndpointConnectionsByService.json -func ExamplePrivateEndpointConnectionsClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewPrivateEndpointConnectionsClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServicePager("rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_privatelinkresources_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_privatelinkresources_client_test.go deleted file mode 100644 index c567f6231257..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_privatelinkresources_client_test.go +++ /dev/null @@ -1,44 +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. - -package armsearch_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/ListSupportedPrivateLinkResources.json -func ExamplePrivateLinkResourcesClient_NewListSupportedPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewPrivateLinkResourcesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListSupportedPager("rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_querykeys_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_querykeys_client_test.go deleted file mode 100644 index 355528ce4fff..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_querykeys_client_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. - -package armsearch_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateQueryKey.json -func ExampleQueryKeysClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewQueryKeysClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "rg1", - "mysearchservice", - "Query key for browser-based clients", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchListQueryKeysBySearchService.json -func ExampleQueryKeysClient_NewListBySearchServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewQueryKeysClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySearchServicePager("rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchDeleteQueryKey.json -func ExampleQueryKeysClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewQueryKeysClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "rg1", - "mysearchservice", - "", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_services_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_services_client_test.go deleted file mode 100644 index a9ef245b8c4c..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_services_client_test.go +++ /dev/null @@ -1,211 +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. - -package armsearch_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/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateOrUpdateService.json -func ExampleServicesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "mysearchservice", - armsearch.Service{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "app-name": to.Ptr("My e-commerce app"), - }, - Properties: &armsearch.ServiceProperties{ - HostingMode: to.Ptr(armsearch.HostingModeDefault), - PartitionCount: to.Ptr[int32](1), - ReplicaCount: to.Ptr[int32](3), - }, - SKU: &armsearch.SKU{ - Name: to.Ptr(armsearch.SKUNameStandard), - }, - }, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchUpdateService.json -func ExampleServicesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "rg1", - "mysearchservice", - armsearch.ServiceUpdate{ - Properties: &armsearch.ServiceProperties{ - ReplicaCount: to.Ptr[int32](2), - }, - Tags: map[string]*string{ - "app-name": to.Ptr("My e-commerce app"), - "new-tag": to.Ptr("Adding a new tag"), - }, - }, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchGetService.json -func ExampleServicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchDeleteService.json -func ExampleServicesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - 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/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchListServicesByResourceGroup.json -func ExampleServicesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("rg1", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchListServicesBySubscription.json -func ExampleServicesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCheckNameAvailability.json -func ExampleServicesClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewServicesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - armsearch.CheckNameAvailabilityInput{ - Name: to.Ptr("mysearchservice"), - Type: to.Ptr("searchServices"), - }, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/search/armsearch/ze_generated_example_sharedprivatelinkresources_client_test.go b/sdk/resourcemanager/search/armsearch/ze_generated_example_sharedprivatelinkresources_client_test.go deleted file mode 100644 index 65aee8ad0bd1..000000000000 --- a/sdk/resourcemanager/search/armsearch/ze_generated_example_sharedprivatelinkresources_client_test.go +++ /dev/null @@ -1,130 +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. - -package armsearch_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/search/armsearch" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/CreateOrUpdateSharedPrivateLinkResource.json -func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewSharedPrivateLinkResourcesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "rg1", - "mysearchservice", - "testResource", - armsearch.SharedPrivateLinkResource{ - Properties: &armsearch.SharedPrivateLinkResourceProperties{ - GroupID: to.Ptr("blob"), - PrivateLinkResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName"), - RequestMessage: to.Ptr("please approve"), - }, - }, - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/GetSharedPrivateLinkResource.json -func ExampleSharedPrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewSharedPrivateLinkResourcesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "mysearchservice", - "testResource", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/DeleteSharedPrivateLinkResource.json -func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewSharedPrivateLinkResourcesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "mysearchservice", - "testResource", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - 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/tree/main/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/ListSharedPrivateLinkResourcesByService.json -func ExampleSharedPrivateLinkResourcesClient_NewListByServicePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsearch.NewSharedPrivateLinkResourcesClient("subid", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServicePager("rg1", - "mysearchservice", - &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_models_serde.go b/sdk/resourcemanager/search/armsearch/zz_generated_models_serde.go deleted file mode 100644 index f0ef1d6f8d8f..000000000000 --- a/sdk/resourcemanager/search/armsearch/zz_generated_models_serde.go +++ /dev/null @@ -1,97 +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. - -package armsearch - -import ( - "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. -func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "ipRules", n.IPRules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - populate(objectMap, "shareablePrivateLinkResourceTypes", p.ShareablePrivateLinkResourceTypes) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Service. -func (s Service) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "identity", s.Identity) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServiceProperties. -func (s ServiceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "hostingMode", s.HostingMode) - populate(objectMap, "networkRuleSet", s.NetworkRuleSet) - populate(objectMap, "partitionCount", s.PartitionCount) - populate(objectMap, "privateEndpointConnections", s.PrivateEndpointConnections) - populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) - populate(objectMap, "replicaCount", s.ReplicaCount) - populate(objectMap, "sharedPrivateLinkResources", s.SharedPrivateLinkResources) - populate(objectMap, "status", s.Status) - populate(objectMap, "statusDetails", s.StatusDetails) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServiceUpdate. -func (s ServiceUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "identity", s.Identity) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "sku", s.SKU) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -}