From ce1196aff52ff23b010fd37d65261abbda426016 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 29 Sep 2023 18:07:21 +0000 Subject: [PATCH] CodeGen from PR 25938 in Azure/azure-rest-api-specs Merge b934efa9501672e73686c2adbc7a4dcdd26e86c2 into dadb3936abd8fe3667fecdee132efa35099c2b8f --- .../search/armsearch/CHANGELOG.md | 23 + .../search/armsearch/adminkeys_client.go | 33 +- .../adminkeys_client_example_test.go | 66 -- .../search/armsearch/autorest.md | 7 +- .../search/armsearch/client_factory.go | 33 +- .../search/armsearch/constants.go | 232 +++++- sdk/resourcemanager/search/armsearch/go.mod | 12 +- sdk/resourcemanager/search/armsearch/go.sum | 20 +- .../search/armsearch/management_client.go | 111 +++ .../search/armsearch/models.go | 409 ++++----- .../search/armsearch/models_serde.go | 200 ++++- .../search/armsearch/operations_client.go | 7 +- .../operations_client_example_test.go | 298 ------- .../search/armsearch/options.go | 154 ++++ .../privateendpointconnections_client.go | 57 +- ...endpointconnections_client_example_test.go | 174 ---- .../armsearch/privatelinkresources_client.go | 7 +- ...rivatelinkresources_client_example_test.go | 115 --- .../search/armsearch/querykeys_client.go | 34 +- .../querykeys_client_example_test.go | 95 --- .../search/armsearch/response_types.go | 35 +- .../search/armsearch/services_client.go | 106 ++- .../armsearch/services_client_example_test.go | 785 ------------------ .../sharedprivatelinkresources_client.go | 65 +- ...rivatelinkresources_client_example_test.go | 151 ---- .../search/armsearch/usages_client.go | 115 +++ 26 files changed, 1223 insertions(+), 2121 deletions(-) delete mode 100644 sdk/resourcemanager/search/armsearch/adminkeys_client_example_test.go create mode 100644 sdk/resourcemanager/search/armsearch/management_client.go delete mode 100644 sdk/resourcemanager/search/armsearch/operations_client_example_test.go create mode 100644 sdk/resourcemanager/search/armsearch/options.go delete mode 100644 sdk/resourcemanager/search/armsearch/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/privatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/querykeys_client_example_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/services_client_example_test.go delete mode 100644 sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client_example_test.go create mode 100644 sdk/resourcemanager/search/armsearch/usages_client.go diff --git a/sdk/resourcemanager/search/armsearch/CHANGELOG.md b/sdk/resourcemanager/search/armsearch/CHANGELOG.md index a1c804c88e2d..c5b39ee56e91 100644 --- a/sdk/resourcemanager/search/armsearch/CHANGELOG.md +++ b/sdk/resourcemanager/search/armsearch/CHANGELOG.md @@ -1,5 +1,28 @@ # Release History +## 1.2.0 (2023-09-29) +### Features Added + +- New enum type `AADAuthFailureMode` with values `AADAuthFailureModeHttp401WithBearerChallenge`, `AADAuthFailureModeHttp403` +- New enum type `PrivateLinkServiceConnectionProvisioningState` with values `PrivateLinkServiceConnectionProvisioningStateCanceled`, `PrivateLinkServiceConnectionProvisioningStateDeleting`, `PrivateLinkServiceConnectionProvisioningStateFailed`, `PrivateLinkServiceConnectionProvisioningStateIncomplete`, `PrivateLinkServiceConnectionProvisioningStateSucceeded`, `PrivateLinkServiceConnectionProvisioningStateUpdating` +- New enum type `SearchEncryptionComplianceStatus` with values `SearchEncryptionComplianceStatusCompliant`, `SearchEncryptionComplianceStatusNonCompliant` +- New enum type `SearchEncryptionWithCmk` with values `SearchEncryptionWithCmkDisabled`, `SearchEncryptionWithCmkEnabled`, `SearchEncryptionWithCmkUnspecified` +- New enum type `SearchSemanticSearch` with values `SearchSemanticSearchDisabled`, `SearchSemanticSearchFree`, `SearchSemanticSearchStandard` +- New function `*ClientFactory.NewManagementClient() *ManagementClient` +- New function `*ClientFactory.NewUsagesClient() *UsagesClient` +- New function `NewManagementClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ManagementClient, error)` +- New function `*ManagementClient.UsageBySubscriptionSKU(context.Context, string, string, *SearchManagementRequestOptions, *ManagementClientUsageBySubscriptionSKUOptions) (ManagementClientUsageBySubscriptionSKUResponse, error)` +- New function `NewUsagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*UsagesClient, error)` +- New function `*UsagesClient.NewListBySubscriptionPager(string, *SearchManagementRequestOptions, *UsagesClientListBySubscriptionOptions) *runtime.Pager[UsagesClientListBySubscriptionResponse]` +- New struct `DataPlaneAADOrAPIKeyAuthOption` +- New struct `DataPlaneAuthOptions` +- New struct `EncryptionWithCmk` +- New struct `QuotaUsageResult` +- New struct `QuotaUsageResultName` +- New field `GroupID`, `ProvisioningState` in struct `PrivateEndpointConnectionProperties` +- New field `AuthOptions`, `DisableLocalAuth`, `EncryptionWithCmk`, `SemanticSearch` in struct `ServiceProperties` + + ## 1.1.0 (2023-04-03) ### Features Added diff --git a/sdk/resourcemanager/search/armsearch/adminkeys_client.go b/sdk/resourcemanager/search/armsearch/adminkeys_client.go index c37479023fba..8392e55d1140 100644 --- a/sdk/resourcemanager/search/armsearch/adminkeys_client.go +++ b/sdk/resourcemanager/search/armsearch/adminkeys_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch @@ -48,7 +47,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 2023-11-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. @@ -56,18 +55,21 @@ func NewAdminKeysClient(subscriptionID string, credential azcore.TokenCredential // method. // - options - AdminKeysClientGetOptions contains the optional parameters for the AdminKeysClient.Get method. func (client *AdminKeysClient) Get(ctx context.Context, resourceGroupName string, searchServiceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *AdminKeysClientGetOptions) (AdminKeysClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, searchServiceName, searchManagementRequestOptions, options) if err != nil { return AdminKeysClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AdminKeysClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AdminKeysClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AdminKeysClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -90,7 +92,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -111,7 +113,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 2023-11-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. @@ -120,18 +122,21 @@ func (client *AdminKeysClient) getHandleResponse(resp *http.Response) (AdminKeys // method. // - options - AdminKeysClientRegenerateOptions contains the optional parameters for the AdminKeysClient.Regenerate method. func (client *AdminKeysClient) Regenerate(ctx context.Context, resourceGroupName string, searchServiceName string, keyKind AdminKeyKind, searchManagementRequestOptions *SearchManagementRequestOptions, options *AdminKeysClientRegenerateOptions) (AdminKeysClientRegenerateResponse, error) { + var err error req, err := client.regenerateCreateRequest(ctx, resourceGroupName, searchServiceName, keyKind, searchManagementRequestOptions, options) if err != nil { return AdminKeysClientRegenerateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AdminKeysClientRegenerateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AdminKeysClientRegenerateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AdminKeysClientRegenerateResponse{}, err } - return client.regenerateHandleResponse(resp) + resp, err := client.regenerateHandleResponse(httpResp) + return resp, err } // regenerateCreateRequest creates the Regenerate request. @@ -158,7 +163,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", "2023-11-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/adminkeys_client_example_test.go b/sdk/resourcemanager/search/armsearch/adminkeys_client_example_test.go deleted file mode 100644 index 94d9f1a9c0ca..000000000000 --- a/sdk/resourcemanager/search/armsearch/adminkeys_client_example_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdminKeysClient().Get(ctx, "rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdminKeyResult = armsearch.AdminKeyResult{ - // PrimaryKey: to.Ptr(""), - // SecondaryKey: to.Ptr(""), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdminKeysClient().Regenerate(ctx, "rg1", "mysearchservice", armsearch.AdminKeyKindPrimary, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdminKeyResult = armsearch.AdminKeyResult{ - // PrimaryKey: to.Ptr(""), - // SecondaryKey: to.Ptr(""), - // } -} diff --git a/sdk/resourcemanager/search/armsearch/autorest.md b/sdk/resourcemanager/search/armsearch/autorest.md index d3780a55c1f6..00f2828caea2 100644 --- a/sdk/resourcemanager/search/armsearch/autorest.md +++ b/sdk/resourcemanager/search/armsearch/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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.1.0 -tag: package-2020-08 +module-version: 1.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/search/armsearch/client_factory.go b/sdk/resourcemanager/search/armsearch/client_factory.go index 02ccc7c958e0..1c47a1c72708 100644 --- a/sdk/resourcemanager/search/armsearch/client_factory.go +++ b/sdk/resourcemanager/search/armsearch/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch @@ -39,23 +38,23 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewAdminKeysClient() *AdminKeysClient { + subClient, _ := NewAdminKeysClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewAdminKeysClient() *AdminKeysClient { - subClient, _ := NewAdminKeysClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagementClient() *ManagementClient { + subClient, _ := NewManagementClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewQueryKeysClient() *QueryKeysClient { - subClient, _ := NewQueryKeysClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewServicesClient() *ServicesClient { - subClient, _ := NewServicesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -64,8 +63,13 @@ func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesCli return subClient } -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewQueryKeysClient() *QueryKeysClient { + subClient, _ := NewQueryKeysClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewServicesClient() *ServicesClient { + subClient, _ := NewServicesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -73,3 +77,8 @@ func (c *ClientFactory) NewSharedPrivateLinkResourcesClient() *SharedPrivateLink subClient, _ := NewSharedPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } + +func (c *ClientFactory) NewUsagesClient() *UsagesClient { + subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/search/armsearch/constants.go b/sdk/resourcemanager/search/armsearch/constants.go index 2dcbace88ed9..f06a0ad81d6e 100644 --- a/sdk/resourcemanager/search/armsearch/constants.go +++ b/sdk/resourcemanager/search/armsearch/constants.go @@ -3,21 +3,43 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch const ( moduleName = "armsearch" - moduleVersion = "v1.1.0" + moduleVersion = "v1.2.0" ) +// AADAuthFailureMode - Describes what response the data plane API of a Search service would send for requests that failed +// authentication. +type AADAuthFailureMode string + +const ( + // 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" + // AADAuthFailureModeHttp403 - Indicates that requests that failed authentication should be presented with an HTTP status + // code of 403 (Forbidden). + AADAuthFailureModeHttp403 AADAuthFailureMode = "http403" +) + +// PossibleAADAuthFailureModeValues returns the possible values for the AADAuthFailureMode const type. +func PossibleAADAuthFailureModeValues() []AADAuthFailureMode { + return []AADAuthFailureMode{ + AADAuthFailureModeHttp401WithBearerChallenge, + AADAuthFailureModeHttp403, + } +} + 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" ) @@ -36,7 +58,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" ) @@ -64,24 +88,65 @@ 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" + // PrivateLinkServiceConnectionStatusApproved - The private endpoint connection is approved and is ready for use. + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + // PrivateLinkServiceConnectionStatusDisconnected - The private endpoint connection has been removed from the service. PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + // PrivateLinkServiceConnectionStatusPending - The private endpoint connection has been created and is pending approval. + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + // PrivateLinkServiceConnectionStatusRejected - The private endpoint connection has been rejected and cannot be used. + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" ) // PossiblePrivateLinkServiceConnectionStatusValues returns the possible values for the PrivateLinkServiceConnectionStatus const type. func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { return []PrivateLinkServiceConnectionStatus{ - PrivateLinkServiceConnectionStatusPending, PrivateLinkServiceConnectionStatusApproved, - PrivateLinkServiceConnectionStatusRejected, PrivateLinkServiceConnectionStatusDisconnected, + PrivateLinkServiceConnectionStatusPending, + PrivateLinkServiceConnectionStatusRejected, } } @@ -95,17 +160,20 @@ func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConn type ProvisioningState string const ( - ProvisioningStateSucceeded ProvisioningState = "succeeded" + // ProvisioningStateFailed - The last provisioning operation has failed. + ProvisioningStateFailed ProvisioningState = "failed" + // ProvisioningStateProvisioning - The search service is being provisioned or scaled up or down. ProvisioningStateProvisioning ProvisioningState = "provisioning" - ProvisioningStateFailed ProvisioningState = "failed" + // ProvisioningStateSucceeded - The last provisioning operation has completed successfully. + ProvisioningStateSucceeded ProvisioningState = "succeeded" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. func PossibleProvisioningStateValues() []ProvisioningState { return []ProvisioningState{ - ProvisioningStateSucceeded, - ProvisioningStateProvisioning, ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, } } @@ -115,15 +183,15 @@ func PossibleProvisioningStateValues() []ProvisioningState { type PublicNetworkAccess string const ( - PublicNetworkAccessEnabled PublicNetworkAccess = "enabled" PublicNetworkAccessDisabled PublicNetworkAccess = "disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "enabled" ) // PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { return []PublicNetworkAccess{ - PublicNetworkAccessEnabled, PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, } } @@ -137,20 +205,28 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { type SKUName string const ( - SKUNameFree SKUName = "free" - SKUNameBasic SKUName = "basic" - SKUNameStandard SKUName = "standard" - SKUNameStandard2 SKUName = "standard2" - SKUNameStandard3 SKUName = "standard3" + // SKUNameBasic - Paid tier dedicated service with up to 3 replicas. + SKUNameBasic SKUName = "basic" + // SKUNameFree - Free tier, with no SLA guarantees and a subset of features offered to paid tiers. + SKUNameFree SKUName = "free" + // 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" ) // PossibleSKUNameValues returns the possible values for the SKUName const type. func PossibleSKUNameValues() []SKUName { return []SKUName{ - SKUNameFree, SKUNameBasic, + SKUNameFree, SKUNameStandard, SKUNameStandard2, SKUNameStandard3, @@ -159,6 +235,76 @@ 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, + } +} + +// SearchSemanticSearch - Sets options that control the availability of semantic search. This configuration is only possible +// for certain Azure Cognitive Search SKUs in certain locations. +type SearchSemanticSearch string + +const ( + // SearchSemanticSearchDisabled - Indicates that semantic search is disabled for the search service. + SearchSemanticSearchDisabled SearchSemanticSearch = "disabled" + // SearchSemanticSearchFree - Enables semantic search on a search service and indicates that it is to be used within the limits + // of the free tier. This would cap the volume of semantic search requests and is offered at no extra charge. This is the + // default for newly provisioned search services. + SearchSemanticSearchFree SearchSemanticSearch = "free" + // SearchSemanticSearchStandard - Enables semantic search on a search service as a billable feature, with higher throughput + // and volume of semantic search queries. + SearchSemanticSearchStandard SearchSemanticSearch = "standard" +) + +// PossibleSearchSemanticSearchValues returns the possible values for the SearchSemanticSearch const type. +func PossibleSearchSemanticSearchValues() []SearchSemanticSearch { + return []SearchSemanticSearch{ + SearchSemanticSearchDisabled, + SearchSemanticSearchFree, + SearchSemanticSearchStandard, + } +} + // 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 @@ -171,23 +317,29 @@ func PossibleSKUNameValues() []SKUName { type SearchServiceStatus string const ( - SearchServiceStatusRunning SearchServiceStatus = "running" + // SearchServiceStatusDegraded - The search service is degraded because underlying search units are not healthy. + SearchServiceStatusDegraded SearchServiceStatus = "degraded" + // SearchServiceStatusDeleting - The search service is being deleted. + SearchServiceStatusDeleting SearchServiceStatus = "deleting" + // 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" + // 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" + // SearchServiceStatusRunning - The search service is running and no provisioning operations are underway. + SearchServiceStatusRunning SearchServiceStatus = "running" ) // PossibleSearchServiceStatusValues returns the possible values for the SearchServiceStatus const type. func PossibleSearchServiceStatusValues() []SearchServiceStatus { return []SearchServiceStatus{ - SearchServiceStatusRunning, - SearchServiceStatusProvisioning, - SearchServiceStatusDeleting, SearchServiceStatusDegraded, + SearchServiceStatusDeleting, SearchServiceStatusDisabled, SearchServiceStatusError, + SearchServiceStatusProvisioning, + SearchServiceStatusRunning, } } @@ -215,21 +367,21 @@ func PossibleSharedPrivateLinkResourceAsyncOperationResultValues() []SharedPriva type SharedPrivateLinkResourceProvisioningState string const ( - SharedPrivateLinkResourceProvisioningStateUpdating SharedPrivateLinkResourceProvisioningState = "Updating" SharedPrivateLinkResourceProvisioningStateDeleting SharedPrivateLinkResourceProvisioningState = "Deleting" SharedPrivateLinkResourceProvisioningStateFailed SharedPrivateLinkResourceProvisioningState = "Failed" - SharedPrivateLinkResourceProvisioningStateSucceeded SharedPrivateLinkResourceProvisioningState = "Succeeded" SharedPrivateLinkResourceProvisioningStateIncomplete SharedPrivateLinkResourceProvisioningState = "Incomplete" + SharedPrivateLinkResourceProvisioningStateSucceeded SharedPrivateLinkResourceProvisioningState = "Succeeded" + SharedPrivateLinkResourceProvisioningStateUpdating SharedPrivateLinkResourceProvisioningState = "Updating" ) // PossibleSharedPrivateLinkResourceProvisioningStateValues returns the possible values for the SharedPrivateLinkResourceProvisioningState const type. func PossibleSharedPrivateLinkResourceProvisioningStateValues() []SharedPrivateLinkResourceProvisioningState { return []SharedPrivateLinkResourceProvisioningState{ - SharedPrivateLinkResourceProvisioningStateUpdating, SharedPrivateLinkResourceProvisioningStateDeleting, SharedPrivateLinkResourceProvisioningStateFailed, - SharedPrivateLinkResourceProvisioningStateSucceeded, SharedPrivateLinkResourceProvisioningStateIncomplete, + SharedPrivateLinkResourceProvisioningStateSucceeded, + SharedPrivateLinkResourceProvisioningStateUpdating, } } @@ -237,19 +389,19 @@ func PossibleSharedPrivateLinkResourceProvisioningStateValues() []SharedPrivateL type SharedPrivateLinkResourceStatus string const ( - SharedPrivateLinkResourceStatusPending SharedPrivateLinkResourceStatus = "Pending" SharedPrivateLinkResourceStatusApproved SharedPrivateLinkResourceStatus = "Approved" - SharedPrivateLinkResourceStatusRejected SharedPrivateLinkResourceStatus = "Rejected" SharedPrivateLinkResourceStatusDisconnected SharedPrivateLinkResourceStatus = "Disconnected" + SharedPrivateLinkResourceStatusPending SharedPrivateLinkResourceStatus = "Pending" + SharedPrivateLinkResourceStatusRejected SharedPrivateLinkResourceStatus = "Rejected" ) // PossibleSharedPrivateLinkResourceStatusValues returns the possible values for the SharedPrivateLinkResourceStatus const type. func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResourceStatus { return []SharedPrivateLinkResourceStatus{ - SharedPrivateLinkResourceStatusPending, SharedPrivateLinkResourceStatusApproved, - SharedPrivateLinkResourceStatusRejected, SharedPrivateLinkResourceStatusDisconnected, + SharedPrivateLinkResourceStatusPending, + SharedPrivateLinkResourceStatusRejected, } } @@ -259,8 +411,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 347a6a137430..e057a2172c3e 100644 --- a/sdk/resourcemanager/search/armsearch/go.mod +++ b/sdk/resourcemanager/search/armsearch/go.mod @@ -3,15 +3,15 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch go 1.18 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 github.com/stretchr/testify v1.7.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.1.0 // indirect @@ -21,9 +21,9 @@ require ( github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v2 v2.4.0 // 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 9e67f59f4a17..926722ebe8a7 100644 --- a/sdk/resourcemanager/search/armsearch/go.sum +++ b/sdk/resourcemanager/search/armsearch/go.sum @@ -1,9 +1,9 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/armmanagementgroups v1.0.0 h1:pPvTJ1dY0sA35JOeFq6TsY2xj6Z85Yo23Pj4wCCvu4o= @@ -32,13 +32,13 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sdk/resourcemanager/search/armsearch/management_client.go b/sdk/resourcemanager/search/armsearch/management_client.go new file mode 100644 index 000000000000..93fa23ca6445 --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/management_client.go @@ -0,0 +1,111 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsearch + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ManagementClient contains the methods for the SearchManagementClient group. +// Don't use this type directly, use NewManagementClient() instead. +type ManagementClient struct { + internal *arm.Client + subscriptionID string +} + +// NewManagementClient creates a new instance of ManagementClient with the specified values. +// - subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagementClient, error) { + cl, err := arm.NewClient(moduleName+".ManagementClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ManagementClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// UsageBySubscriptionSKU - Gets the quota usage for a search sku in the given subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - location - The unique location name for a Microsoft Azure geographic region. +// - skuName - The unique search service sku name supported by Azure Cognitive Search. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - ManagementClientUsageBySubscriptionSKUOptions contains the optional parameters for the ManagementClient.UsageBySubscriptionSKU +// method. +func (client *ManagementClient) UsageBySubscriptionSKU(ctx context.Context, location string, skuName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *ManagementClientUsageBySubscriptionSKUOptions) (ManagementClientUsageBySubscriptionSKUResponse, error) { + var err error + req, err := client.usageBySubscriptionSKUCreateRequest(ctx, location, skuName, searchManagementRequestOptions, options) + if err != nil { + return ManagementClientUsageBySubscriptionSKUResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ManagementClientUsageBySubscriptionSKUResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientUsageBySubscriptionSKUResponse{}, err + } + resp, err := client.usageBySubscriptionSKUHandleResponse(httpResp) + return resp, err +} + +// usageBySubscriptionSKUCreateRequest creates the UsageBySubscriptionSKU request. +func (client *ManagementClient) usageBySubscriptionSKUCreateRequest(ctx context.Context, location string, skuName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *ManagementClientUsageBySubscriptionSKUOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName}" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if skuName == "" { + return nil, errors.New("parameter skuName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{skuName}", url.PathEscape(skuName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// usageBySubscriptionSKUHandleResponse handles the UsageBySubscriptionSKU response. +func (client *ManagementClient) usageBySubscriptionSKUHandleResponse(resp *http.Response) (ManagementClientUsageBySubscriptionSKUResponse, error) { + result := ManagementClientUsageBySubscriptionSKUResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.QuotaUsageResult); err != nil { + return ManagementClientUsageBySubscriptionSKUResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/search/armsearch/models.go b/sdk/resourcemanager/search/armsearch/models.go index bf7987f99ed6..0eee51e00d64 100644 --- a/sdk/resourcemanager/search/armsearch/models.go +++ b/sdk/resourcemanager/search/armsearch/models.go @@ -3,35 +3,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch // AdminKeyResult - Response containing the primary and secondary admin API keys for a given Azure Cognitive Search service. type AdminKeyResult struct { // READ-ONLY; The primary admin API key of the search service. - PrimaryKey *string `json:"primaryKey,omitempty" azure:"ro"` + PrimaryKey *string // READ-ONLY; The secondary admin API key of the search service. - SecondaryKey *string `json:"secondaryKey,omitempty" azure:"ro"` -} - -// AdminKeysClientGetOptions contains the optional parameters for the AdminKeysClient.Get method. -type AdminKeysClientGetOptions struct { - // placeholder for future optional parameters -} - -// AdminKeysClientRegenerateOptions contains the optional parameters for the AdminKeysClient.Regenerate method. -type AdminKeysClientRegenerateOptions struct { - // placeholder for future optional parameters + SecondaryKey *string } // AsyncOperationResult - The details of a long running asynchronous shared private link resource operation type AsyncOperationResult struct { // The current status of the long running asynchronous shared private link resource operation. - Status *SharedPrivateLinkResourceAsyncOperationResult `json:"status,omitempty"` + Status *SharedPrivateLinkResourceAsyncOperationResult } // CheckNameAvailabilityInput - Input of check name availability API. @@ -39,54 +28,83 @@ type CheckNameAvailabilityInput struct { // REQUIRED; The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, // cannot use dash as the first two or last one characters, cannot contain consecutive // dashes, and must be between 2 and 60 characters in length. - Name *string `json:"name,omitempty"` + Name *string // 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"` + Type *string } // CheckNameAvailabilityOutput - Output of check name availability API. type CheckNameAvailabilityOutput struct { // READ-ONLY; A value indicating whether the name is available. - IsNameAvailable *bool `json:"nameAvailable,omitempty" azure:"ro"` + IsNameAvailable *bool // READ-ONLY; A message that explains why the name is invalid and provides resource naming requirements. Available only if // 'Invalid' is returned in the 'reason' property. - Message *string `json:"message,omitempty" azure:"ro"` + Message *string // READ-ONLY; The reason why the name is not available. 'Invalid' indicates the name provided does not match the naming requirements // (incorrect length, unsupported characters, etc.). 'AlreadyExists' indicates that // the name is already in use and is therefore unavailable. - Reason *UnavailableNameReason `json:"reason,omitempty" azure:"ro"` + Reason *UnavailableNameReason +} + +// 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 +} + +// 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 + + // Indicates that only the API key needs to be used for authentication. + APIKeyOnly any +} + +// 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 + + // 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 } // IPRule - The IP restriction rule of the Azure Cognitive Search service. type IPRule struct { // Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in CIDR format (eg., 123.1.2.3/24) to be allowed. - Value *string `json:"value,omitempty"` + Value *string } // Identity for the resource. type Identity struct { // REQUIRED; The identity type. - Type *IdentityType `json:"type,omitempty"` + Type *IdentityType - // READ-ONLY; The principal ID of resource identity. - PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + // READ-ONLY; The principal ID of the system-assigned identity of the search service. + PrincipalID *string - // READ-ONLY; The tenant ID of resource. - TenantID *string `json:"tenantId,omitempty" azure:"ro"` + // READ-ONLY; The tenant ID of the system-assigned identity of the search service. + TenantID *string } // 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"` + NextLink *string // READ-ONLY; The query keys for the Azure Cognitive Search service. - Value []*QueryKey `json:"value,omitempty" azure:"ro"` + Value []*QueryKey } // NetworkRuleSet - Network specific rules that determine how the Azure Cognitive Search service may be reached. @@ -96,139 +114,116 @@ type NetworkRuleSet struct { // restriction rules are applied only when the 'publicNetworkAccess' of the search service is 'enabled'; otherwise, traffic // over public interface is not allowed even with any public IP rules, and private // endpoint connections would be the exclusive access method. - IPRules []*IPRule `json:"ipRules,omitempty"` + IPRules []*IPRule } // Operation - Describes a REST API operation. type Operation struct { // READ-ONLY; The object that describes the operation. - Display *OperationDisplay `json:"display,omitempty" azure:"ro"` + Display *OperationDisplay // READ-ONLY; The name of the operation. This name is of the form {provider}/{resource}/{operation}. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string } // OperationDisplay - The object that describes the operation. type OperationDisplay struct { // READ-ONLY; The friendly name of the operation. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The operation type: read, write, delete, listKeys/action, etc. - Operation *string `json:"operation,omitempty" azure:"ro"` + Operation *string // READ-ONLY; The friendly name of the resource provider. - Provider *string `json:"provider,omitempty" azure:"ro"` + Provider *string // READ-ONLY; The resource type on which the operation is performed. - Resource *string `json:"resource,omitempty" azure:"ro"` + Resource *string } // OperationListResult - The result of the request to list REST API operations. It contains a list of operations and a URL // to get the next set of results. type OperationListResult struct { // READ-ONLY; The URL to get the next set of operation list results, if any. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + NextLink *string // READ-ONLY; The list of operations supported by the resource provider. - Value []*Operation `json:"value,omitempty" azure:"ro"` -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters + Value []*Operation } // PrivateEndpointConnection - Describes an existing Private Endpoint connection to the Azure Cognitive Search service. type PrivateEndpointConnection struct { // Describes the properties of an existing Private Endpoint connection to the Azure Cognitive Search service. - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Properties *PrivateEndpointConnectionProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // 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"` + NextLink *string // READ-ONLY; The list of Private Endpoint connections. - Value []*PrivateEndpointConnection `json:"value,omitempty" azure:"ro"` + Value []*PrivateEndpointConnection } // 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 + // The private endpoint resource from Microsoft.Network provider. - PrivateEndpoint *PrivateEndpointConnectionPropertiesPrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateEndpoint *PrivateEndpointConnectionPropertiesPrivateEndpoint // Describes the current state of an existing Private Link Service connection to the Azure Private Endpoint. - PrivateLinkServiceConnectionState *PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + PrivateLinkServiceConnectionState *PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + + // The provisioning state of the private link service connection. Can be Updating, Deleting, Failed, Succeeded, or Incomplete + ProvisioningState *PrivateLinkServiceConnectionProvisioningState } // PrivateEndpointConnectionPropertiesPrivateEndpoint - The private endpoint resource from Microsoft.Network provider. type PrivateEndpointConnectionPropertiesPrivateEndpoint struct { // The resource id of the private endpoint resource from Microsoft.Network provider. - ID *string `json:"id,omitempty"` + ID *string } // PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState - Describes the current state of an existing Private // Link Service connection to the Azure Private Endpoint. type PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState struct { // A description of any extra actions that may be required. - ActionsRequired *string `json:"actionsRequired,omitempty"` + ActionsRequired *string // The description for the private link service connection state. - Description *string `json:"description,omitempty"` + Description *string // Status of the the private link service connection. Can be Pending, Approved, Rejected, or Disconnected. - Status *PrivateLinkServiceConnectionStatus `json:"status,omitempty"` -} - -// PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete -// method. -type PrivateEndpointConnectionsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByServicePager -// method. -type PrivateEndpointConnectionsClientListByServiceOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update -// method. -type PrivateEndpointConnectionsClientUpdateOptions struct { - // placeholder for future optional parameters + Status *PrivateLinkServiceConnectionStatus } // PrivateLinkResource - Describes a supported private link resource for the Azure Cognitive Search service. type PrivateLinkResource struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Describes the properties of a supported private link resource for the Azure Cognitive Search service. - Properties *PrivateLinkResourceProperties `json:"properties,omitempty" azure:"ro"` + Properties *PrivateLinkResourceProperties // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // PrivateLinkResourceProperties - Describes the properties of a supported private link resource for the Azure Cognitive Search @@ -236,65 +231,70 @@ type PrivateLinkResource struct { // link resource. type PrivateLinkResourceProperties struct { // READ-ONLY; The group ID of the private link resource. - GroupID *string `json:"groupId,omitempty" azure:"ro"` + GroupID *string // READ-ONLY; The list of required members of the private link resource. - RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` + RequiredMembers []*string // READ-ONLY; The list of required DNS zone names of the private link resource. - RequiredZoneNames []*string `json:"requiredZoneNames,omitempty" azure:"ro"` + RequiredZoneNames []*string // READ-ONLY; The list of resources that are onboarded to private link service, that are supported by Azure Cognitive Search. - ShareablePrivateLinkResourceTypes []*ShareablePrivateLinkResourceType `json:"shareablePrivateLinkResourceTypes,omitempty" azure:"ro"` -} - -// PrivateLinkResourcesClientListSupportedOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListSupportedPager -// method. -type PrivateLinkResourcesClientListSupportedOptions struct { - // placeholder for future optional parameters + ShareablePrivateLinkResourceTypes []*ShareablePrivateLinkResourceType } // 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"` + Value []*PrivateLinkResource } // 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. - Key *string `json:"key,omitempty" azure:"ro"` + Key *string // READ-ONLY; The name of the query API key; may be empty. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string } -// QueryKeysClientCreateOptions contains the optional parameters for the QueryKeysClient.Create method. -type QueryKeysClientCreateOptions struct { - // placeholder for future optional parameters -} +// QuotaUsageResult - Describes the quota usage for a particular sku supported by Azure Cognitive Search. +type QuotaUsageResult struct { + // The currently used up value for the particular search sku. + CurrentValue *int32 + + // The resource id of the quota usage sku endpoint for Microsoft.Search provider. + ID *string + + // The quota limit for the particular search sku. + Limit *int32 + + // The unit of measurement for the search sku. + Unit *string -// QueryKeysClientDeleteOptions contains the optional parameters for the QueryKeysClient.Delete method. -type QueryKeysClientDeleteOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The name of the sku supported by Azure Cognitive Search. + Name *QuotaUsageResultName } -// QueryKeysClientListBySearchServiceOptions contains the optional parameters for the QueryKeysClient.NewListBySearchServicePager -// method. -type QueryKeysClientListBySearchServiceOptions struct { - // placeholder for future optional parameters +// QuotaUsageResultName - The name of the sku supported by Azure Cognitive Search. +type QuotaUsageResultName struct { + // The localized string value for the sku supported by Azure Cognitive Search. + LocalizedValue *string + + // The sku name supported by Azure Cognitive Search. + Value *string } // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // SKU - Defines the SKU of an Azure Cognitive Search Service, which determines price tier and capacity limits. @@ -306,81 +306,89 @@ type SKU struct { // if you also set the hostingMode property to 'highDensity'). 'storageoptimizedl1': Supports 1TB per partition, up to 12 // partitions. 'storageoptimizedl2': Supports 2TB per partition, up to 12 // partitions.' - Name *SKUName `json:"name,omitempty"` -} - -// SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get method. -type SearchManagementRequestOptions struct { - // A client-generated GUID value that identifies this request. If specified, this will be included in response information - // as a way to track the request. - ClientRequestID *string + Name *SKUName } // Service - Describes an Azure Cognitive Search service and its current state. type Service struct { // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // The identity of the resource. - Identity *Identity `json:"identity,omitempty"` + Identity *Identity // Properties of the search service. - Properties *ServiceProperties `json:"properties,omitempty"` + Properties *ServiceProperties // The SKU of the Search Service, which determines price tier and capacity limits. This property is required when creating // a new Search Service. - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // 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"` + NextLink *string - // READ-ONLY; The list of search services. - Value []*Service `json:"value,omitempty" azure:"ro"` + // READ-ONLY; The list of Search services. + Value []*Service } // 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 + + // 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 + + // Specifies any policy regarding encryption of resources (such as indexes) using customer manager keys within a search service. + EncryptionWithCmk *EncryptionWithCmk + // 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 // 'default'. - HostingMode *HostingMode `json:"hostingMode,omitempty"` + HostingMode *HostingMode // Network specific rules that determine how the Azure Cognitive Search service may be reached. - NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` + NetworkRuleSet *NetworkRuleSet // The number of partitions in the search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are // only valid for standard SKUs. For 'standard3' services with hostingMode set to // 'highDensity', the allowed values are between 1 and 3. - PartitionCount *int32 `json:"partitionCount,omitempty"` + PartitionCount *int32 // This value can be set to 'enabled' to avoid breaking changes on existing customer resources and templates. If set to 'disabled', // traffic over public interface is not allowed, and private endpoint // connections would be the exclusive access method. - PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + PublicNetworkAccess *PublicNetworkAccess // The number of replicas in the search service. If specified, it must be a value between 1 and 12 inclusive for standard // SKUs or between 1 and 3 inclusive for basic SKU. - ReplicaCount *int32 `json:"replicaCount,omitempty"` + ReplicaCount *int32 + + // Sets options that control the availability of semantic search. This configuration is only possible for certain Azure Cognitive + // Search SKUs in certain locations. + SemanticSearch *SearchSemanticSearch // READ-ONLY; The list of private endpoint connections to the Azure Cognitive Search service. - PrivateEndpointConnections []*PrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` + PrivateEndpointConnections []*PrivateEndpointConnection // READ-ONLY; The state of the last provisioning operation performed on the search service. Provisioning is an intermediate // state that occurs while service capacity is being established. After capacity is set up, @@ -389,10 +397,10 @@ type ServiceProperties struct { // Search Service operation to see when an operation is completed. If you are using the free service, this value tends to // come back as 'succeeded' directly in the call to Create search service. This is // because the free service uses capacity that is already set up. - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + ProvisioningState *ProvisioningState // READ-ONLY; The list of shared private link resources managed by the Azure Cognitive Search service. - SharedPrivateLinkResources []*SharedPrivateLinkResource `json:"sharedPrivateLinkResources,omitempty" azure:"ro"` + SharedPrivateLinkResources []*SharedPrivateLinkResource // READ-ONLY; 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 @@ -403,79 +411,40 @@ type ServiceProperties struct { // 'error': The search service is in an error state. If your service is in the degraded, disabled, or error states, it means // the Azure Cognitive Search team is actively investigating the underlying // issue. Dedicated services in these states are still chargeable based on the number of search units provisioned. - Status *SearchServiceStatus `json:"status,omitempty" azure:"ro"` + Status *SearchServiceStatus // READ-ONLY; The details of the search service status. - StatusDetails *string `json:"statusDetails,omitempty" azure:"ro"` + StatusDetails *string } // ServiceUpdate - The parameters used to update an Azure Cognitive Search service. type ServiceUpdate struct { // The identity of the resource. - Identity *Identity `json:"identity,omitempty"` + Identity *Identity // The geographic location of the resource. This must be one of the supported and registered Azure Geo Regions (for example, // West US, East US, Southeast Asia, and so forth). This property is required // when creating a new resource. - Location *string `json:"location,omitempty"` + Location *string // Properties of the search service. - Properties *ServiceProperties `json:"properties,omitempty"` + Properties *ServiceProperties // The SKU of the Search Service, which determines price tier and capacity limits. This property is required when creating // a new Search Service. - SKU *SKU `json:"sku,omitempty"` + SKU *SKU // Tags to help categorize the resource in the Azure portal. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServicesClient.BeginCreateOrUpdate method. -type ServicesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServicesClientCheckNameAvailabilityOptions contains the optional parameters for the ServicesClient.CheckNameAvailability -// method. -type ServicesClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// ServicesClientDeleteOptions contains the optional parameters for the ServicesClient.Delete method. -type ServicesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. -type ServicesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.NewListByResourceGroupPager -// method. -type ServicesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.NewListBySubscriptionPager -// method. -type ServicesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// ServicesClientUpdateOptions contains the optional parameters for the ServicesClient.Update method. -type ServicesClientUpdateOptions struct { - // placeholder for future optional parameters + Type *string } // ShareablePrivateLinkResourceProperties - Describes the properties of a resource type that has been onboarded to private @@ -483,15 +452,15 @@ type ServicesClientUpdateOptions struct { type ShareablePrivateLinkResourceProperties struct { // READ-ONLY; The description of the resource type that has been onboarded to private link service, supported by Azure Cognitive // Search. - Description *string `json:"description,omitempty" azure:"ro"` + Description *string // READ-ONLY; The resource provider group id for the resource that has been onboarded to private link service, supported by // Azure Cognitive Search. - GroupID *string `json:"groupId,omitempty" azure:"ro"` + GroupID *string // READ-ONLY; The resource provider type for the resource that has been onboarded to private link service, supported by Azure // Cognitive Search. - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // ShareablePrivateLinkResourceType - Describes an resource type that has been onboarded to private link service, supported @@ -499,102 +468,76 @@ type ShareablePrivateLinkResourceProperties struct { type ShareablePrivateLinkResourceType struct { // READ-ONLY; The name of the resource type that has been onboarded to private link service, supported by Azure Cognitive // Search. - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; Describes the properties of a resource type that has been onboarded to private link service, supported by Azure // Cognitive Search. - Properties *ShareablePrivateLinkResourceProperties `json:"properties,omitempty" azure:"ro"` + Properties *ShareablePrivateLinkResourceProperties } // SharedPrivateLinkResource - Describes a Shared Private Link Resource managed by the Azure Cognitive Search service. type SharedPrivateLinkResource struct { // Describes the properties of a Shared Private Link Resource managed by the Azure Cognitive Search service. - Properties *SharedPrivateLinkResourceProperties `json:"properties,omitempty"` + Properties *SharedPrivateLinkResourceProperties // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } // 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"` + NextLink *string // READ-ONLY; The list of Shared Private Link Resources. - Value []*SharedPrivateLinkResource `json:"value,omitempty" azure:"ro"` + Value []*SharedPrivateLinkResource } // SharedPrivateLinkResourceProperties - Describes the properties of an existing Shared Private Link Resource managed by the // Azure Cognitive Search service. type SharedPrivateLinkResourceProperties struct { // The group id from the provider of resource the shared private link resource is for. - GroupID *string `json:"groupId,omitempty"` + GroupID *string // The resource id of the resource the shared private link resource is for. - PrivateLinkResourceID *string `json:"privateLinkResourceId,omitempty"` + PrivateLinkResourceID *string // The provisioning state of the shared private link resource. Can be Updating, Deleting, Failed, Succeeded or Incomplete. - ProvisioningState *SharedPrivateLinkResourceProvisioningState `json:"provisioningState,omitempty"` + ProvisioningState *SharedPrivateLinkResourceProvisioningState // The request message for requesting approval of the shared private link resource. - RequestMessage *string `json:"requestMessage,omitempty"` + RequestMessage *string // Optional. Can be used to specify the Azure Resource Manager location of the resource to which a shared private link is // to be created. This is only required for those resources whose DNS configuration // are regional (such as Azure Kubernetes Service). - ResourceRegion *string `json:"resourceRegion,omitempty"` + ResourceRegion *string // Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected. - Status *SharedPrivateLinkResourceStatus `json:"status,omitempty"` -} - -// SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate -// method. -type SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete -// method. -type SharedPrivateLinkResourcesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get -// method. -type SharedPrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// SharedPrivateLinkResourcesClientListByServiceOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListByServicePager -// method. -type SharedPrivateLinkResourcesClientListByServiceOptions struct { - // placeholder for future optional parameters + Status *SharedPrivateLinkResourceStatus } // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` + Location *string // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` + Tags map[string]*string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` + ID *string // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` + Name *string // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` + Type *string } diff --git a/sdk/resourcemanager/search/armsearch/models_serde.go b/sdk/resourcemanager/search/armsearch/models_serde.go index 4a2a049e3501..0d326af9d998 100644 --- a/sdk/resourcemanager/search/armsearch/models_serde.go +++ b/sdk/resourcemanager/search/armsearch/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch @@ -140,6 +139,95 @@ func (c *CheckNameAvailabilityOutput) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DataPlaneAADOrAPIKeyAuthOption. +func (d DataPlaneAADOrAPIKeyAuthOption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) + populate(objectMap, "aadOrApiKey", d.AADOrAPIKey) + populateAny(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]any) + 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]any) @@ -434,8 +522,10 @@ func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) populate(objectMap, "privateEndpoint", p.PrivateEndpoint) populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) return json.Marshal(objectMap) } @@ -448,12 +538,18 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { 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) @@ -660,6 +756,80 @@ func (q *QueryKey) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type QuotaUsageResult. +func (q QuotaUsageResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentValue", q.CurrentValue) + populate(objectMap, "id", q.ID) + populate(objectMap, "limit", q.Limit) + populate(objectMap, "name", q.Name) + populate(objectMap, "unit", q.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaUsageResult. +func (q *QuotaUsageResult) 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 "currentValue": + err = unpopulate(val, "CurrentValue", &q.CurrentValue) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &q.ID) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &q.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &q.Unit) + 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 QuotaUsageResultName. +func (q QuotaUsageResultName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "localizedValue", q.LocalizedValue) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaUsageResultName. +func (q *QuotaUsageResultName) 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 "localizedValue": + err = unpopulate(val, "LocalizedValue", &q.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + 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]any) @@ -811,6 +981,9 @@ func (s *ServiceListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ServiceProperties. func (s ServiceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + 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) @@ -818,6 +991,7 @@ func (s ServiceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) populate(objectMap, "replicaCount", s.ReplicaCount) + populate(objectMap, "semanticSearch", s.SemanticSearch) populate(objectMap, "sharedPrivateLinkResources", s.SharedPrivateLinkResources) populate(objectMap, "status", s.Status) populate(objectMap, "statusDetails", s.StatusDetails) @@ -833,6 +1007,15 @@ func (s *ServiceProperties) UnmarshalJSON(data []byte) error { 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) @@ -854,6 +1037,9 @@ func (s *ServiceProperties) UnmarshalJSON(data []byte) error { case "replicaCount": err = unpopulate(val, "ReplicaCount", &s.ReplicaCount) delete(rawMsg, key) + case "semanticSearch": + err = unpopulate(val, "SemanticSearch", &s.SemanticSearch) + delete(rawMsg, key) case "sharedPrivateLinkResources": err = unpopulate(val, "SharedPrivateLinkResources", &s.SharedPrivateLinkResources) delete(rawMsg, key) @@ -1162,6 +1348,16 @@ func populate(m map[string]any, k string, v any) { } } +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil diff --git a/sdk/resourcemanager/search/armsearch/operations_client.go b/sdk/resourcemanager/search/armsearch/operations_client.go index 09048e0965a7..191ec85eeb82 100644 --- a/sdk/resourcemanager/search/armsearch/operations_client.go +++ b/sdk/resourcemanager/search/armsearch/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations of the Microsoft.Search provider. // -// Generated from API version 2020-08-01 +// Generated from API version 2023-11-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +71,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/search/armsearch/operations_client_example_test.go b/sdk/resourcemanager/search/armsearch/operations_client_example_test.go deleted file mode 100644 index d2b1117372fa..000000000000 --- a/sdk/resourcemanager/search/armsearch/operations_client_example_test.go +++ /dev/null @@ -1,298 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/OperationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armsearch.OperationListResult{ - // Value: []*armsearch.Operation{ - // { - // Name: to.Ptr("Microsoft.Search/operations/read"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Lists all of the available operations of the Microsoft.Search provider."), - // Operation: to.Ptr("List all available operations"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Search Services"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/register/action"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Registers the subscription for the search resource provider and enables the creation of search services."), - // Operation: to.Ptr("Register the Search Resource Provider"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Search Services"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/write"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Creates or updates the search service."), - // Operation: to.Ptr("Set Search Service"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Search Services"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/read"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Reads the search service."), - // Operation: to.Ptr("Get Search Service"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Search Services"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/delete"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Deletes the search service."), - // Operation: to.Ptr("Delete Search Service"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Search Services"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/start/action"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Starts the search service."), - // Operation: to.Ptr("Start Search Service"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Search Services"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/stop/action"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Stops the search service."), - // Operation: to.Ptr("Stop Search Service"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Search Services"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/listAdminKeys/action"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Reads the admin keys."), - // Operation: to.Ptr("Get Admin Key"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Search Services"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/regenerateAdminKey/action"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Regenerates the admin key."), - // Operation: to.Ptr("Regenerate Admin Key"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Search Services"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/listQueryKeys/action"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Returns the list of query API keys for the given Azure Search service."), - // Operation: to.Ptr("Get Query Keys"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("API Keys"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/createQueryKey/action"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Creates the query key."), - // Operation: to.Ptr("Create Query Key"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Search Services"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/deleteQueryKey/delete"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Deletes the query key."), - // Operation: to.Ptr("Delete Query Key"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("API Keys"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/checkNameAvailability/action"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Checks availability of the service name."), - // Operation: to.Ptr("Check Service Name Availability"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Service Name Availability"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/diagnosticSettings/read"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Gets the diganostic setting read for the resource"), - // Operation: to.Ptr("Get Diagnostic Setting"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Diagnostic Settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/diagnosticSettings/write"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Creates or updates the diganostic setting for the resource"), - // Operation: to.Ptr("Set Diagnostic Setting"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Diagnostic Settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/metricDefinitions/read"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Gets the available metrics for the search service"), - // Operation: to.Ptr("Read search service metric definitions"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("The metric definitions for the search service"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/logDefinitions/read"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Gets the available logs for the search service"), - // Operation: to.Ptr("Read search service log definitions"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("The log definition for the search service"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnectionProxies/validate/action"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Validates a private endpoint connection create call from NRP side"), - // Operation: to.Ptr("Validate Private Endpoint Connection Proxy"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Private Endpoint Connection Proxy"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnectionProxies/write"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Creates a private endpoint connection proxy with the specified parameters or updates the properties or tags for the specified private endpoint connection proxy"), - // Operation: to.Ptr("Create Private Endpoint Connection Proxy"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Private Endpoint Connection Proxy"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnectionProxies/read"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Returns the list of private endpoint connection proxies or gets the properties for the specified private endpoint connection proxy"), - // Operation: to.Ptr("Get Private Endpoint Connection Proxy"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Private Endpoint Connection Proxy"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnectionProxies/delete"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Deletes an existing private endpoint connection proxy"), - // Operation: to.Ptr("Delete Private Endpoint Connection Proxy"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Private Endpoint Connection Proxy"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections/write"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Creates a private endpoint connections with the specified parameters or updates the properties or tags for the specified private endpoint connections"), - // Operation: to.Ptr("Create Private Endpoint Connection"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Private Endpoint Connection"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections/read"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Returns the list of private endpoint connections or gets the properties for the specified private endpoint connections"), - // Operation: to.Ptr("Get Private Endpoint Connection"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Private Endpoint Connection"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections/delete"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Deletes an existing private endpoint connections"), - // Operation: to.Ptr("Delete Private Endpoint Connection"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Private Endpoint Connection"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources/write"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Creates a new shared private link resource with the specified parameters or updates the properties for the specified shared private link resource"), - // Operation: to.Ptr("Create Shared Private Link Resource"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Shared Private Link Resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources/read"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Returns the list of shared private link resources or gets the properties for the specified shared private link resource"), - // Operation: to.Ptr("Get Shared Private Link Resource"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Shared Private Link Resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources/delete"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Deletes an existing shared private link resource"), - // Operation: to.Ptr("Delete Shared Private Link Resource"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Shared Private Link Resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources/operationStatuses/read"), - // Display: &armsearch.OperationDisplay{ - // Description: to.Ptr("Get the details of a long running shared private link resource operation"), - // Operation: to.Ptr("Get Operation Status"), - // Provider: to.Ptr("Microsoft Search"), - // Resource: to.Ptr("Shared Private Link Resource"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/search/armsearch/options.go b/sdk/resourcemanager/search/armsearch/options.go new file mode 100644 index 000000000000..03a1099494ab --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/options.go @@ -0,0 +1,154 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsearch + +// AdminKeysClientGetOptions contains the optional parameters for the AdminKeysClient.Get method. +type AdminKeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// AdminKeysClientRegenerateOptions contains the optional parameters for the AdminKeysClient.Regenerate method. +type AdminKeysClientRegenerateOptions struct { + // placeholder for future optional parameters +} + +// ManagementClientUsageBySubscriptionSKUOptions contains the optional parameters for the ManagementClient.UsageBySubscriptionSKU +// method. +type ManagementClientUsageBySubscriptionSKUOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete +// method. +type PrivateEndpointConnectionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByServiceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByServicePager +// method. +type PrivateEndpointConnectionsClientListByServiceOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. +type PrivateEndpointConnectionsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListSupportedOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListSupportedPager +// method. +type PrivateLinkResourcesClientListSupportedOptions struct { + // placeholder for future optional parameters +} + +// QueryKeysClientCreateOptions contains the optional parameters for the QueryKeysClient.Create method. +type QueryKeysClientCreateOptions struct { + // placeholder for future optional parameters +} + +// QueryKeysClientDeleteOptions contains the optional parameters for the QueryKeysClient.Delete method. +type QueryKeysClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// QueryKeysClientListBySearchServiceOptions contains the optional parameters for the QueryKeysClient.NewListBySearchServicePager +// method. +type QueryKeysClientListBySearchServiceOptions struct { + // placeholder for future optional parameters +} + +// SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get method. +type SearchManagementRequestOptions struct { + // A client-generated GUID value that identifies this request. If specified, this will be included in response information + // as a way to track the request. + ClientRequestID *string +} + +// ServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServicesClient.BeginCreateOrUpdate method. +type ServicesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServicesClientCheckNameAvailabilityOptions contains the optional parameters for the ServicesClient.CheckNameAvailability +// method. +type ServicesClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ServicesClientDeleteOptions contains the optional parameters for the ServicesClient.Delete method. +type ServicesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. +type ServicesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.NewListByResourceGroupPager +// method. +type ServicesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.NewListBySubscriptionPager +// method. +type ServicesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ServicesClientUpdateOptions contains the optional parameters for the ServicesClient.Update method. +type ServicesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate +// method. +type SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete +// method. +type SharedPrivateLinkResourcesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get +// method. +type SharedPrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SharedPrivateLinkResourcesClientListByServiceOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListByServicePager +// method. +type SharedPrivateLinkResourcesClientListByServiceOptions struct { + // placeholder for future optional parameters +} + +// UsagesClientListBySubscriptionOptions contains the optional parameters for the UsagesClient.NewListBySubscriptionPager +// method. +type UsagesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/search/armsearch/privateendpointconnections_client.go b/sdk/resourcemanager/search/armsearch/privateendpointconnections_client.go index 63c2e285a748..c74829ccf827 100644 --- a/sdk/resourcemanager/search/armsearch/privateendpointconnections_client.go +++ b/sdk/resourcemanager/search/armsearch/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch @@ -48,7 +47,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 2023-11-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. @@ -59,18 +58,21 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // - options - PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete // method. func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, searchServiceName string, privateEndpointConnectionName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *PrivateEndpointConnectionsClientDeleteOptions) (PrivateEndpointConnectionsClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, searchServiceName, privateEndpointConnectionName, searchManagementRequestOptions, options) if err != nil { return PrivateEndpointConnectionsClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNotFound) { - return PrivateEndpointConnectionsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientDeleteResponse{}, err } - return client.deleteHandleResponse(resp) + resp, err := client.deleteHandleResponse(httpResp) + return resp, err } // deleteCreateRequest creates the Delete request. @@ -97,7 +99,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -118,7 +120,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 2023-11-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. @@ -129,18 +131,21 @@ func (client *PrivateEndpointConnectionsClient) deleteHandleResponse(resp *http. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, searchServiceName string, privateEndpointConnectionName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, searchServiceName, privateEndpointConnectionName, searchManagementRequestOptions, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -167,7 +172,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", "2023-11-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 +192,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByServicePager - Gets a list of all private endpoint connections in the given service. // -// Generated from API version 2020-08-01 +// Generated from API version 2023-11-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. @@ -243,7 +248,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -264,7 +269,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 2023-11-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. @@ -276,18 +281,21 @@ func (client *PrivateEndpointConnectionsClient) listByServiceHandleResponse(resp // - options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update // method. func (client *PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, searchServiceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, searchManagementRequestOptions *SearchManagementRequestOptions, options *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, searchServiceName, privateEndpointConnectionName, privateEndpointConnection, searchManagementRequestOptions, options) if err != nil { return PrivateEndpointConnectionsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -314,13 +322,16 @@ 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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, privateEndpointConnection) + if err := runtime.MarshalAsJSON(req, privateEndpointConnection); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/search/armsearch/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/search/armsearch/privateendpointconnections_client_example_test.go deleted file mode 100644 index 43a177dd6c5f..000000000000 --- a/sdk/resourcemanager/search/armsearch/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,174 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armsearch.PrivateEndpointConnection{ - // Name: to.Ptr("testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), - // Type: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/privateEndpointConnections/testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), - // Properties: &armsearch.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsearch.PrivateEndpointConnectionPropertiesPrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ - // Description: to.Ptr("Rejected for some reason"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusRejected), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armsearch.PrivateEndpointConnection{ - // Name: to.Ptr("testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), - // Type: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/privateEndpointConnections/testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), - // Properties: &armsearch.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsearch.PrivateEndpointConnectionPropertiesPrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ - // Description: to.Ptr(""), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusApproved), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armsearch.PrivateEndpointConnection{ - // Name: to.Ptr("testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), - // Type: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/privateEndpointConnections/testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), - // Properties: &armsearch.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsearch.PrivateEndpointConnectionPropertiesPrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ - // Description: to.Ptr(""), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusDisconnected), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByServicePager("rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armsearch.PrivateEndpointConnectionListResult{ - // Value: []*armsearch.PrivateEndpointConnection{ - // { - // Name: to.Ptr("testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), - // Type: to.Ptr("Microsoft.Search/searchServices/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/privateEndpointConnections/testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546"), - // Properties: &armsearch.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsearch.PrivateEndpointConnectionPropertiesPrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/testEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsearch.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState{ - // Description: to.Ptr(""), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsearch.PrivateLinkServiceConnectionStatusApproved), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/search/armsearch/privatelinkresources_client.go b/sdk/resourcemanager/search/armsearch/privatelinkresources_client.go index 00f10e789b82..b98ffbe622ca 100644 --- a/sdk/resourcemanager/search/armsearch/privatelinkresources_client.go +++ b/sdk/resourcemanager/search/armsearch/privatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch @@ -47,7 +46,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // NewListSupportedPager - Gets a list of all supported private link resource types for the given service. // -// Generated from API version 2020-08-01 +// Generated from API version 2023-11-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. @@ -97,7 +96,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", "2023-11-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/privatelinkresources_client_example_test.go b/sdk/resourcemanager/search/armsearch/privatelinkresources_client_example_test.go deleted file mode 100644 index 2988e05241b4..000000000000 --- a/sdk/resourcemanager/search/armsearch/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,115 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().NewListSupportedPager("rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkResourcesResult = armsearch.PrivateLinkResourcesResult{ - // Value: []*armsearch.PrivateLinkResource{ - // { - // Name: to.Ptr("searchService"), - // Type: to.Ptr("Microsoft.Search/searchServices/privateLinkResources"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/privateLinkResources/searchService"), - // Properties: &armsearch.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("searchService"), - // RequiredMembers: []*string{ - // to.Ptr("searchService")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.search.windows.net")}, - // ShareablePrivateLinkResourceTypes: []*armsearch.ShareablePrivateLinkResourceType{ - // { - // Name: to.Ptr("blob"), - // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ - // Type: to.Ptr("Microsoft.Storage/storageAccounts"), - // Description: to.Ptr("Azure Cognitive Search indexers can connect to blobs in Azure Storage for reading data (data source), for writing intermediate results of indexer execution (annotation cache, preview) or for storing any knowledge store projections (preview)"), - // GroupID: to.Ptr("blob"), - // }, - // }, - // { - // Name: to.Ptr("table"), - // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ - // Type: to.Ptr("Microsoft.Storage/storageAccounts"), - // Description: to.Ptr("Azure Cognitive Search indexers can connect to tables in Azure Storage for reading data (data source), for writing book-keeping information about intermediate results of indexer execution (annotation cache, preview) or for storing any knowledge store projections (preview)"), - // GroupID: to.Ptr("table"), - // }, - // }, - // { - // Name: to.Ptr("Sql"), - // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ - // Type: to.Ptr("Microsoft.DocumentDB/databaseAccounts"), - // Description: to.Ptr("Azure Cognitive Search indexers can connect to CosmosDB using the SQL head for reading data (data source)."), - // GroupID: to.Ptr("Sql"), - // }, - // }, - // { - // Name: to.Ptr("plr"), - // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ - // Type: to.Ptr("Microsoft.Sql/servers"), - // Description: to.Ptr("Azure Cognitive Search indexers can connect to AzureSQL databases in a SQL server for reading data (data source)."), - // GroupID: to.Ptr("sqlServer"), - // }, - // }, - // { - // Name: to.Ptr("vault"), - // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ - // Type: to.Ptr("Microsoft.KeyVault/vaults"), - // Description: to.Ptr("Azure Cognitive Search can access keys in Azure Key Vault to encrypt search index and synonym map data"), - // GroupID: to.Ptr("vault"), - // }, - // }, - // { - // Name: to.Ptr("plr"), - // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // Description: to.Ptr("Azure Cognitive Search indexers can connect to MySQL databases for reading data (data source, preview)."), - // GroupID: to.Ptr("mysqlServer"), - // }, - // }, - // { - // Name: to.Ptr("site"), - // Properties: &armsearch.ShareablePrivateLinkResourceProperties{ - // Type: to.Ptr("Microsoft.Web/sites"), - // Description: to.Ptr("Azure Cognitive Search indexers can connect to App Services when executing custom web api skills that can be present in a skillset (optional) attached to the indexer."), - // GroupID: to.Ptr("sites"), - // }, - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/search/armsearch/querykeys_client.go b/sdk/resourcemanager/search/armsearch/querykeys_client.go index 715ff56b34fd..0307a35b9b1c 100644 --- a/sdk/resourcemanager/search/armsearch/querykeys_client.go +++ b/sdk/resourcemanager/search/armsearch/querykeys_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch @@ -48,7 +47,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 2023-11-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. @@ -57,18 +56,21 @@ func NewQueryKeysClient(subscriptionID string, credential azcore.TokenCredential // method. // - options - QueryKeysClientCreateOptions contains the optional parameters for the QueryKeysClient.Create method. func (client *QueryKeysClient) Create(ctx context.Context, resourceGroupName string, searchServiceName string, name string, searchManagementRequestOptions *SearchManagementRequestOptions, options *QueryKeysClientCreateOptions) (QueryKeysClientCreateResponse, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, searchServiceName, name, searchManagementRequestOptions, options) if err != nil { return QueryKeysClientCreateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return QueryKeysClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return QueryKeysClientCreateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return QueryKeysClientCreateResponse{}, err } - return client.createHandleResponse(resp) + resp, err := client.createHandleResponse(httpResp) + return resp, err } // createCreateRequest creates the Create request. @@ -95,7 +97,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -117,7 +119,7 @@ func (client *QueryKeysClient) createHandleResponse(resp *http.Response) (QueryK // 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 2023-11-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. @@ -126,16 +128,18 @@ func (client *QueryKeysClient) createHandleResponse(resp *http.Response) (QueryK // method. // - options - QueryKeysClientDeleteOptions contains the optional parameters for the QueryKeysClient.Delete method. func (client *QueryKeysClient) Delete(ctx context.Context, resourceGroupName string, searchServiceName string, key string, searchManagementRequestOptions *SearchManagementRequestOptions, options *QueryKeysClientDeleteOptions) (QueryKeysClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, searchServiceName, key, searchManagementRequestOptions, options) if err != nil { return QueryKeysClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return QueryKeysClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent, http.StatusNotFound) { - return QueryKeysClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return QueryKeysClientDeleteResponse{}, err } return QueryKeysClientDeleteResponse{}, nil } @@ -164,7 +168,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -175,7 +179,7 @@ func (client *QueryKeysClient) deleteCreateRequest(ctx context.Context, resource // NewListBySearchServicePager - Returns the list of query API keys for the given Azure Cognitive Search service. // -// Generated from API version 2020-08-01 +// Generated from API version 2023-11-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. @@ -231,7 +235,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", "2023-11-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/querykeys_client_example_test.go b/sdk/resourcemanager/search/armsearch/querykeys_client_example_test.go deleted file mode 100644 index 50f1bc95c1dd..000000000000 --- a/sdk/resourcemanager/search/armsearch/querykeys_client_example_test.go +++ /dev/null @@ -1,95 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryKeysClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryKey = armsearch.QueryKey{ - // Name: to.Ptr("Query key for browser-based clients"), - // Key: to.Ptr(""), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewQueryKeysClient().NewListBySearchServicePager("rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListQueryKeysResult = armsearch.ListQueryKeysResult{ - // Value: []*armsearch.QueryKey{ - // { - // Name: to.Ptr("Query key for browser-based clients"), - // Key: to.Ptr(""), - // }, - // { - // Name: to.Ptr("Query key for mobile clients"), - // Key: to.Ptr(""), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewQueryKeysClient().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/response_types.go b/sdk/resourcemanager/search/armsearch/response_types.go index f2925a184ccc..a05ef7fff059 100644 --- a/sdk/resourcemanager/search/armsearch/response_types.go +++ b/sdk/resourcemanager/search/armsearch/response_types.go @@ -3,54 +3,69 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch // AdminKeysClientGetResponse contains the response from method AdminKeysClient.Get. type AdminKeysClientGetResponse struct { + // Response containing the primary and secondary admin API keys for a given Azure Cognitive Search service. AdminKeyResult } // AdminKeysClientRegenerateResponse contains the response from method AdminKeysClient.Regenerate. type AdminKeysClientRegenerateResponse struct { + // Response containing the primary and secondary admin API keys for a given Azure Cognitive Search service. AdminKeyResult } +// ManagementClientUsageBySubscriptionSKUResponse contains the response from method ManagementClient.UsageBySubscriptionSKU. +type ManagementClientUsageBySubscriptionSKUResponse struct { + // Describes the quota usage for a particular sku supported by Azure Cognitive Search. + QuotaUsageResult +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // The result of the request to list REST API operations. It contains a list of operations and a URL to get the next set of + // results. OperationListResult } // PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. type PrivateEndpointConnectionsClientDeleteResponse struct { + // Describes an existing Private Endpoint connection to the Azure Cognitive Search service. PrivateEndpointConnection } // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // Describes an existing Private Endpoint connection to the Azure Cognitive Search service. PrivateEndpointConnection } // PrivateEndpointConnectionsClientListByServiceResponse contains the response from method PrivateEndpointConnectionsClient.NewListByServicePager. type PrivateEndpointConnectionsClientListByServiceResponse struct { + // Response containing a list of Private Endpoint connections. PrivateEndpointConnectionListResult } // PrivateEndpointConnectionsClientUpdateResponse contains the response from method PrivateEndpointConnectionsClient.Update. type PrivateEndpointConnectionsClientUpdateResponse struct { + // Describes an existing Private Endpoint connection to the Azure Cognitive Search service. PrivateEndpointConnection } // PrivateLinkResourcesClientListSupportedResponse contains the response from method PrivateLinkResourcesClient.NewListSupportedPager. type PrivateLinkResourcesClientListSupportedResponse struct { + // Response containing a list of supported Private Link Resources. PrivateLinkResourcesResult } // QueryKeysClientCreateResponse contains the response from method QueryKeysClient.Create. type QueryKeysClientCreateResponse struct { + // Describes an API key for a given Azure Cognitive Search service that has permissions for query operations only. QueryKey } @@ -61,16 +76,19 @@ type QueryKeysClientDeleteResponse struct { // QueryKeysClientListBySearchServiceResponse contains the response from method QueryKeysClient.NewListBySearchServicePager. type QueryKeysClientListBySearchServiceResponse struct { + // Response containing the query API keys for a given Azure Cognitive Search service. ListQueryKeysResult } // ServicesClientCheckNameAvailabilityResponse contains the response from method ServicesClient.CheckNameAvailability. type ServicesClientCheckNameAvailabilityResponse struct { + // Output of check name availability API. CheckNameAvailabilityOutput } // ServicesClientCreateOrUpdateResponse contains the response from method ServicesClient.BeginCreateOrUpdate. type ServicesClientCreateOrUpdateResponse struct { + // Describes an Azure Cognitive Search service and its current state. Service } @@ -81,26 +99,31 @@ type ServicesClientDeleteResponse struct { // ServicesClientGetResponse contains the response from method ServicesClient.Get. type ServicesClientGetResponse struct { + // Describes an Azure Cognitive Search service and its current state. Service } // ServicesClientListByResourceGroupResponse contains the response from method ServicesClient.NewListByResourceGroupPager. type ServicesClientListByResourceGroupResponse struct { + // Response containing a list of Azure Cognitive Search services. ServiceListResult } // ServicesClientListBySubscriptionResponse contains the response from method ServicesClient.NewListBySubscriptionPager. type ServicesClientListBySubscriptionResponse struct { + // Response containing a list of Azure Cognitive Search services. ServiceListResult } // ServicesClientUpdateResponse contains the response from method ServicesClient.Update. type ServicesClientUpdateResponse struct { + // Describes an Azure Cognitive Search service and its current state. Service } // SharedPrivateLinkResourcesClientCreateOrUpdateResponse contains the response from method SharedPrivateLinkResourcesClient.BeginCreateOrUpdate. type SharedPrivateLinkResourcesClientCreateOrUpdateResponse struct { + // Describes a Shared Private Link Resource managed by the Azure Cognitive Search service. SharedPrivateLinkResource } @@ -111,10 +134,18 @@ type SharedPrivateLinkResourcesClientDeleteResponse struct { // SharedPrivateLinkResourcesClientGetResponse contains the response from method SharedPrivateLinkResourcesClient.Get. type SharedPrivateLinkResourcesClientGetResponse struct { + // Describes a Shared Private Link Resource managed by the Azure Cognitive Search service. SharedPrivateLinkResource } // SharedPrivateLinkResourcesClientListByServiceResponse contains the response from method SharedPrivateLinkResourcesClient.NewListByServicePager. type SharedPrivateLinkResourcesClientListByServiceResponse struct { + // Response containing a list of Shared Private Link Resources. SharedPrivateLinkResourceListResult } + +// UsagesClientListBySubscriptionResponse contains the response from method UsagesClient.NewListBySubscriptionPager. +type UsagesClientListBySubscriptionResponse struct { + // Response containing the quota usage information for all the supported skus of Azure Cognitive Search service. + QuotaUsagesListResult +} diff --git a/sdk/resourcemanager/search/armsearch/services_client.go b/sdk/resourcemanager/search/armsearch/services_client.go index 1e433c939a5f..22f20a811b9e 100644 --- a/sdk/resourcemanager/search/armsearch/services_client.go +++ b/sdk/resourcemanager/search/armsearch/services_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch @@ -49,25 +48,28 @@ func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, // 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 2023-11-01 // - checkNameAvailabilityInput - The resource name and type to check. // - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get // method. // - options - ServicesClientCheckNameAvailabilityOptions contains the optional parameters for the ServicesClient.CheckNameAvailability // method. func (client *ServicesClient) CheckNameAvailability(ctx context.Context, checkNameAvailabilityInput CheckNameAvailabilityInput, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientCheckNameAvailabilityOptions) (ServicesClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, checkNameAvailabilityInput, searchManagementRequestOptions, options) if err != nil { return ServicesClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServicesClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServicesClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -82,13 +84,16 @@ 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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, checkNameAvailabilityInput) + if err := runtime.MarshalAsJSON(req, checkNameAvailabilityInput); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -104,7 +109,7 @@ func (client *ServicesClient) checkNameAvailabilityHandleResponse(resp *http.Res // 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 2023-11-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 @@ -123,7 +128,8 @@ func (client *ServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller[ServicesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServicesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServicesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -133,20 +139,22 @@ func (client *ServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceG // 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 2023-11-01 func (client *ServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, searchServiceName string, service Service, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, searchServiceName, service, searchManagementRequestOptions, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -169,19 +177,22 @@ 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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, service) + if err := runtime.MarshalAsJSON(req, service); err != nil { + return nil, err + } + return req, nil } // 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 2023-11-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. @@ -189,16 +200,18 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r // method. // - options - ServicesClientDeleteOptions contains the optional parameters for the ServicesClient.Delete method. func (client *ServicesClient) Delete(ctx context.Context, resourceGroupName string, searchServiceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientDeleteOptions) (ServicesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, searchServiceName, searchManagementRequestOptions, options) if err != nil { return ServicesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent, http.StatusNotFound) { - return ServicesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return ServicesClientDeleteResponse{}, err } return ServicesClientDeleteResponse{}, nil } @@ -223,7 +236,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -235,7 +248,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 2023-11-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. @@ -243,18 +256,21 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG // method. // - options - ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. func (client *ServicesClient) Get(ctx context.Context, resourceGroupName string, searchServiceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientGetOptions) (ServicesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, searchServiceName, searchManagementRequestOptions, options) if err != nil { return ServicesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServicesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServicesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -277,7 +293,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -295,9 +311,9 @@ func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesCl return result, nil } -// NewListByResourceGroupPager - Gets a list of all search services in the given resource group. +// NewListByResourceGroupPager - Gets a list of all Search services in the given resource group. // -// Generated from API version 2020-08-01 +// Generated from API version 2023-11-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 @@ -348,7 +364,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -366,9 +382,9 @@ func (client *ServicesClient) listByResourceGroupHandleResponse(resp *http.Respo return result, nil } -// NewListBySubscriptionPager - Gets a list of all search services in the given subscription. +// NewListBySubscriptionPager - Gets a list of all Search services in the given subscription. // -// Generated from API version 2020-08-01 +// Generated from API version 2023-11-01 // - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get // method. // - options - ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.NewListBySubscriptionPager @@ -413,7 +429,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -434,7 +450,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 2023-11-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. @@ -443,18 +459,21 @@ func (client *ServicesClient) listBySubscriptionHandleResponse(resp *http.Respon // method. // - options - ServicesClientUpdateOptions contains the optional parameters for the ServicesClient.Update method. func (client *ServicesClient) Update(ctx context.Context, resourceGroupName string, searchServiceName string, service ServiceUpdate, searchManagementRequestOptions *SearchManagementRequestOptions, options *ServicesClientUpdateOptions) (ServicesClientUpdateResponse, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, searchServiceName, service, searchManagementRequestOptions, options) if err != nil { return ServicesClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServicesClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServicesClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServicesClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -477,13 +496,16 @@ 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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, service) + if err := runtime.MarshalAsJSON(req, service); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/search/armsearch/services_client_example_test.go b/sdk/resourcemanager/search/armsearch/services_client_example_test.go deleted file mode 100644 index f6818f7fbb0e..000000000000 --- a/sdk/resourcemanager/search/armsearch/services_client_example_test.go +++ /dev/null @@ -1,785 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateOrUpdateService.json -func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Service = armsearch.Service{ - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](3), - // Status: to.Ptr(armsearch.SearchServiceStatusProvisioning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json -func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServicesClient().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), - PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled), - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Service = armsearch.Service{ - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled), - // ReplicaCount: to.Ptr[int32](3), - // Status: to.Ptr(armsearch.SearchServiceStatusProvisioning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json -func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServicesClient().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), - NetworkRuleSet: &armsearch.NetworkRuleSet{ - IPRules: []*armsearch.IPRule{ - { - Value: to.Ptr("123.4.5.6"), - }, - { - Value: to.Ptr("123.4.6.0/18"), - }}, - }, - PartitionCount: to.Ptr[int32](1), - ReplicaCount: to.Ptr[int32](1), - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Service = armsearch.Service{ - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // { - // Value: to.Ptr("123.4.5.6"), - // }, - // { - // Value: to.Ptr("123.4.6.0/18"), - // }}, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](1), - // Status: to.Ptr(armsearch.SearchServiceStatusProvisioning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchCreateOrUpdateServiceWithIdentity.json -func ExampleServicesClient_BeginCreateOrUpdate_searchCreateOrUpdateServiceWithIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "rg1", "mysearchservice", armsearch.Service{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "app-name": to.Ptr("My e-commerce app"), - }, - Identity: &armsearch.Identity{ - Type: to.Ptr(armsearch.IdentityTypeSystemAssigned), - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Service = armsearch.Service{ - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // }, - // Identity: &armsearch.Identity{ - // Type: to.Ptr(armsearch.IdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("9d1e1f18-2122-4988-a11c-878782e40a5c"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](3), - // Status: to.Ptr(armsearch.SearchServiceStatusProvisioning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchUpdateService.json -func ExampleServicesClient_Update_searchUpdateService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Service = armsearch.Service{ - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // "new-tag": to.Ptr("Adding a new tag"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](2), - // Status: to.Ptr(armsearch.SearchServiceStatusProvisioning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchUpdateServiceToRemoveIdentity.json -func ExampleServicesClient_Update_searchUpdateServiceToRemoveIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{ - Identity: &armsearch.Identity{ - Type: to.Ptr(armsearch.IdentityTypeNone), - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Service = armsearch.Service{ - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // }, - // Identity: &armsearch.Identity{ - // Type: to.Ptr(armsearch.IdentityTypeNone), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](3), - // Status: to.Ptr(armsearch.SearchServiceStatusRunning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json -func ExampleServicesClient_Update_searchUpdateServiceToAllowAccessFromPrivateEndpoints() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{ - Properties: &armsearch.ServiceProperties{ - PartitionCount: to.Ptr[int32](1), - PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled), - ReplicaCount: to.Ptr[int32](1), - }, - }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Service = armsearch.Service{ - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // "new-tag": to.Ptr("Adding a new tag"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessDisabled), - // ReplicaCount: to.Ptr[int32](1), - // Status: to.Ptr(armsearch.SearchServiceStatusRunning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameBasic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/specification/search/resource-manager/Microsoft.Search/stable/2020-08-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json -func ExampleServicesClient_Update_searchUpdateServiceToAllowAccessFromPublicCustomIPs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Update(ctx, "rg1", "mysearchservice", armsearch.ServiceUpdate{ - Properties: &armsearch.ServiceProperties{ - NetworkRuleSet: &armsearch.NetworkRuleSet{ - IPRules: []*armsearch.IPRule{ - { - Value: to.Ptr("123.4.5.6"), - }, - { - Value: to.Ptr("123.4.6.0/18"), - }}, - }, - PartitionCount: to.Ptr[int32](1), - PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - ReplicaCount: to.Ptr[int32](3), - }, - }, &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Service = armsearch.Service{ - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // "new-tag": to.Ptr("Adding a new tag"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // { - // Value: to.Ptr("10.2.3.4"), - // }}, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](3), - // Status: to.Ptr(armsearch.SearchServiceStatusRunning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Get(ctx, "rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Service = armsearch.Service{ - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](3), - // Status: to.Ptr(armsearch.SearchServiceStatusRunning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewServicesClient().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/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServicesClient().NewListByResourceGroupPager("rg1", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceListResult = armsearch.ServiceListResult{ - // Value: []*armsearch.Service{ - // { - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](3), - // Status: to.Ptr(armsearch.SearchServiceStatusRunning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameStandard), - // }, - // }, - // { - // Name: to.Ptr("mysearchservice2"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](1), - // Status: to.Ptr(armsearch.SearchServiceStatusRunning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameBasic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServicesClient().NewListBySubscriptionPager(&armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServiceListResult = armsearch.ServiceListResult{ - // Value: []*armsearch.Service{ - // { - // Name: to.Ptr("mysearchservice"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](3), - // Status: to.Ptr(armsearch.SearchServiceStatusRunning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameStandard), - // }, - // }, - // { - // Name: to.Ptr("mysearchservice2"), - // Type: to.Ptr("Microsoft.Search/searchServices"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Search/searchServices/mysearchservice2"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "app-name": to.Ptr("My e-commerce app"), - // }, - // Properties: &armsearch.ServiceProperties{ - // HostingMode: to.Ptr(armsearch.HostingModeDefault), - // NetworkRuleSet: &armsearch.NetworkRuleSet{ - // IPRules: []*armsearch.IPRule{ - // }, - // }, - // PartitionCount: to.Ptr[int32](1), - // PrivateEndpointConnections: []*armsearch.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armsearch.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armsearch.PublicNetworkAccessEnabled), - // ReplicaCount: to.Ptr[int32](1), - // Status: to.Ptr(armsearch.SearchServiceStatusRunning), - // StatusDetails: to.Ptr(""), - // }, - // SKU: &armsearch.SKU{ - // Name: to.Ptr(armsearch.SKUNameBasic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameAvailabilityOutput = armsearch.CheckNameAvailabilityOutput{ - // Message: to.Ptr(""), - // IsNameAvailable: to.Ptr(false), - // Reason: to.Ptr(armsearch.UnavailableNameReasonAlreadyExists), - // } -} diff --git a/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client.go b/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client.go index 17a1d0c90d5c..1e8ee791fcf5 100644 --- a/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armsearch @@ -49,7 +48,7 @@ func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcor // 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 2023-11-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. @@ -66,9 +65,10 @@ func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -78,20 +78,22 @@ func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context. // given resource group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2020-08-01 +// Generated from API version 2023-11-01 func (client *SharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, resourceGroupName string, searchServiceName string, sharedPrivateLinkResourceName string, sharedPrivateLinkResource SharedPrivateLinkResource, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, sharedPrivateLinkResource, searchManagementRequestOptions, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -118,19 +120,22 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-08-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, sharedPrivateLinkResource) + if err := runtime.MarshalAsJSON(req, sharedPrivateLinkResource); err != nil { + return nil, err + } + return req, nil } // 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 2023-11-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. @@ -146,9 +151,10 @@ func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -157,20 +163,22 @@ 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 2023-11-01 func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, searchServiceName string, sharedPrivateLinkResourceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, searchManagementRequestOptions, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent, http.StatusNotFound) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -197,7 +205,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -209,7 +217,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 2023-11-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. @@ -220,18 +228,21 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. // - options - SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get // method. func (client *SharedPrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, searchServiceName string, sharedPrivateLinkResourceName string, searchManagementRequestOptions *SearchManagementRequestOptions, options *SharedPrivateLinkResourcesClientGetOptions) (SharedPrivateLinkResourcesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, searchServiceName, sharedPrivateLinkResourceName, searchManagementRequestOptions, options) if err != nil { return SharedPrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SharedPrivateLinkResourcesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SharedPrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SharedPrivateLinkResourcesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -258,7 +269,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", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} @@ -278,7 +289,7 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res // NewListByServicePager - Gets a list of all shared private link resources managed by the given service. // -// Generated from API version 2020-08-01 +// Generated from API version 2023-11-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. @@ -334,7 +345,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", "2023-11-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/sharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client_example_test.go deleted file mode 100644 index dc8fa50f7c15..000000000000 --- a/sdk/resourcemanager/search/armsearch/sharedprivatelinkresources_client_example_test.go +++ /dev/null @@ -1,151 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package 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/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedPrivateLinkResource = armsearch.SharedPrivateLinkResource{ - // Name: to.Ptr("testResource"), - // Type: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/sharedPrivateLinkResources/testResource"), - // Properties: &armsearch.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("blob"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName"), - // RequestMessage: to.Ptr("please approve"), - // Status: to.Ptr(armsearch.SharedPrivateLinkResourceStatusPending), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedPrivateLinkResourcesClient().Get(ctx, "rg1", "mysearchservice", "testResource", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedPrivateLinkResource = armsearch.SharedPrivateLinkResource{ - // Name: to.Ptr("testResource"), - // Type: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/sharedPrivateLinkResources/testResource"), - // Properties: &armsearch.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("blob"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName"), - // RequestMessage: to.Ptr("please approve"), - // Status: to.Ptr(armsearch.SharedPrivateLinkResourceStatusPending), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().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/blob/f790e624d0d080b89d962a3bd19c65bc6a6b2f5e/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() - clientFactory, err := armsearch.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedPrivateLinkResourcesClient().NewListByServicePager("rg1", "mysearchservice", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedPrivateLinkResourceListResult = armsearch.SharedPrivateLinkResourceListResult{ - // Value: []*armsearch.SharedPrivateLinkResource{ - // { - // Name: to.Ptr("testResource"), - // Type: to.Ptr("Microsoft.Search/searchServices/sharedPrivateLinkResources"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Search/searchServices/mysearchservice/sharedPrivateLinkResources/testResource"), - // Properties: &armsearch.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("blob"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName"), - // RequestMessage: to.Ptr("please approve"), - // Status: to.Ptr(armsearch.SharedPrivateLinkResourceStatusPending), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/search/armsearch/usages_client.go b/sdk/resourcemanager/search/armsearch/usages_client.go new file mode 100644 index 000000000000..844727809589 --- /dev/null +++ b/sdk/resourcemanager/search/armsearch/usages_client.go @@ -0,0 +1,115 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsearch + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// UsagesClient contains the methods for the Usages group. +// Don't use this type directly, use NewUsagesClient() instead. +type UsagesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewUsagesClient creates a new instance of UsagesClient with the specified values. +// - subscriptionID - The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { + cl, err := arm.NewClient(moduleName+".UsagesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &UsagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListBySubscriptionPager - Gets a list of all Search quota usages in the given subscription. +// +// Generated from API version 2023-11-01 +// - location - The unique location name for a Microsoft Azure geographic region. +// - SearchManagementRequestOptions - SearchManagementRequestOptions contains a group of parameters for the AdminKeysClient.Get +// method. +// - options - UsagesClientListBySubscriptionOptions contains the optional parameters for the UsagesClient.NewListBySubscriptionPager +// method. +func (client *UsagesClient) NewListBySubscriptionPager(location string, searchManagementRequestOptions *SearchManagementRequestOptions, options *UsagesClientListBySubscriptionOptions) *runtime.Pager[UsagesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[UsagesClientListBySubscriptionResponse]{ + More: func(page UsagesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *UsagesClientListBySubscriptionResponse) (UsagesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, location, searchManagementRequestOptions, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return UsagesClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return UsagesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return UsagesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *UsagesClient) listBySubscriptionCreateRequest(ctx context.Context, location string, searchManagementRequestOptions *SearchManagementRequestOptions, options *UsagesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + if searchManagementRequestOptions != nil && searchManagementRequestOptions.ClientRequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*searchManagementRequestOptions.ClientRequestID} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *UsagesClient) listBySubscriptionHandleResponse(resp *http.Response) (UsagesClientListBySubscriptionResponse, error) { + result := UsagesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.QuotaUsagesListResult); err != nil { + return UsagesClientListBySubscriptionResponse{}, err + } + return result, nil +}