[Release] sdk/resourcemanager/elastic/armelastic/1.0.0 generation from spec commit: ad60d7f8eba124edc6999677c55aba2184e303b0 (#23525)

Co-authored-by: ReleaseHelper <ReleaseHelper>
This commit is contained in:
Azure SDK Bot 2024-10-22 03:06:09 -07:00 коммит произвёл GitHub
Родитель c7e3486427
Коммит 0c4fec9ae6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
64 изменённых файлов: 2684 добавлений и 213 удалений

Просмотреть файл

@ -1,5 +1,40 @@
# Release History
## 1.0.0 (2024-10-24)
### Features Added
- New function `NewBillingInfoClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BillingInfoClient, error)`
- New function `*BillingInfoClient.Get(context.Context, string, string, *BillingInfoClientGetOptions) (BillingInfoClientGetResponse, error)`
- New function `*ClientFactory.NewBillingInfoClient() *BillingInfoClient`
- New function `*ClientFactory.NewConnectedPartnerResourcesClient() *ConnectedPartnerResourcesClient`
- New function `*ClientFactory.NewOpenAIClient() *OpenAIClient`
- New function `NewConnectedPartnerResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ConnectedPartnerResourcesClient, error)`
- New function `*ConnectedPartnerResourcesClient.NewListPager(string, string, *ConnectedPartnerResourcesClientListOptions) *runtime.Pager[ConnectedPartnerResourcesClientListResponse]`
- New function `NewOpenAIClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OpenAIClient, error)`
- New function `*OpenAIClient.CreateOrUpdate(context.Context, string, string, string, *OpenAIClientCreateOrUpdateOptions) (OpenAIClientCreateOrUpdateResponse, error)`
- New function `*OpenAIClient.Delete(context.Context, string, string, string, *OpenAIClientDeleteOptions) (OpenAIClientDeleteResponse, error)`
- New function `*OpenAIClient.Get(context.Context, string, string, string, *OpenAIClientGetOptions) (OpenAIClientGetResponse, error)`
- New function `*OpenAIClient.GetStatus(context.Context, string, string, string, *OpenAIClientGetStatusOptions) (OpenAIClientGetStatusResponse, error)`
- New function `*OpenAIClient.NewListPager(string, string, *OpenAIClientListOptions) *runtime.Pager[OpenAIClientListResponse]`
- New function `*OrganizationsClient.GetElasticToAzureSubscriptionMapping(context.Context, *OrganizationsClientGetElasticToAzureSubscriptionMappingOptions) (OrganizationsClientGetElasticToAzureSubscriptionMappingResponse, error)`
- New struct `BillingInfoResponse`
- New struct `ConnectedPartnerResourceProperties`
- New struct `ConnectedPartnerResourcesListFormat`
- New struct `ConnectedPartnerResourcesListResponse`
- New struct `OpenAIIntegrationProperties`
- New struct `OpenAIIntegrationRPModel`
- New struct `OpenAIIntegrationRPModelListResponse`
- New struct `OpenAIIntegrationStatusResponse`
- New struct `OpenAIIntegrationStatusResponseProperties`
- New struct `OrganizationToAzureSubscriptionMappingResponse`
- New struct `OrganizationToAzureSubscriptionMappingResponseProperties`
- New struct `PartnerBillingEntity`
- New struct `PlanDetails`
- New field `ElasticsearchEndPoint` in struct `DeploymentInfoResponse`
- New field `BilledAzureSubscriptionID`, `MarketplaceStatus`, `Subscribed` in struct `MarketplaceSaaSInfo`
- New field `PlanDetails`, `SaaSAzureSubscriptionStatus`, `SourceCampaignID`, `SourceCampaignName`, `SubscriptionState` in struct `MonitorProperties`
## 0.10.0 (2023-11-24)
### Features Added

Просмотреть файл

@ -57,7 +57,7 @@ clientFactory, err := armelastic.NewClientFactory(<subscription ID>, cred, &opti
A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory.
```go
client := clientFactory.NewMonitorsClient()
client := clientFactory.NewAllTrafficFiltersClient()
```
## Fakes

Просмотреть файл

@ -37,7 +37,7 @@ type AllTrafficFiltersClient struct {
}
// NewAllTrafficFiltersClient creates a new instance of AllTrafficFiltersClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewAllTrafficFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AllTrafficFiltersClient, error) {
@ -55,8 +55,8 @@ func NewAllTrafficFiltersClient(subscriptionID string, credential azcore.TokenCr
// List - Get the list of all traffic filters for the account.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - AllTrafficFiltersClientListOptions contains the optional parameters for the AllTrafficFiltersClient.List method.
func (client *AllTrafficFiltersClient) List(ctx context.Context, resourceGroupName string, monitorName string, options *AllTrafficFiltersClientListOptions) (AllTrafficFiltersClientListResponse, error) {
@ -101,7 +101,7 @@ func (client *AllTrafficFiltersClient) listCreateRequest(ctx context.Context, re
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/AllTrafficFilters_list.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/AllTrafficFilters_list.json
func ExampleAllTrafficFiltersClient_List() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type AssociateTrafficFilterClient struct {
}
// NewAssociateTrafficFilterClient creates a new instance of AssociateTrafficFilterClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewAssociateTrafficFilterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssociateTrafficFilterClient, error) {
@ -55,8 +55,8 @@ func NewAssociateTrafficFilterClient(subscriptionID string, credential azcore.To
// BeginAssociate - Associate traffic filter for the given deployment.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - AssociateTrafficFilterClientBeginAssociateOptions contains the optional parameters for the AssociateTrafficFilterClient.BeginAssociate
// method.
@ -81,7 +81,7 @@ func (client *AssociateTrafficFilterClient) BeginAssociate(ctx context.Context,
// Associate - Associate traffic filter for the given deployment.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
func (client *AssociateTrafficFilterClient) associate(ctx context.Context, resourceGroupName string, monitorName string, options *AssociateTrafficFilterClientBeginAssociateOptions) (*http.Response, error) {
var err error
const operationName = "AssociateTrafficFilterClient.BeginAssociate"
@ -123,7 +123,7 @@ func (client *AssociateTrafficFilterClient) associateCreateRequest(ctx context.C
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
if options != nil && options.RulesetID != nil {
reqQP.Set("rulesetId", *options.RulesetID)
}

Просмотреть файл

@ -26,7 +26,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/AssociateTrafficFilter_Update.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/AssociateTrafficFilter_Update.json
func ExampleAssociateTrafficFilterClient_BeginAssociate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -5,9 +5,9 @@
``` yaml
azure-arm: true
require:
- https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/readme.md
- https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/readme.go.md
- https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/readme.md
- https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/readme.go.md
license-header: MICROSOFT_MIT_NO_VERSION
module-version: 0.10.0
tag: package-2023-02-01-preview
module-version: 1.0.0
tag: package-2024-03-01
```

Просмотреть файл

@ -0,0 +1,117 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.
// Code generated by @autorest/go. DO NOT EDIT.
package armelastic
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"
)
// BillingInfoClient contains the methods for the BillingInfo group.
// Don't use this type directly, use NewBillingInfoClient() instead.
type BillingInfoClient struct {
internal *arm.Client
subscriptionID string
}
// NewBillingInfoClient creates a new instance of BillingInfoClient with the specified values.
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewBillingInfoClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BillingInfoClient, error) {
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
client := &BillingInfoClient{
subscriptionID: subscriptionID,
internal: cl,
}
return client, nil
}
// Get - Get marketplace and organization info mapped to the given monitor.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - BillingInfoClientGetOptions contains the optional parameters for the BillingInfoClient.Get method.
func (client *BillingInfoClient) Get(ctx context.Context, resourceGroupName string, monitorName string, options *BillingInfoClientGetOptions) (BillingInfoClientGetResponse, error) {
var err error
const operationName = "BillingInfoClient.Get"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.getCreateRequest(ctx, resourceGroupName, monitorName, options)
if err != nil {
return BillingInfoClientGetResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return BillingInfoClientGetResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return BillingInfoClientGetResponse{}, err
}
resp, err := client.getHandleResponse(httpResp)
return resp, err
}
// getCreateRequest creates the Get request.
func (client *BillingInfoClient) getCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *BillingInfoClientGetOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/getBillingInfo"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if monitorName == "" {
return nil, errors.New("parameter monitorName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName))
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getHandleResponse handles the Get response.
func (client *BillingInfoClient) getHandleResponse(resp *http.Response) (BillingInfoClientGetResponse, error) {
result := BillingInfoClientGetResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.BillingInfoResponse); err != nil {
return BillingInfoClientGetResponse{}, err
}
return result, nil
}

Просмотреть файл

@ -0,0 +1,63 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.
// DO NOT EDIT.
package armelastic_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/BillingInfo_Get.json
func ExampleBillingInfoClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armelastic.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewBillingInfoClient().Get(ctx, "myResourceGroup", "myMonitor", 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.BillingInfoResponse = armelastic.BillingInfoResponse{
// MarketplaceSaasInfo: &armelastic.MarketplaceSaaSInfo{
// BilledAzureSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// MarketplaceName: to.Ptr("MP_RESOURCE"),
// MarketplaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.SaaS/resources/AzElastic_b1190c8f"),
// MarketplaceStatus: to.Ptr("Status"),
// MarketplaceSubscription: &armelastic.MarketplaceSaaSInfoMarketplaceSubscription{
// ID: to.Ptr("12345678-1234-1234-1234-123456789012"),
// },
// Subscribed: to.Ptr(true),
// },
// PartnerBillingEntity: &armelastic.PartnerBillingEntity{
// Name: to.Ptr("elasticOrganizationName"),
// ID: to.Ptr("1234567890"),
// PartnerEntityURI: to.Ptr("https://example.com"),
// },
// }
}

Просмотреть файл

@ -26,148 +26,212 @@ import (
// Don't use this type directly, use NewClientFactory instead.
type ClientFactory struct {
subscriptionID string
credential azcore.TokenCredential
options *arm.ClientOptions
internal *arm.Client
}
// NewClientFactory creates a new instance of ClientFactory with the specified values.
// The parameter values will be propagated to any client created from this factory.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) {
_, err := arm.NewClient(moduleName, moduleVersion, credential, options)
internal, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
return &ClientFactory{
subscriptionID: subscriptionID, credential: credential,
options: options.Clone(),
subscriptionID: subscriptionID,
internal: internal,
}, nil
}
// NewAllTrafficFiltersClient creates a new instance of AllTrafficFiltersClient.
func (c *ClientFactory) NewAllTrafficFiltersClient() *AllTrafficFiltersClient {
subClient, _ := NewAllTrafficFiltersClient(c.subscriptionID, c.credential, c.options)
return subClient
return &AllTrafficFiltersClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewAssociateTrafficFilterClient creates a new instance of AssociateTrafficFilterClient.
func (c *ClientFactory) NewAssociateTrafficFilterClient() *AssociateTrafficFilterClient {
subClient, _ := NewAssociateTrafficFilterClient(c.subscriptionID, c.credential, c.options)
return subClient
return &AssociateTrafficFilterClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewBillingInfoClient creates a new instance of BillingInfoClient.
func (c *ClientFactory) NewBillingInfoClient() *BillingInfoClient {
return &BillingInfoClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewConnectedPartnerResourcesClient creates a new instance of ConnectedPartnerResourcesClient.
func (c *ClientFactory) NewConnectedPartnerResourcesClient() *ConnectedPartnerResourcesClient {
return &ConnectedPartnerResourcesClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewCreateAndAssociateIPFilterClient creates a new instance of CreateAndAssociateIPFilterClient.
func (c *ClientFactory) NewCreateAndAssociateIPFilterClient() *CreateAndAssociateIPFilterClient {
subClient, _ := NewCreateAndAssociateIPFilterClient(c.subscriptionID, c.credential, c.options)
return subClient
return &CreateAndAssociateIPFilterClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewCreateAndAssociatePLFilterClient creates a new instance of CreateAndAssociatePLFilterClient.
func (c *ClientFactory) NewCreateAndAssociatePLFilterClient() *CreateAndAssociatePLFilterClient {
subClient, _ := NewCreateAndAssociatePLFilterClient(c.subscriptionID, c.credential, c.options)
return subClient
return &CreateAndAssociatePLFilterClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewDeploymentInfoClient creates a new instance of DeploymentInfoClient.
func (c *ClientFactory) NewDeploymentInfoClient() *DeploymentInfoClient {
subClient, _ := NewDeploymentInfoClient(c.subscriptionID, c.credential, c.options)
return subClient
return &DeploymentInfoClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewDetachAndDeleteTrafficFilterClient creates a new instance of DetachAndDeleteTrafficFilterClient.
func (c *ClientFactory) NewDetachAndDeleteTrafficFilterClient() *DetachAndDeleteTrafficFilterClient {
subClient, _ := NewDetachAndDeleteTrafficFilterClient(c.subscriptionID, c.credential, c.options)
return subClient
return &DetachAndDeleteTrafficFilterClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewDetachTrafficFilterClient creates a new instance of DetachTrafficFilterClient.
func (c *ClientFactory) NewDetachTrafficFilterClient() *DetachTrafficFilterClient {
subClient, _ := NewDetachTrafficFilterClient(c.subscriptionID, c.credential, c.options)
return subClient
return &DetachTrafficFilterClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewExternalUserClient creates a new instance of ExternalUserClient.
func (c *ClientFactory) NewExternalUserClient() *ExternalUserClient {
subClient, _ := NewExternalUserClient(c.subscriptionID, c.credential, c.options)
return subClient
return &ExternalUserClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewListAssociatedTrafficFiltersClient creates a new instance of ListAssociatedTrafficFiltersClient.
func (c *ClientFactory) NewListAssociatedTrafficFiltersClient() *ListAssociatedTrafficFiltersClient {
subClient, _ := NewListAssociatedTrafficFiltersClient(c.subscriptionID, c.credential, c.options)
return subClient
return &ListAssociatedTrafficFiltersClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewMonitorClient creates a new instance of MonitorClient.
func (c *ClientFactory) NewMonitorClient() *MonitorClient {
subClient, _ := NewMonitorClient(c.subscriptionID, c.credential, c.options)
return subClient
return &MonitorClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewMonitoredResourcesClient creates a new instance of MonitoredResourcesClient.
func (c *ClientFactory) NewMonitoredResourcesClient() *MonitoredResourcesClient {
subClient, _ := NewMonitoredResourcesClient(c.subscriptionID, c.credential, c.options)
return subClient
return &MonitoredResourcesClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewMonitorsClient creates a new instance of MonitorsClient.
func (c *ClientFactory) NewMonitorsClient() *MonitorsClient {
subClient, _ := NewMonitorsClient(c.subscriptionID, c.credential, c.options)
return subClient
return &MonitorsClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewOpenAIClient creates a new instance of OpenAIClient.
func (c *ClientFactory) NewOpenAIClient() *OpenAIClient {
return &OpenAIClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewOperationsClient creates a new instance of OperationsClient.
func (c *ClientFactory) NewOperationsClient() *OperationsClient {
subClient, _ := NewOperationsClient(c.credential, c.options)
return subClient
return &OperationsClient{
internal: c.internal,
}
}
// NewOrganizationsClient creates a new instance of OrganizationsClient.
func (c *ClientFactory) NewOrganizationsClient() *OrganizationsClient {
subClient, _ := NewOrganizationsClient(c.subscriptionID, c.credential, c.options)
return subClient
return &OrganizationsClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewTagRulesClient creates a new instance of TagRulesClient.
func (c *ClientFactory) NewTagRulesClient() *TagRulesClient {
subClient, _ := NewTagRulesClient(c.subscriptionID, c.credential, c.options)
return subClient
return &TagRulesClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewTrafficFiltersClient creates a new instance of TrafficFiltersClient.
func (c *ClientFactory) NewTrafficFiltersClient() *TrafficFiltersClient {
subClient, _ := NewTrafficFiltersClient(c.subscriptionID, c.credential, c.options)
return subClient
return &TrafficFiltersClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewUpgradableVersionsClient creates a new instance of UpgradableVersionsClient.
func (c *ClientFactory) NewUpgradableVersionsClient() *UpgradableVersionsClient {
subClient, _ := NewUpgradableVersionsClient(c.subscriptionID, c.credential, c.options)
return subClient
return &UpgradableVersionsClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewVMCollectionClient creates a new instance of VMCollectionClient.
func (c *ClientFactory) NewVMCollectionClient() *VMCollectionClient {
subClient, _ := NewVMCollectionClient(c.subscriptionID, c.credential, c.options)
return subClient
return &VMCollectionClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewVMHostClient creates a new instance of VMHostClient.
func (c *ClientFactory) NewVMHostClient() *VMHostClient {
subClient, _ := NewVMHostClient(c.subscriptionID, c.credential, c.options)
return subClient
return &VMHostClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewVMIngestionClient creates a new instance of VMIngestionClient.
func (c *ClientFactory) NewVMIngestionClient() *VMIngestionClient {
subClient, _ := NewVMIngestionClient(c.subscriptionID, c.credential, c.options)
return subClient
return &VMIngestionClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}
// NewVersionsClient creates a new instance of VersionsClient.
func (c *ClientFactory) NewVersionsClient() *VersionsClient {
subClient, _ := NewVersionsClient(c.subscriptionID, c.credential, c.options)
return subClient
return &VersionsClient{
subscriptionID: c.subscriptionID,
internal: c.internal,
}
}

Просмотреть файл

@ -0,0 +1,119 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.
// Code generated by @autorest/go. DO NOT EDIT.
package armelastic
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"
)
// ConnectedPartnerResourcesClient contains the methods for the ConnectedPartnerResources group.
// Don't use this type directly, use NewConnectedPartnerResourcesClient() instead.
type ConnectedPartnerResourcesClient struct {
internal *arm.Client
subscriptionID string
}
// NewConnectedPartnerResourcesClient creates a new instance of ConnectedPartnerResourcesClient with the specified values.
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewConnectedPartnerResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectedPartnerResourcesClient, error) {
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
client := &ConnectedPartnerResourcesClient{
subscriptionID: subscriptionID,
internal: cl,
}
return client, nil
}
// NewListPager - List of all active deployments that are associated with the marketplace subscription linked to the given
// monitor.
//
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - ConnectedPartnerResourcesClientListOptions contains the optional parameters for the ConnectedPartnerResourcesClient.NewListPager
// method.
func (client *ConnectedPartnerResourcesClient) NewListPager(resourceGroupName string, monitorName string, options *ConnectedPartnerResourcesClientListOptions) *runtime.Pager[ConnectedPartnerResourcesClientListResponse] {
return runtime.NewPager(runtime.PagingHandler[ConnectedPartnerResourcesClientListResponse]{
More: func(page ConnectedPartnerResourcesClientListResponse) bool {
return page.NextLink != nil && len(*page.NextLink) > 0
},
Fetcher: func(ctx context.Context, page *ConnectedPartnerResourcesClientListResponse) (ConnectedPartnerResourcesClientListResponse, error) {
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ConnectedPartnerResourcesClient.NewListPager")
nextLink := ""
if page != nil {
nextLink = *page.NextLink
}
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
return client.listCreateRequest(ctx, resourceGroupName, monitorName, options)
}, nil)
if err != nil {
return ConnectedPartnerResourcesClientListResponse{}, err
}
return client.listHandleResponse(resp)
},
Tracer: client.internal.Tracer(),
})
}
// listCreateRequest creates the List request.
func (client *ConnectedPartnerResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *ConnectedPartnerResourcesClientListOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/listConnectedPartnerResources"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if monitorName == "" {
return nil, errors.New("parameter monitorName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName))
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// listHandleResponse handles the List response.
func (client *ConnectedPartnerResourcesClient) listHandleResponse(resp *http.Response) (ConnectedPartnerResourcesClientListResponse, error) {
result := ConnectedPartnerResourcesClientListResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedPartnerResourcesListResponse); err != nil {
return ConnectedPartnerResourcesClientListResponse{}, err
}
return result, nil
}

Просмотреть файл

@ -0,0 +1,62 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.
// DO NOT EDIT.
package armelastic_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ConnectedPartnerResources_List.json
func ExampleConnectedPartnerResourcesClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armelastic.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewConnectedPartnerResourcesClient().NewListPager("myResourceGroup", "myMonitor", 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.ConnectedPartnerResourcesListResponse = armelastic.ConnectedPartnerResourcesListResponse{
// Value: []*armelastic.ConnectedPartnerResourcesListFormat{
// {
// Properties: &armelastic.ConnectedPartnerResourceProperties{
// AzureResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/monitors/myMonitor"),
// Location: to.Ptr("West US 2"),
// PartnerDeploymentName: to.Ptr("deploymentname"),
// PartnerDeploymentURI: to.Ptr("https://examplessourl.com"),
// },
// }},
// }
}
}

Просмотреть файл

@ -19,7 +19,7 @@ package armelastic
const (
moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
moduleVersion = "v0.10.0"
moduleVersion = "v1.0.0"
)
// CreatedByType - The type of identity that created the resource.

Просмотреть файл

@ -37,7 +37,7 @@ type CreateAndAssociateIPFilterClient struct {
}
// NewCreateAndAssociateIPFilterClient creates a new instance of CreateAndAssociateIPFilterClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewCreateAndAssociateIPFilterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CreateAndAssociateIPFilterClient, error) {
@ -55,8 +55,8 @@ func NewCreateAndAssociateIPFilterClient(subscriptionID string, credential azcor
// BeginCreate - Create and Associate IP traffic filter for the given deployment.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - CreateAndAssociateIPFilterClientBeginCreateOptions contains the optional parameters for the CreateAndAssociateIPFilterClient.BeginCreate
// method.
@ -81,7 +81,7 @@ func (client *CreateAndAssociateIPFilterClient) BeginCreate(ctx context.Context,
// Create - Create and Associate IP traffic filter for the given deployment.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
func (client *CreateAndAssociateIPFilterClient) create(ctx context.Context, resourceGroupName string, monitorName string, options *CreateAndAssociateIPFilterClientBeginCreateOptions) (*http.Response, error) {
var err error
const operationName = "CreateAndAssociateIPFilterClient.BeginCreate"
@ -123,7 +123,7 @@ func (client *CreateAndAssociateIPFilterClient) createCreateRequest(ctx context.
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
if options != nil && options.IPs != nil {
reqQP.Set("ips", *options.IPs)
}

Просмотреть файл

@ -26,7 +26,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/IPTrafficFilter_Create.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/IPTrafficFilter_Create.json
func ExampleCreateAndAssociateIPFilterClient_BeginCreate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type CreateAndAssociatePLFilterClient struct {
}
// NewCreateAndAssociatePLFilterClient creates a new instance of CreateAndAssociatePLFilterClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewCreateAndAssociatePLFilterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CreateAndAssociatePLFilterClient, error) {
@ -55,8 +55,8 @@ func NewCreateAndAssociatePLFilterClient(subscriptionID string, credential azcor
// BeginCreate - Create and Associate private link traffic filter for the given deployment.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - CreateAndAssociatePLFilterClientBeginCreateOptions contains the optional parameters for the CreateAndAssociatePLFilterClient.BeginCreate
// method.
@ -81,7 +81,7 @@ func (client *CreateAndAssociatePLFilterClient) BeginCreate(ctx context.Context,
// Create - Create and Associate private link traffic filter for the given deployment.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
func (client *CreateAndAssociatePLFilterClient) create(ctx context.Context, resourceGroupName string, monitorName string, options *CreateAndAssociatePLFilterClientBeginCreateOptions) (*http.Response, error) {
var err error
const operationName = "CreateAndAssociatePLFilterClient.BeginCreate"
@ -123,7 +123,7 @@ func (client *CreateAndAssociatePLFilterClient) createCreateRequest(ctx context.
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
if options != nil && options.Name != nil {
reqQP.Set("name", *options.Name)
}

Просмотреть файл

@ -26,7 +26,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/PrivateLinkTrafficFilters_Create.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/PrivateLinkTrafficFilters_Create.json
func ExampleCreateAndAssociatePLFilterClient_BeginCreate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type DeploymentInfoClient struct {
}
// NewDeploymentInfoClient creates a new instance of DeploymentInfoClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewDeploymentInfoClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentInfoClient, error) {
@ -55,8 +55,8 @@ func NewDeploymentInfoClient(subscriptionID string, credential azcore.TokenCrede
// List - Fetch information regarding Elastic cloud deployment corresponding to the Elastic monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - DeploymentInfoClientListOptions contains the optional parameters for the DeploymentInfoClient.List method.
func (client *DeploymentInfoClient) List(ctx context.Context, resourceGroupName string, monitorName string, options *DeploymentInfoClientListOptions) (DeploymentInfoClientListResponse, error) {
@ -101,7 +101,7 @@ func (client *DeploymentInfoClient) listCreateRequest(ctx context.Context, resou
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/DeploymentInfo_List.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/DeploymentInfo_List.json
func ExampleDeploymentInfoClient_List() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -46,9 +46,11 @@ func ExampleDeploymentInfoClient_List() {
// res.DeploymentInfoResponse = armelastic.DeploymentInfoResponse{
// DeploymentURL: to.Ptr("https://endpoint.eastus.kb.azure.elastic-cloud.com:9243"),
// DiskCapacity: to.Ptr("245760"),
// ElasticsearchEndPoint: to.Ptr("alias.es.eastus2.staging.azure.foundit.no"),
// MarketplaceSaasInfo: &armelastic.MarketplaceSaaSInfo{
// MarketplaceName: to.Ptr("MP_RESOURCE"),
// MarketplaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.SaaS/resources/AzElastic_b1190c8f"),
// MarketplaceStatus: to.Ptr("Status"),
// MarketplaceSubscription: &armelastic.MarketplaceSaaSInfoMarketplaceSubscription{
// ID: to.Ptr("12345678-1234-1234-1234-123456789012"),
// },

Просмотреть файл

@ -37,7 +37,7 @@ type DetachAndDeleteTrafficFilterClient struct {
}
// NewDetachAndDeleteTrafficFilterClient creates a new instance of DetachAndDeleteTrafficFilterClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewDetachAndDeleteTrafficFilterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DetachAndDeleteTrafficFilterClient, error) {
@ -55,8 +55,8 @@ func NewDetachAndDeleteTrafficFilterClient(subscriptionID string, credential azc
// Delete - Detach and Delete traffic filter from the given deployment.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - DetachAndDeleteTrafficFilterClientDeleteOptions contains the optional parameters for the DetachAndDeleteTrafficFilterClient.Delete
// method.
@ -101,7 +101,7 @@ func (client *DetachAndDeleteTrafficFilterClient) deleteCreateRequest(ctx contex
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
if options != nil && options.RulesetID != nil {
reqQP.Set("rulesetId", *options.RulesetID)
}

Просмотреть файл

@ -26,7 +26,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/DetachAndDeleteTrafficFilter_Delete.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/DetachAndDeleteTrafficFilter_Delete.json
func ExampleDetachAndDeleteTrafficFilterClient_Delete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type DetachTrafficFilterClient struct {
}
// NewDetachTrafficFilterClient creates a new instance of DetachTrafficFilterClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewDetachTrafficFilterClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DetachTrafficFilterClient, error) {
@ -55,8 +55,8 @@ func NewDetachTrafficFilterClient(subscriptionID string, credential azcore.Token
// BeginUpdate - Detach traffic filter for the given deployment.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - DetachTrafficFilterClientBeginUpdateOptions contains the optional parameters for the DetachTrafficFilterClient.BeginUpdate
// method.
@ -81,7 +81,7 @@ func (client *DetachTrafficFilterClient) BeginUpdate(ctx context.Context, resour
// Update - Detach traffic filter for the given deployment.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
func (client *DetachTrafficFilterClient) update(ctx context.Context, resourceGroupName string, monitorName string, options *DetachTrafficFilterClientBeginUpdateOptions) (*http.Response, error) {
var err error
const operationName = "DetachTrafficFilterClient.BeginUpdate"
@ -123,7 +123,7 @@ func (client *DetachTrafficFilterClient) updateCreateRequest(ctx context.Context
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
if options != nil && options.RulesetID != nil {
reqQP.Set("rulesetId", *options.RulesetID)
}

Просмотреть файл

@ -26,7 +26,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/DetachTrafficFilters_Update.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/DetachTrafficFilters_Update.json
func ExampleDetachTrafficFilterClient_BeginUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type ExternalUserClient struct {
}
// NewExternalUserClient creates a new instance of ExternalUserClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewExternalUserClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExternalUserClient, error) {
@ -56,8 +56,8 @@ func NewExternalUserClient(subscriptionID string, credential azcore.TokenCredent
// deployment
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - ExternalUserClientCreateOrUpdateOptions contains the optional parameters for the ExternalUserClient.CreateOrUpdate
// method.
@ -103,7 +103,7 @@ func (client *ExternalUserClient) createOrUpdateCreateRequest(ctx context.Contex
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if options != nil && options.Body != nil {

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/ExternalUserInfo.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ExternalUserInfo.json
func ExampleExternalUserClient_CreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -0,0 +1,109 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.
// Code generated by @autorest/go. DO NOT EDIT.
package fake
import (
"context"
"errors"
"fmt"
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
"net/http"
"net/url"
"regexp"
)
// BillingInfoServer is a fake server for instances of the armelastic.BillingInfoClient type.
type BillingInfoServer struct {
// Get is the fake for method BillingInfoClient.Get
// HTTP status codes to indicate success: http.StatusOK
Get func(ctx context.Context, resourceGroupName string, monitorName string, options *armelastic.BillingInfoClientGetOptions) (resp azfake.Responder[armelastic.BillingInfoClientGetResponse], errResp azfake.ErrorResponder)
}
// NewBillingInfoServerTransport creates a new instance of BillingInfoServerTransport with the provided implementation.
// The returned BillingInfoServerTransport instance is connected to an instance of armelastic.BillingInfoClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewBillingInfoServerTransport(srv *BillingInfoServer) *BillingInfoServerTransport {
return &BillingInfoServerTransport{srv: srv}
}
// BillingInfoServerTransport connects instances of armelastic.BillingInfoClient to instances of BillingInfoServer.
// Don't use this type directly, use NewBillingInfoServerTransport instead.
type BillingInfoServerTransport struct {
srv *BillingInfoServer
}
// Do implements the policy.Transporter interface for BillingInfoServerTransport.
func (b *BillingInfoServerTransport) Do(req *http.Request) (*http.Response, error) {
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
method, ok := rawMethod.(string)
if !ok {
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
}
var resp *http.Response
var err error
switch method {
case "BillingInfoClient.Get":
resp, err = b.dispatchGet(req)
default:
err = fmt.Errorf("unhandled API %s", method)
}
if err != nil {
return nil, err
}
return resp, nil
}
func (b *BillingInfoServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
if b.srv.Get == nil {
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
}
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Elastic/monitors/(?P<monitorName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getBillingInfo`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")])
if err != nil {
return nil, err
}
respr, errRespr := b.srv.Get(req.Context(), resourceGroupNameParam, monitorNameParam, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
respContent := server.GetResponseContent(respr)
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
}
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BillingInfoResponse, req)
if err != nil {
return nil, err
}
return resp, nil
}

Просмотреть файл

@ -0,0 +1,121 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.
// Code generated by @autorest/go. DO NOT EDIT.
package fake
import (
"errors"
"fmt"
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
"net/http"
"net/url"
"regexp"
)
// ConnectedPartnerResourcesServer is a fake server for instances of the armelastic.ConnectedPartnerResourcesClient type.
type ConnectedPartnerResourcesServer struct {
// NewListPager is the fake for method ConnectedPartnerResourcesClient.NewListPager
// HTTP status codes to indicate success: http.StatusOK
NewListPager func(resourceGroupName string, monitorName string, options *armelastic.ConnectedPartnerResourcesClientListOptions) (resp azfake.PagerResponder[armelastic.ConnectedPartnerResourcesClientListResponse])
}
// NewConnectedPartnerResourcesServerTransport creates a new instance of ConnectedPartnerResourcesServerTransport with the provided implementation.
// The returned ConnectedPartnerResourcesServerTransport instance is connected to an instance of armelastic.ConnectedPartnerResourcesClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewConnectedPartnerResourcesServerTransport(srv *ConnectedPartnerResourcesServer) *ConnectedPartnerResourcesServerTransport {
return &ConnectedPartnerResourcesServerTransport{
srv: srv,
newListPager: newTracker[azfake.PagerResponder[armelastic.ConnectedPartnerResourcesClientListResponse]](),
}
}
// ConnectedPartnerResourcesServerTransport connects instances of armelastic.ConnectedPartnerResourcesClient to instances of ConnectedPartnerResourcesServer.
// Don't use this type directly, use NewConnectedPartnerResourcesServerTransport instead.
type ConnectedPartnerResourcesServerTransport struct {
srv *ConnectedPartnerResourcesServer
newListPager *tracker[azfake.PagerResponder[armelastic.ConnectedPartnerResourcesClientListResponse]]
}
// Do implements the policy.Transporter interface for ConnectedPartnerResourcesServerTransport.
func (c *ConnectedPartnerResourcesServerTransport) Do(req *http.Request) (*http.Response, error) {
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
method, ok := rawMethod.(string)
if !ok {
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
}
var resp *http.Response
var err error
switch method {
case "ConnectedPartnerResourcesClient.NewListPager":
resp, err = c.dispatchNewListPager(req)
default:
err = fmt.Errorf("unhandled API %s", method)
}
if err != nil {
return nil, err
}
return resp, nil
}
func (c *ConnectedPartnerResourcesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) {
if c.srv.NewListPager == nil {
return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")}
}
newListPager := c.newListPager.get(req)
if newListPager == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Elastic/monitors/(?P<monitorName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listConnectedPartnerResources`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")])
if err != nil {
return nil, err
}
resp := c.srv.NewListPager(resourceGroupNameParam, monitorNameParam, nil)
newListPager = &resp
c.newListPager.add(req, newListPager)
server.PagerResponderInjectNextLinks(newListPager, req, func(page *armelastic.ConnectedPartnerResourcesClientListResponse, createLink func() string) {
page.NextLink = to.Ptr(createLink())
})
}
resp, err := server.PagerResponderNext(newListPager, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK}, resp.StatusCode) {
c.newListPager.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
}
if !server.PagerResponderMore(newListPager) {
c.newListPager.remove(req)
}
return resp, nil
}

Просмотреть файл

@ -0,0 +1,305 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.
// Code generated by @autorest/go. DO NOT EDIT.
package fake
import (
"context"
"errors"
"fmt"
azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
"net/http"
"net/url"
"reflect"
"regexp"
)
// OpenAIServer is a fake server for instances of the armelastic.OpenAIClient type.
type OpenAIServer struct {
// CreateOrUpdate is the fake for method OpenAIClient.CreateOrUpdate
// HTTP status codes to indicate success: http.StatusOK, http.StatusCreated
CreateOrUpdate func(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *armelastic.OpenAIClientCreateOrUpdateOptions) (resp azfake.Responder[armelastic.OpenAIClientCreateOrUpdateResponse], errResp azfake.ErrorResponder)
// Delete is the fake for method OpenAIClient.Delete
// HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent
Delete func(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *armelastic.OpenAIClientDeleteOptions) (resp azfake.Responder[armelastic.OpenAIClientDeleteResponse], errResp azfake.ErrorResponder)
// Get is the fake for method OpenAIClient.Get
// HTTP status codes to indicate success: http.StatusOK
Get func(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *armelastic.OpenAIClientGetOptions) (resp azfake.Responder[armelastic.OpenAIClientGetResponse], errResp azfake.ErrorResponder)
// GetStatus is the fake for method OpenAIClient.GetStatus
// HTTP status codes to indicate success: http.StatusOK
GetStatus func(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *armelastic.OpenAIClientGetStatusOptions) (resp azfake.Responder[armelastic.OpenAIClientGetStatusResponse], errResp azfake.ErrorResponder)
// NewListPager is the fake for method OpenAIClient.NewListPager
// HTTP status codes to indicate success: http.StatusOK
NewListPager func(resourceGroupName string, monitorName string, options *armelastic.OpenAIClientListOptions) (resp azfake.PagerResponder[armelastic.OpenAIClientListResponse])
}
// NewOpenAIServerTransport creates a new instance of OpenAIServerTransport with the provided implementation.
// The returned OpenAIServerTransport instance is connected to an instance of armelastic.OpenAIClient via the
// azcore.ClientOptions.Transporter field in the client's constructor parameters.
func NewOpenAIServerTransport(srv *OpenAIServer) *OpenAIServerTransport {
return &OpenAIServerTransport{
srv: srv,
newListPager: newTracker[azfake.PagerResponder[armelastic.OpenAIClientListResponse]](),
}
}
// OpenAIServerTransport connects instances of armelastic.OpenAIClient to instances of OpenAIServer.
// Don't use this type directly, use NewOpenAIServerTransport instead.
type OpenAIServerTransport struct {
srv *OpenAIServer
newListPager *tracker[azfake.PagerResponder[armelastic.OpenAIClientListResponse]]
}
// Do implements the policy.Transporter interface for OpenAIServerTransport.
func (o *OpenAIServerTransport) Do(req *http.Request) (*http.Response, error) {
rawMethod := req.Context().Value(runtime.CtxAPINameKey{})
method, ok := rawMethod.(string)
if !ok {
return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")}
}
var resp *http.Response
var err error
switch method {
case "OpenAIClient.CreateOrUpdate":
resp, err = o.dispatchCreateOrUpdate(req)
case "OpenAIClient.Delete":
resp, err = o.dispatchDelete(req)
case "OpenAIClient.Get":
resp, err = o.dispatchGet(req)
case "OpenAIClient.GetStatus":
resp, err = o.dispatchGetStatus(req)
case "OpenAIClient.NewListPager":
resp, err = o.dispatchNewListPager(req)
default:
err = fmt.Errorf("unhandled API %s", method)
}
if err != nil {
return nil, err
}
return resp, nil
}
func (o *OpenAIServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) {
if o.srv.CreateOrUpdate == nil {
return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")}
}
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Elastic/monitors/(?P<monitorName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/openAIIntegrations/(?P<integrationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 4 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
body, err := server.UnmarshalRequestAsJSON[armelastic.OpenAIIntegrationRPModel](req)
if err != nil {
return nil, err
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")])
if err != nil {
return nil, err
}
integrationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("integrationName")])
if err != nil {
return nil, err
}
var options *armelastic.OpenAIClientCreateOrUpdateOptions
if !reflect.ValueOf(body).IsZero() {
options = &armelastic.OpenAIClientCreateOrUpdateOptions{
Body: &body,
}
}
respr, errRespr := o.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, monitorNameParam, integrationNameParam, options)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
respContent := server.GetResponseContent(respr)
if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) {
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)}
}
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OpenAIIntegrationRPModel, req)
if err != nil {
return nil, err
}
return resp, nil
}
func (o *OpenAIServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) {
if o.srv.Delete == nil {
return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")}
}
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Elastic/monitors/(?P<monitorName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/openAIIntegrations/(?P<integrationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 4 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")])
if err != nil {
return nil, err
}
integrationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("integrationName")])
if err != nil {
return nil, err
}
respr, errRespr := o.srv.Delete(req.Context(), resourceGroupNameParam, monitorNameParam, integrationNameParam, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
respContent := server.GetResponseContent(respr)
if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) {
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)}
}
resp, err := server.NewResponse(respContent, req, nil)
if err != nil {
return nil, err
}
return resp, nil
}
func (o *OpenAIServerTransport) dispatchGet(req *http.Request) (*http.Response, error) {
if o.srv.Get == nil {
return nil, &nonRetriableError{errors.New("fake for method Get not implemented")}
}
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Elastic/monitors/(?P<monitorName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/openAIIntegrations/(?P<integrationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 4 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")])
if err != nil {
return nil, err
}
integrationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("integrationName")])
if err != nil {
return nil, err
}
respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameParam, monitorNameParam, integrationNameParam, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
respContent := server.GetResponseContent(respr)
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
}
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OpenAIIntegrationRPModel, req)
if err != nil {
return nil, err
}
return resp, nil
}
func (o *OpenAIServerTransport) dispatchGetStatus(req *http.Request) (*http.Response, error) {
if o.srv.GetStatus == nil {
return nil, &nonRetriableError{errors.New("fake for method GetStatus not implemented")}
}
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Elastic/monitors/(?P<monitorName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/openAIIntegrations/(?P<integrationName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getStatus`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 4 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")])
if err != nil {
return nil, err
}
integrationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("integrationName")])
if err != nil {
return nil, err
}
respr, errRespr := o.srv.GetStatus(req.Context(), resourceGroupNameParam, monitorNameParam, integrationNameParam, nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
respContent := server.GetResponseContent(respr)
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
}
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OpenAIIntegrationStatusResponse, req)
if err != nil {
return nil, err
}
return resp, nil
}
func (o *OpenAIServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) {
if o.srv.NewListPager == nil {
return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")}
}
newListPager := o.newListPager.get(req)
if newListPager == nil {
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P<resourceGroupName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Elastic/monitors/(?P<monitorName>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/openAIIntegrations`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 3 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")])
if err != nil {
return nil, err
}
monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")])
if err != nil {
return nil, err
}
resp := o.srv.NewListPager(resourceGroupNameParam, monitorNameParam, nil)
newListPager = &resp
o.newListPager.add(req, newListPager)
server.PagerResponderInjectNextLinks(newListPager, req, func(page *armelastic.OpenAIClientListResponse, createLink func() string) {
page.NextLink = to.Ptr(createLink())
})
}
resp, err := server.PagerResponderNext(newListPager, req)
if err != nil {
return nil, err
}
if !contains([]int{http.StatusOK}, resp.StatusCode) {
o.newListPager.remove(req)
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)}
}
if !server.PagerResponderMore(newListPager) {
o.newListPager.remove(req)
}
return resp, nil
}

Просмотреть файл

@ -35,6 +35,10 @@ type OrganizationsServer struct {
// GetAPIKey is the fake for method OrganizationsClient.GetAPIKey
// HTTP status codes to indicate success: http.StatusOK
GetAPIKey func(ctx context.Context, options *armelastic.OrganizationsClientGetAPIKeyOptions) (resp azfake.Responder[armelastic.OrganizationsClientGetAPIKeyResponse], errResp azfake.ErrorResponder)
// GetElasticToAzureSubscriptionMapping is the fake for method OrganizationsClient.GetElasticToAzureSubscriptionMapping
// HTTP status codes to indicate success: http.StatusOK
GetElasticToAzureSubscriptionMapping func(ctx context.Context, options *armelastic.OrganizationsClientGetElasticToAzureSubscriptionMappingOptions) (resp azfake.Responder[armelastic.OrganizationsClientGetElasticToAzureSubscriptionMappingResponse], errResp azfake.ErrorResponder)
}
// NewOrganizationsServerTransport creates a new instance of OrganizationsServerTransport with the provided implementation.
@ -64,6 +68,8 @@ func (o *OrganizationsServerTransport) Do(req *http.Request) (*http.Response, er
switch method {
case "OrganizationsClient.GetAPIKey":
resp, err = o.dispatchGetAPIKey(req)
case "OrganizationsClient.GetElasticToAzureSubscriptionMapping":
resp, err = o.dispatchGetElasticToAzureSubscriptionMapping(req)
default:
err = fmt.Errorf("unhandled API %s", method)
}
@ -109,3 +115,28 @@ func (o *OrganizationsServerTransport) dispatchGetAPIKey(req *http.Request) (*ht
}
return resp, nil
}
func (o *OrganizationsServerTransport) dispatchGetElasticToAzureSubscriptionMapping(req *http.Request) (*http.Response, error) {
if o.srv.GetElasticToAzureSubscriptionMapping == nil {
return nil, &nonRetriableError{errors.New("fake for method GetElasticToAzureSubscriptionMapping not implemented")}
}
const regexStr = `/subscriptions/(?P<subscriptionId>[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Elastic/getElasticOrganizationToAzureSubscriptionMapping`
regex := regexp.MustCompile(regexStr)
matches := regex.FindStringSubmatch(req.URL.EscapedPath())
if matches == nil || len(matches) < 1 {
return nil, fmt.Errorf("failed to parse path %s", req.URL.Path)
}
respr, errRespr := o.srv.GetElasticToAzureSubscriptionMapping(req.Context(), nil)
if respErr := server.GetError(errRespr, req); respErr != nil {
return nil, respErr
}
respContent := server.GetResponseContent(respr)
if !contains([]int{http.StatusOK}, respContent.HTTPStatus) {
return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)}
}
resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OrganizationToAzureSubscriptionMappingResponse, req)
if err != nil {
return nil, err
}
return resp, nil
}

Просмотреть файл

@ -30,6 +30,8 @@ import (
type ServerFactory struct {
AllTrafficFiltersServer AllTrafficFiltersServer
AssociateTrafficFilterServer AssociateTrafficFilterServer
BillingInfoServer BillingInfoServer
ConnectedPartnerResourcesServer ConnectedPartnerResourcesServer
CreateAndAssociateIPFilterServer CreateAndAssociateIPFilterServer
CreateAndAssociatePLFilterServer CreateAndAssociatePLFilterServer
DeploymentInfoServer DeploymentInfoServer
@ -40,6 +42,7 @@ type ServerFactory struct {
MonitorServer MonitorServer
MonitoredResourcesServer MonitoredResourcesServer
MonitorsServer MonitorsServer
OpenAIServer OpenAIServer
OperationsServer OperationsServer
OrganizationsServer OrganizationsServer
TagRulesServer TagRulesServer
@ -67,6 +70,8 @@ type ServerFactoryTransport struct {
trMu sync.Mutex
trAllTrafficFiltersServer *AllTrafficFiltersServerTransport
trAssociateTrafficFilterServer *AssociateTrafficFilterServerTransport
trBillingInfoServer *BillingInfoServerTransport
trConnectedPartnerResourcesServer *ConnectedPartnerResourcesServerTransport
trCreateAndAssociateIPFilterServer *CreateAndAssociateIPFilterServerTransport
trCreateAndAssociatePLFilterServer *CreateAndAssociatePLFilterServerTransport
trDeploymentInfoServer *DeploymentInfoServerTransport
@ -77,6 +82,7 @@ type ServerFactoryTransport struct {
trMonitorServer *MonitorServerTransport
trMonitoredResourcesServer *MonitoredResourcesServerTransport
trMonitorsServer *MonitorsServerTransport
trOpenAIServer *OpenAIServerTransport
trOperationsServer *OperationsServerTransport
trOrganizationsServer *OrganizationsServerTransport
trTagRulesServer *TagRulesServerTransport
@ -111,6 +117,14 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) {
return NewAssociateTrafficFilterServerTransport(&s.srv.AssociateTrafficFilterServer)
})
resp, err = s.trAssociateTrafficFilterServer.Do(req)
case "BillingInfoClient":
initServer(s, &s.trBillingInfoServer, func() *BillingInfoServerTransport { return NewBillingInfoServerTransport(&s.srv.BillingInfoServer) })
resp, err = s.trBillingInfoServer.Do(req)
case "ConnectedPartnerResourcesClient":
initServer(s, &s.trConnectedPartnerResourcesServer, func() *ConnectedPartnerResourcesServerTransport {
return NewConnectedPartnerResourcesServerTransport(&s.srv.ConnectedPartnerResourcesServer)
})
resp, err = s.trConnectedPartnerResourcesServer.Do(req)
case "CreateAndAssociateIPFilterClient":
initServer(s, &s.trCreateAndAssociateIPFilterServer, func() *CreateAndAssociateIPFilterServerTransport {
return NewCreateAndAssociateIPFilterServerTransport(&s.srv.CreateAndAssociateIPFilterServer)
@ -155,6 +169,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) {
case "MonitorsClient":
initServer(s, &s.trMonitorsServer, func() *MonitorsServerTransport { return NewMonitorsServerTransport(&s.srv.MonitorsServer) })
resp, err = s.trMonitorsServer.Do(req)
case "OpenAIClient":
initServer(s, &s.trOpenAIServer, func() *OpenAIServerTransport { return NewOpenAIServerTransport(&s.srv.OpenAIServer) })
resp, err = s.trOpenAIServer.Do(req)
case "OperationsClient":
initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) })
resp, err = s.trOperationsServer.Do(req)

Просмотреть файл

@ -28,12 +28,16 @@ import (
)
// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases.
var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`)
var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`)
const (
utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"`
utcDateTime = "2006-01-02T15:04:05.999999999"
dateTimeJSON = `"` + time.RFC3339Nano + `"`
utcDateTime = "2006-01-02T15:04:05.999999999"
utcDateTimeJSON = `"` + utcDateTime + `"`
utcDateTimeNoT = "2006-01-02 15:04:05.999999999"
utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"`
dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00`
dateTimeJSON = `"` + time.RFC3339Nano + `"`
dateTimeJSONNoT = `"` + dateTimeNoT + `"`
)
type dateTimeRFC3339 time.Time
@ -49,17 +53,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) {
}
func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error {
layout := utcDateTimeJSON
if tzOffsetRegex.Match(data) {
tzOffset := tzOffsetRegex.Match(data)
hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t")
var layout string
if tzOffset && hasT {
layout = dateTimeJSON
} else if tzOffset {
layout = dateTimeJSONNoT
} else if hasT {
layout = utcDateTimeJSON
} else {
layout = utcDateTimeJSONNoT
}
return t.Parse(layout, string(data))
}
func (t *dateTimeRFC3339) UnmarshalText(data []byte) error {
layout := utcDateTime
if tzOffsetRegex.Match(data) {
tzOffset := tzOffsetRegex.Match(data)
hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t")
var layout string
if tzOffset && hasT {
layout = time.RFC3339Nano
} else if tzOffset {
layout = dateTimeNoT
} else if hasT {
layout = utcDateTime
} else {
layout = utcDateTimeNoT
}
return t.Parse(layout, string(data))
}
@ -70,6 +90,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error {
return err
}
func (t dateTimeRFC3339) String() string {
return time.Time(t).Format(time.RFC3339Nano)
}
func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) {
if t == nil {
return
@ -83,7 +107,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) {
}
func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error {
if data == nil || strings.EqualFold(string(data), "null") {
if data == nil || string(data) == "null" {
return nil
}
var aux dateTimeRFC3339

Просмотреть файл

@ -37,7 +37,7 @@ type ListAssociatedTrafficFiltersClient struct {
}
// NewListAssociatedTrafficFiltersClient creates a new instance of ListAssociatedTrafficFiltersClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewListAssociatedTrafficFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ListAssociatedTrafficFiltersClient, error) {
@ -55,8 +55,8 @@ func NewListAssociatedTrafficFiltersClient(subscriptionID string, credential azc
// List - Get the list of all associated traffic filters for the given deployment.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - ListAssociatedTrafficFiltersClientListOptions contains the optional parameters for the ListAssociatedTrafficFiltersClient.List
// method.
@ -102,7 +102,7 @@ func (client *ListAssociatedTrafficFiltersClient) listCreateRequest(ctx context.
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/AssociatedFiltersForDeployment_list.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/AssociatedFiltersForDeployment_list.json
func ExampleListAssociatedTrafficFiltersClient_List() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -19,6 +19,15 @@ package armelastic
import "time"
// BillingInfoResponse - Marketplace Subscription and Organization details to which resource gets billed into.
type BillingInfoResponse struct {
// Marketplace Subscription details
MarketplaceSaasInfo *MarketplaceSaaSInfo
// Partner Billing Entity details: Organization Info
PartnerBillingEntity *PartnerBillingEntity
}
// CloudDeployment - Details of the user's elastic deployment associated with the monitor resource.
type CloudDeployment struct {
// READ-ONLY; Associated Azure subscription Id for the elastic deployment.
@ -73,6 +82,36 @@ type CompanyInfo struct {
State *string
}
// ConnectedPartnerResourceProperties - Connected Partner Resource Properties
type ConnectedPartnerResourceProperties struct {
// The azure resource Id of the deployment.
AzureResourceID *string
// The location of the deployment.
Location *string
// Elastic deployment name
PartnerDeploymentName *string
// Deployment URL of the elasticsearch in Elastic cloud deployment.
PartnerDeploymentURI *string
}
// ConnectedPartnerResourcesListFormat - Connected Partner Resources List Format
type ConnectedPartnerResourcesListFormat struct {
// Connected Partner Resource Properties
Properties *ConnectedPartnerResourceProperties
}
// ConnectedPartnerResourcesListResponse - List of all active elastic deployments.
type ConnectedPartnerResourcesListResponse struct {
// Link to the next set of results, if any.
NextLink *string
// Results of a list operation.
Value []*ConnectedPartnerResourcesListFormat
}
// DeploymentInfoResponse - The properties of deployment in Elastic cloud corresponding to the Elastic monitor resource.
type DeploymentInfoResponse struct {
// READ-ONLY; Deployment URL of the elasticsearch in Elastic cloud deployment.
@ -81,6 +120,10 @@ type DeploymentInfoResponse struct {
// READ-ONLY; Disk capacity of the elasticsearch in Elastic cloud deployment.
DiskCapacity *string
// READ-ONLY; Elasticsearch endpoint in Elastic cloud deployment. This is either the aliasedendpoint if available, or the
// serviceurl otherwise.
ElasticsearchEndPoint *string
// READ-ONLY; Marketplace SaaS Info of the resource.
MarketplaceSaasInfo *MarketplaceSaaSInfo
@ -163,14 +206,23 @@ type LogRules struct {
// MarketplaceSaaSInfo - Marketplace SAAS Info of the resource.
type MarketplaceSaaSInfo struct {
// The Azure Subscription ID to which the Marketplace Subscription belongs and gets billed into.
BilledAzureSubscriptionID *string
// Marketplace Subscription Details: SAAS Name
MarketplaceName *string
// Marketplace Subscription Details: Resource URI
MarketplaceResourceID *string
// Marketplace Subscription Details: SaaS Subscription Status
MarketplaceStatus *string
// Marketplace Subscription
MarketplaceSubscription *MarketplaceSaaSInfoMarketplaceSubscription
// Flag specifying if the Marketplace status is subscribed or not.
Subscribed *bool
}
// MarketplaceSaaSInfoMarketplaceSubscription - Marketplace Subscription
@ -190,9 +242,24 @@ type MonitorProperties struct {
// Flag specifying if the resource monitoring is enabled or disabled.
MonitoringStatus *MonitoringStatus
// Plan details of the monitor resource.
PlanDetails *PlanDetails
// Provisioning state of the monitor resource.
ProvisioningState *ProvisioningState
// Status of Azure Subscription where Marketplace SaaS is located.
SaaSAzureSubscriptionStatus *string
// A unique identifier associated with the campaign.
SourceCampaignID *string
// Name of the marketing campaign.
SourceCampaignName *string
// State of the Azure Subscription containing the monitor resource
SubscriptionState *string
// User information.
UserInfo *UserInfo
@ -314,6 +381,57 @@ type MonitoringTagRulesProperties struct {
ProvisioningState *ProvisioningState
}
// OpenAIIntegrationProperties - Open AI Integration details.
type OpenAIIntegrationProperties struct {
// Value of API key for Open AI resource
Key *string
// The API endpoint for Open AI resource
OpenAIResourceEndpoint *string
// The resource name of Open AI resource
OpenAIResourceID *string
// READ-ONLY; Last Update Timestamp for key updation
LastRefreshAt *time.Time
}
// OpenAIIntegrationRPModel - Capture properties of Open AI resource Integration.
type OpenAIIntegrationRPModel struct {
// Open AI Integration details.
Properties *OpenAIIntegrationProperties
// READ-ONLY; The id of the integration.
ID *string
// READ-ONLY; Name of the integration.
Name *string
// READ-ONLY; The type of the integration.
Type *string
}
// OpenAIIntegrationRPModelListResponse - Response of a list operation.
type OpenAIIntegrationRPModelListResponse struct {
// Link to the next set of results, if any.
NextLink *string
// Results of a list operation.
Value []*OpenAIIntegrationRPModel
}
// OpenAIIntegrationStatusResponse - Status of the OpenAI Integration
type OpenAIIntegrationStatusResponse struct {
// Status of the OpenAI Integration
Properties *OpenAIIntegrationStatusResponseProperties
}
// OpenAIIntegrationStatusResponseProperties - Status of the OpenAI Integration
type OpenAIIntegrationStatusResponseProperties struct {
// Status of the OpenAI Integration
Status *string
}
// OperationDisplay - The object that represents the operation.
type OperationDisplay struct {
// Description of the operation, e.g., 'Write monitors'.
@ -353,6 +471,60 @@ type OperationResult struct {
Origin *string
}
// OrganizationToAzureSubscriptionMappingResponse - The Azure Subscription ID to which the Organization of the logged in user
// belongs and gets billed into.
type OrganizationToAzureSubscriptionMappingResponse struct {
// The properties of Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into.
Properties *OrganizationToAzureSubscriptionMappingResponseProperties
}
// OrganizationToAzureSubscriptionMappingResponseProperties - The properties of Azure Subscription ID to which the Organization
// of the logged in user belongs and gets billed into.
type OrganizationToAzureSubscriptionMappingResponseProperties struct {
// The Azure Subscription ID to which the Organization belongs and gets billed into. This is empty for a new user OR a user
// without an Elastic Organization.
BilledAzureSubscriptionID *string
// The Elastic Organization Id.
ElasticOrganizationID *string
// The Elastic Organization Name.
ElasticOrganizationName *string
// READ-ONLY; Marketplace SaaS Info of the resource.
MarketplaceSaasInfo *MarketplaceSaaSInfo
}
// PartnerBillingEntity - Partner Billing details associated with the resource.
type PartnerBillingEntity struct {
// The Elastic Organization Id.
ID *string
// The Elastic Organization Name.
Name *string
// Link to the elastic organization page
PartnerEntityURI *string
}
// PlanDetails - Plan details of the monitor resource.
type PlanDetails struct {
// Offer ID of the plan
OfferID *string
// Plan ID
PlanID *string
// Plan Name
PlanName *string
// Publisher ID of the plan
PublisherID *string
// Term ID of the plan
TermID *string
}
// Properties - Elastic Resource Properties.
type Properties struct {
// Details of the elastic cloud deployment.

Просмотреть файл

@ -24,6 +24,37 @@ import (
"reflect"
)
// MarshalJSON implements the json.Marshaller interface for type BillingInfoResponse.
func (b BillingInfoResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "marketplaceSaasInfo", b.MarketplaceSaasInfo)
populate(objectMap, "partnerBillingEntity", b.PartnerBillingEntity)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type BillingInfoResponse.
func (b *BillingInfoResponse) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", b, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "marketplaceSaasInfo":
err = unpopulate(val, "MarketplaceSaasInfo", &b.MarketplaceSaasInfo)
delete(rawMsg, key)
case "partnerBillingEntity":
err = unpopulate(val, "PartnerBillingEntity", &b.PartnerBillingEntity)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", b, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type CloudDeployment.
func (c CloudDeployment) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -153,11 +184,109 @@ func (c *CompanyInfo) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ConnectedPartnerResourceProperties.
func (c ConnectedPartnerResourceProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "azureResourceId", c.AzureResourceID)
populate(objectMap, "location", c.Location)
populate(objectMap, "partnerDeploymentName", c.PartnerDeploymentName)
populate(objectMap, "partnerDeploymentUri", c.PartnerDeploymentURI)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedPartnerResourceProperties.
func (c *ConnectedPartnerResourceProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", c, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "azureResourceId":
err = unpopulate(val, "AzureResourceID", &c.AzureResourceID)
delete(rawMsg, key)
case "location":
err = unpopulate(val, "Location", &c.Location)
delete(rawMsg, key)
case "partnerDeploymentName":
err = unpopulate(val, "PartnerDeploymentName", &c.PartnerDeploymentName)
delete(rawMsg, key)
case "partnerDeploymentUri":
err = unpopulate(val, "PartnerDeploymentURI", &c.PartnerDeploymentURI)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", c, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ConnectedPartnerResourcesListFormat.
func (c ConnectedPartnerResourcesListFormat) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "properties", c.Properties)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedPartnerResourcesListFormat.
func (c *ConnectedPartnerResourcesListFormat) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", c, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "properties":
err = unpopulate(val, "Properties", &c.Properties)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", c, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type ConnectedPartnerResourcesListResponse.
func (c ConnectedPartnerResourcesListResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", c.NextLink)
populate(objectMap, "value", c.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedPartnerResourcesListResponse.
func (c *ConnectedPartnerResourcesListResponse) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", c, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &c.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &c.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", c, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type DeploymentInfoResponse.
func (d DeploymentInfoResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "deploymentUrl", d.DeploymentURL)
populate(objectMap, "diskCapacity", d.DiskCapacity)
populate(objectMap, "elasticsearchEndPoint", d.ElasticsearchEndPoint)
populate(objectMap, "marketplaceSaasInfo", d.MarketplaceSaasInfo)
populate(objectMap, "memoryCapacity", d.MemoryCapacity)
populate(objectMap, "status", d.Status)
@ -180,6 +309,9 @@ func (d *DeploymentInfoResponse) UnmarshalJSON(data []byte) error {
case "diskCapacity":
err = unpopulate(val, "DiskCapacity", &d.DiskCapacity)
delete(rawMsg, key)
case "elasticsearchEndPoint":
err = unpopulate(val, "ElasticsearchEndPoint", &d.ElasticsearchEndPoint)
delete(rawMsg, key)
case "marketplaceSaasInfo":
err = unpopulate(val, "MarketplaceSaasInfo", &d.MarketplaceSaasInfo)
delete(rawMsg, key)
@ -382,9 +514,12 @@ func (l *LogRules) UnmarshalJSON(data []byte) error {
// MarshalJSON implements the json.Marshaller interface for type MarketplaceSaaSInfo.
func (m MarketplaceSaaSInfo) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "billedAzureSubscriptionId", m.BilledAzureSubscriptionID)
populate(objectMap, "marketplaceName", m.MarketplaceName)
populate(objectMap, "marketplaceResourceId", m.MarketplaceResourceID)
populate(objectMap, "marketplaceStatus", m.MarketplaceStatus)
populate(objectMap, "marketplaceSubscription", m.MarketplaceSubscription)
populate(objectMap, "subscribed", m.Subscribed)
return json.Marshal(objectMap)
}
@ -397,15 +532,24 @@ func (m *MarketplaceSaaSInfo) UnmarshalJSON(data []byte) error {
for key, val := range rawMsg {
var err error
switch key {
case "billedAzureSubscriptionId":
err = unpopulate(val, "BilledAzureSubscriptionID", &m.BilledAzureSubscriptionID)
delete(rawMsg, key)
case "marketplaceName":
err = unpopulate(val, "MarketplaceName", &m.MarketplaceName)
delete(rawMsg, key)
case "marketplaceResourceId":
err = unpopulate(val, "MarketplaceResourceID", &m.MarketplaceResourceID)
delete(rawMsg, key)
case "marketplaceStatus":
err = unpopulate(val, "MarketplaceStatus", &m.MarketplaceStatus)
delete(rawMsg, key)
case "marketplaceSubscription":
err = unpopulate(val, "MarketplaceSubscription", &m.MarketplaceSubscription)
delete(rawMsg, key)
case "subscribed":
err = unpopulate(val, "Subscribed", &m.Subscribed)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", m, err)
@ -449,7 +593,12 @@ func (m MonitorProperties) MarshalJSON() ([]byte, error) {
populate(objectMap, "liftrResourceCategory", m.LiftrResourceCategory)
populate(objectMap, "liftrResourcePreference", m.LiftrResourcePreference)
populate(objectMap, "monitoringStatus", m.MonitoringStatus)
populate(objectMap, "planDetails", m.PlanDetails)
populate(objectMap, "provisioningState", m.ProvisioningState)
populate(objectMap, "saaSAzureSubscriptionStatus", m.SaaSAzureSubscriptionStatus)
populate(objectMap, "sourceCampaignId", m.SourceCampaignID)
populate(objectMap, "sourceCampaignName", m.SourceCampaignName)
populate(objectMap, "subscriptionState", m.SubscriptionState)
populate(objectMap, "userInfo", m.UserInfo)
populate(objectMap, "version", m.Version)
return json.Marshal(objectMap)
@ -479,9 +628,24 @@ func (m *MonitorProperties) UnmarshalJSON(data []byte) error {
case "monitoringStatus":
err = unpopulate(val, "MonitoringStatus", &m.MonitoringStatus)
delete(rawMsg, key)
case "planDetails":
err = unpopulate(val, "PlanDetails", &m.PlanDetails)
delete(rawMsg, key)
case "provisioningState":
err = unpopulate(val, "ProvisioningState", &m.ProvisioningState)
delete(rawMsg, key)
case "saaSAzureSubscriptionStatus":
err = unpopulate(val, "SaaSAzureSubscriptionStatus", &m.SaaSAzureSubscriptionStatus)
delete(rawMsg, key)
case "sourceCampaignId":
err = unpopulate(val, "SourceCampaignID", &m.SourceCampaignID)
delete(rawMsg, key)
case "sourceCampaignName":
err = unpopulate(val, "SourceCampaignName", &m.SourceCampaignName)
delete(rawMsg, key)
case "subscriptionState":
err = unpopulate(val, "SubscriptionState", &m.SubscriptionState)
delete(rawMsg, key)
case "userInfo":
err = unpopulate(val, "UserInfo", &m.UserInfo)
delete(rawMsg, key)
@ -811,6 +975,169 @@ func (m *MonitoringTagRulesProperties) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OpenAIIntegrationProperties.
func (o OpenAIIntegrationProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "key", o.Key)
populateDateTimeRFC3339(objectMap, "lastRefreshAt", o.LastRefreshAt)
populate(objectMap, "openAIResourceEndpoint", o.OpenAIResourceEndpoint)
populate(objectMap, "openAIResourceId", o.OpenAIResourceID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OpenAIIntegrationProperties.
func (o *OpenAIIntegrationProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "key":
err = unpopulate(val, "Key", &o.Key)
delete(rawMsg, key)
case "lastRefreshAt":
err = unpopulateDateTimeRFC3339(val, "LastRefreshAt", &o.LastRefreshAt)
delete(rawMsg, key)
case "openAIResourceEndpoint":
err = unpopulate(val, "OpenAIResourceEndpoint", &o.OpenAIResourceEndpoint)
delete(rawMsg, key)
case "openAIResourceId":
err = unpopulate(val, "OpenAIResourceID", &o.OpenAIResourceID)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OpenAIIntegrationRPModel.
func (o OpenAIIntegrationRPModel) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", o.ID)
populate(objectMap, "name", o.Name)
populate(objectMap, "properties", o.Properties)
populate(objectMap, "type", o.Type)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OpenAIIntegrationRPModel.
func (o *OpenAIIntegrationRPModel) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &o.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &o.Name)
delete(rawMsg, key)
case "properties":
err = unpopulate(val, "Properties", &o.Properties)
delete(rawMsg, key)
case "type":
err = unpopulate(val, "Type", &o.Type)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OpenAIIntegrationRPModelListResponse.
func (o OpenAIIntegrationRPModelListResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "nextLink", o.NextLink)
populate(objectMap, "value", o.Value)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OpenAIIntegrationRPModelListResponse.
func (o *OpenAIIntegrationRPModelListResponse) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "nextLink":
err = unpopulate(val, "NextLink", &o.NextLink)
delete(rawMsg, key)
case "value":
err = unpopulate(val, "Value", &o.Value)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OpenAIIntegrationStatusResponse.
func (o OpenAIIntegrationStatusResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "properties", o.Properties)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OpenAIIntegrationStatusResponse.
func (o *OpenAIIntegrationStatusResponse) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "properties":
err = unpopulate(val, "Properties", &o.Properties)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OpenAIIntegrationStatusResponseProperties.
func (o OpenAIIntegrationStatusResponseProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "status", o.Status)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OpenAIIntegrationStatusResponseProperties.
func (o *OpenAIIntegrationStatusResponseProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "status":
err = unpopulate(val, "Status", &o.Status)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OperationDisplay.
func (o OperationDisplay) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -920,6 +1247,150 @@ func (o *OperationResult) UnmarshalJSON(data []byte) error {
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OrganizationToAzureSubscriptionMappingResponse.
func (o OrganizationToAzureSubscriptionMappingResponse) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "properties", o.Properties)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OrganizationToAzureSubscriptionMappingResponse.
func (o *OrganizationToAzureSubscriptionMappingResponse) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "properties":
err = unpopulate(val, "Properties", &o.Properties)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type OrganizationToAzureSubscriptionMappingResponseProperties.
func (o OrganizationToAzureSubscriptionMappingResponseProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "billedAzureSubscriptionId", o.BilledAzureSubscriptionID)
populate(objectMap, "elasticOrganizationId", o.ElasticOrganizationID)
populate(objectMap, "elasticOrganizationName", o.ElasticOrganizationName)
populate(objectMap, "marketplaceSaasInfo", o.MarketplaceSaasInfo)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type OrganizationToAzureSubscriptionMappingResponseProperties.
func (o *OrganizationToAzureSubscriptionMappingResponseProperties) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "billedAzureSubscriptionId":
err = unpopulate(val, "BilledAzureSubscriptionID", &o.BilledAzureSubscriptionID)
delete(rawMsg, key)
case "elasticOrganizationId":
err = unpopulate(val, "ElasticOrganizationID", &o.ElasticOrganizationID)
delete(rawMsg, key)
case "elasticOrganizationName":
err = unpopulate(val, "ElasticOrganizationName", &o.ElasticOrganizationName)
delete(rawMsg, key)
case "marketplaceSaasInfo":
err = unpopulate(val, "MarketplaceSaasInfo", &o.MarketplaceSaasInfo)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", o, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PartnerBillingEntity.
func (p PartnerBillingEntity) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "id", p.ID)
populate(objectMap, "name", p.Name)
populate(objectMap, "partnerEntityUri", p.PartnerEntityURI)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerBillingEntity.
func (p *PartnerBillingEntity) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "id":
err = unpopulate(val, "ID", &p.ID)
delete(rawMsg, key)
case "name":
err = unpopulate(val, "Name", &p.Name)
delete(rawMsg, key)
case "partnerEntityUri":
err = unpopulate(val, "PartnerEntityURI", &p.PartnerEntityURI)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type PlanDetails.
func (p PlanDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
populate(objectMap, "offerID", p.OfferID)
populate(objectMap, "planID", p.PlanID)
populate(objectMap, "planName", p.PlanName)
populate(objectMap, "publisherID", p.PublisherID)
populate(objectMap, "termID", p.TermID)
return json.Marshal(objectMap)
}
// UnmarshalJSON implements the json.Unmarshaller interface for type PlanDetails.
func (p *PlanDetails) UnmarshalJSON(data []byte) error {
var rawMsg map[string]json.RawMessage
if err := json.Unmarshal(data, &rawMsg); err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
for key, val := range rawMsg {
var err error
switch key {
case "offerID":
err = unpopulate(val, "OfferID", &p.OfferID)
delete(rawMsg, key)
case "planID":
err = unpopulate(val, "PlanID", &p.PlanID)
delete(rawMsg, key)
case "planName":
err = unpopulate(val, "PlanName", &p.PlanName)
delete(rawMsg, key)
case "publisherID":
err = unpopulate(val, "PublisherID", &p.PublisherID)
delete(rawMsg, key)
case "termID":
err = unpopulate(val, "TermID", &p.TermID)
delete(rawMsg, key)
}
if err != nil {
return fmt.Errorf("unmarshalling type %T: %v", p, err)
}
}
return nil
}
// MarshalJSON implements the json.Marshaller interface for type Properties.
func (p Properties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]any)
@ -1517,7 +1988,7 @@ func populate(m map[string]any, k string, v any) {
}
func unpopulate(data json.RawMessage, fn string, v any) error {
if data == nil {
if data == nil || string(data) == "null" {
return nil
}
if err := json.Unmarshal(data, v); err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type MonitorClient struct {
}
// NewMonitorClient creates a new instance of MonitorClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewMonitorClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MonitorClient, error) {
@ -55,8 +55,8 @@ func NewMonitorClient(subscriptionID string, credential azcore.TokenCredential,
// BeginUpgrade - Upgradable version for a monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - MonitorClientBeginUpgradeOptions contains the optional parameters for the MonitorClient.BeginUpgrade method.
func (client *MonitorClient) BeginUpgrade(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorClientBeginUpgradeOptions) (*runtime.Poller[MonitorClientUpgradeResponse], error) {
@ -79,7 +79,7 @@ func (client *MonitorClient) BeginUpgrade(ctx context.Context, resourceGroupName
// Upgrade - Upgradable version for a monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
func (client *MonitorClient) upgrade(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorClientBeginUpgradeOptions) (*http.Response, error) {
var err error
const operationName = "MonitorClient.BeginUpgrade"
@ -121,7 +121,7 @@ func (client *MonitorClient) upgradeCreateRequest(ctx context.Context, resourceG
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if options != nil && options.Body != nil {

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitor_Upgrade.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitor_Upgrade.json
func ExampleMonitorClient_BeginUpgrade() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type MonitoredResourcesClient struct {
}
// NewMonitoredResourcesClient creates a new instance of MonitoredResourcesClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewMonitoredResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MonitoredResourcesClient, error) {
@ -54,8 +54,8 @@ func NewMonitoredResourcesClient(subscriptionID string, credential azcore.TokenC
// NewListPager - List the resources currently being monitored by the Elastic monitor resource.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - MonitoredResourcesClientListOptions contains the optional parameters for the MonitoredResourcesClient.NewListPager
// method.
@ -102,7 +102,7 @@ func (client *MonitoredResourcesClient) listCreateRequest(ctx context.Context, r
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/MonitoredResources_List.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/MonitoredResources_List.json
func ExampleMonitoredResourcesClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type MonitorsClient struct {
}
// NewMonitorsClient creates a new instance of MonitorsClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewMonitorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MonitorsClient, error) {
@ -55,8 +55,8 @@ func NewMonitorsClient(subscriptionID string, credential azcore.TokenCredential,
// BeginCreate - Create a monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - MonitorsClientBeginCreateOptions contains the optional parameters for the MonitorsClient.BeginCreate method.
func (client *MonitorsClient) BeginCreate(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginCreateOptions) (*runtime.Poller[MonitorsClientCreateResponse], error) {
@ -80,7 +80,7 @@ func (client *MonitorsClient) BeginCreate(ctx context.Context, resourceGroupName
// Create - Create a monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
func (client *MonitorsClient) create(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginCreateOptions) (*http.Response, error) {
var err error
const operationName = "MonitorsClient.BeginCreate"
@ -122,7 +122,7 @@ func (client *MonitorsClient) createCreateRequest(ctx context.Context, resourceG
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if options != nil && options.Body != nil {
@ -137,8 +137,8 @@ func (client *MonitorsClient) createCreateRequest(ctx context.Context, resourceG
// BeginDelete - Delete a monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - MonitorsClientBeginDeleteOptions contains the optional parameters for the MonitorsClient.BeginDelete method.
func (client *MonitorsClient) BeginDelete(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginDeleteOptions) (*runtime.Poller[MonitorsClientDeleteResponse], error) {
@ -161,7 +161,7 @@ func (client *MonitorsClient) BeginDelete(ctx context.Context, resourceGroupName
// Delete - Delete a monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
func (client *MonitorsClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginDeleteOptions) (*http.Response, error) {
var err error
const operationName = "MonitorsClient.BeginDelete"
@ -203,7 +203,7 @@ func (client *MonitorsClient) deleteCreateRequest(ctx context.Context, resourceG
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -212,8 +212,8 @@ func (client *MonitorsClient) deleteCreateRequest(ctx context.Context, resourceG
// Get - Get the properties of a specific monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - MonitorsClientGetOptions contains the optional parameters for the MonitorsClient.Get method.
func (client *MonitorsClient) Get(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientGetOptions) (MonitorsClientGetResponse, error) {
@ -258,7 +258,7 @@ func (client *MonitorsClient) getCreateRequest(ctx context.Context, resourceGrou
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -275,7 +275,7 @@ func (client *MonitorsClient) getHandleResponse(resp *http.Response) (MonitorsCl
// NewListPager - List all monitors under the specified subscription.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
// - options - MonitorsClientListOptions contains the optional parameters for the MonitorsClient.NewListPager method.
func (client *MonitorsClient) NewListPager(options *MonitorsClientListOptions) *runtime.Pager[MonitorsClientListResponse] {
return runtime.NewPager(runtime.PagingHandler[MonitorsClientListResponse]{
@ -312,7 +312,7 @@ func (client *MonitorsClient) listCreateRequest(ctx context.Context, options *Mo
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -329,8 +329,8 @@ func (client *MonitorsClient) listHandleResponse(resp *http.Response) (MonitorsC
// NewListByResourceGroupPager - List all monitors under the specified resource group.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - options - MonitorsClientListByResourceGroupOptions contains the optional parameters for the MonitorsClient.NewListByResourceGroupPager
// method.
func (client *MonitorsClient) NewListByResourceGroupPager(resourceGroupName string, options *MonitorsClientListByResourceGroupOptions) *runtime.Pager[MonitorsClientListByResourceGroupResponse] {
@ -372,7 +372,7 @@ func (client *MonitorsClient) listByResourceGroupCreateRequest(ctx context.Conte
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -390,8 +390,8 @@ func (client *MonitorsClient) listByResourceGroupHandleResponse(resp *http.Respo
// Update - Update a monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - MonitorsClientUpdateOptions contains the optional parameters for the MonitorsClient.Update method.
func (client *MonitorsClient) Update(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientUpdateOptions) (MonitorsClientUpdateResponse, error) {
@ -436,7 +436,7 @@ func (client *MonitorsClient) updateCreateRequest(ctx context.Context, resourceG
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if options != nil && options.Body != nil {

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_List.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_List.json
func ExampleMonitorsClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -84,7 +84,7 @@ func ExampleMonitorsClient_NewListPager() {
}
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_ListByResourceGroup.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_ListByResourceGroup.json
func ExampleMonitorsClient_NewListByResourceGroupPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -143,7 +143,7 @@ func ExampleMonitorsClient_NewListByResourceGroupPager() {
}
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Get.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Get.json
func ExampleMonitorsClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -194,7 +194,7 @@ func ExampleMonitorsClient_Get() {
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Create.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Create.json
func ExampleMonitorsClient_BeginCreate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -249,7 +249,7 @@ func ExampleMonitorsClient_BeginCreate() {
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Update.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Update.json
func ExampleMonitorsClient_Update() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -303,7 +303,7 @@ func ExampleMonitorsClient_Update() {
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Monitors_Delete.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Monitors_Delete.json
func ExampleMonitorsClient_BeginDelete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -0,0 +1,389 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.
// Code generated by @autorest/go. DO NOT EDIT.
package armelastic
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"
)
// OpenAIClient contains the methods for the OpenAI group.
// Don't use this type directly, use NewOpenAIClient() instead.
type OpenAIClient struct {
internal *arm.Client
subscriptionID string
}
// NewOpenAIClient creates a new instance of OpenAIClient with the specified values.
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewOpenAIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OpenAIClient, error) {
cl, err := arm.NewClient(moduleName, moduleVersion, credential, options)
if err != nil {
return nil, err
}
client := &OpenAIClient{
subscriptionID: subscriptionID,
internal: cl,
}
return client, nil
}
// CreateOrUpdate - Create or update a OpenAI integration rule for a given monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - integrationName - OpenAI Integration name
// - options - OpenAIClientCreateOrUpdateOptions contains the optional parameters for the OpenAIClient.CreateOrUpdate method.
func (client *OpenAIClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *OpenAIClientCreateOrUpdateOptions) (OpenAIClientCreateOrUpdateResponse, error) {
var err error
const operationName = "OpenAIClient.CreateOrUpdate"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, monitorName, integrationName, options)
if err != nil {
return OpenAIClientCreateOrUpdateResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return OpenAIClientCreateOrUpdateResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) {
err = runtime.NewResponseError(httpResp)
return OpenAIClientCreateOrUpdateResponse{}, err
}
resp, err := client.createOrUpdateHandleResponse(httpResp)
return resp, err
}
// createOrUpdateCreateRequest creates the CreateOrUpdate request.
func (client *OpenAIClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *OpenAIClientCreateOrUpdateOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if monitorName == "" {
return nil, errors.New("parameter monitorName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName))
if integrationName == "" {
return nil, errors.New("parameter integrationName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{integrationName}", url.PathEscape(integrationName))
req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if options != nil && options.Body != nil {
if err := runtime.MarshalAsJSON(req, *options.Body); err != nil {
return nil, err
}
return req, nil
}
return req, nil
}
// createOrUpdateHandleResponse handles the CreateOrUpdate response.
func (client *OpenAIClient) createOrUpdateHandleResponse(resp *http.Response) (OpenAIClientCreateOrUpdateResponse, error) {
result := OpenAIClientCreateOrUpdateResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.OpenAIIntegrationRPModel); err != nil {
return OpenAIClientCreateOrUpdateResponse{}, err
}
return result, nil
}
// Delete - Delete OpenAI integration rule for a given monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - integrationName - OpenAI Integration name
// - options - OpenAIClientDeleteOptions contains the optional parameters for the OpenAIClient.Delete method.
func (client *OpenAIClient) Delete(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *OpenAIClientDeleteOptions) (OpenAIClientDeleteResponse, error) {
var err error
const operationName = "OpenAIClient.Delete"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, integrationName, options)
if err != nil {
return OpenAIClientDeleteResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return OpenAIClientDeleteResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) {
err = runtime.NewResponseError(httpResp)
return OpenAIClientDeleteResponse{}, err
}
return OpenAIClientDeleteResponse{}, nil
}
// deleteCreateRequest creates the Delete request.
func (client *OpenAIClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *OpenAIClientDeleteOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if monitorName == "" {
return nil, errors.New("parameter monitorName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName))
if integrationName == "" {
return nil, errors.New("parameter integrationName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{integrationName}", url.PathEscape(integrationName))
req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// Get - Get OpenAI integration rule for a given monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - integrationName - OpenAI Integration name
// - options - OpenAIClientGetOptions contains the optional parameters for the OpenAIClient.Get method.
func (client *OpenAIClient) Get(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *OpenAIClientGetOptions) (OpenAIClientGetResponse, error) {
var err error
const operationName = "OpenAIClient.Get"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.getCreateRequest(ctx, resourceGroupName, monitorName, integrationName, options)
if err != nil {
return OpenAIClientGetResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return OpenAIClientGetResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return OpenAIClientGetResponse{}, err
}
resp, err := client.getHandleResponse(httpResp)
return resp, err
}
// getCreateRequest creates the Get request.
func (client *OpenAIClient) getCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *OpenAIClientGetOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if monitorName == "" {
return nil, errors.New("parameter monitorName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName))
if integrationName == "" {
return nil, errors.New("parameter integrationName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{integrationName}", url.PathEscape(integrationName))
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", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getHandleResponse handles the Get response.
func (client *OpenAIClient) getHandleResponse(resp *http.Response) (OpenAIClientGetResponse, error) {
result := OpenAIClientGetResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.OpenAIIntegrationRPModel); err != nil {
return OpenAIClientGetResponse{}, err
}
return result, nil
}
// GetStatus - Get OpenAI integration status for a given integration.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - integrationName - OpenAI Integration name
// - options - OpenAIClientGetStatusOptions contains the optional parameters for the OpenAIClient.GetStatus method.
func (client *OpenAIClient) GetStatus(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *OpenAIClientGetStatusOptions) (OpenAIClientGetStatusResponse, error) {
var err error
const operationName = "OpenAIClient.GetStatus"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.getStatusCreateRequest(ctx, resourceGroupName, monitorName, integrationName, options)
if err != nil {
return OpenAIClientGetStatusResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return OpenAIClientGetStatusResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return OpenAIClientGetStatusResponse{}, err
}
resp, err := client.getStatusHandleResponse(httpResp)
return resp, err
}
// getStatusCreateRequest creates the GetStatus request.
func (client *OpenAIClient) getStatusCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, integrationName string, options *OpenAIClientGetStatusOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations/{integrationName}/getStatus"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if monitorName == "" {
return nil, errors.New("parameter monitorName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName))
if integrationName == "" {
return nil, errors.New("parameter integrationName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{integrationName}", url.PathEscape(integrationName))
req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getStatusHandleResponse handles the GetStatus response.
func (client *OpenAIClient) getStatusHandleResponse(resp *http.Response) (OpenAIClientGetStatusResponse, error) {
result := OpenAIClientGetStatusResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.OpenAIIntegrationStatusResponse); err != nil {
return OpenAIClientGetStatusResponse{}, err
}
return result, nil
}
// NewListPager - List OpenAI integration rule for a given monitor resource.
//
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - OpenAIClientListOptions contains the optional parameters for the OpenAIClient.NewListPager method.
func (client *OpenAIClient) NewListPager(resourceGroupName string, monitorName string, options *OpenAIClientListOptions) *runtime.Pager[OpenAIClientListResponse] {
return runtime.NewPager(runtime.PagingHandler[OpenAIClientListResponse]{
More: func(page OpenAIClientListResponse) bool {
return page.NextLink != nil && len(*page.NextLink) > 0
},
Fetcher: func(ctx context.Context, page *OpenAIClientListResponse) (OpenAIClientListResponse, error) {
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OpenAIClient.NewListPager")
nextLink := ""
if page != nil {
nextLink = *page.NextLink
}
resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) {
return client.listCreateRequest(ctx, resourceGroupName, monitorName, options)
}, nil)
if err != nil {
return OpenAIClientListResponse{}, err
}
return client.listHandleResponse(resp)
},
Tracer: client.internal.Tracer(),
})
}
// listCreateRequest creates the List request.
func (client *OpenAIClient) listCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *OpenAIClientListOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/openAIIntegrations"
if client.subscriptionID == "" {
return nil, errors.New("parameter client.subscriptionID cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID))
if resourceGroupName == "" {
return nil, errors.New("parameter resourceGroupName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName))
if monitorName == "" {
return nil, errors.New("parameter monitorName cannot be empty")
}
urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName))
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", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// listHandleResponse handles the List response.
func (client *OpenAIClient) listHandleResponse(resp *http.Response) (OpenAIClientListResponse, error) {
result := OpenAIClientListResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.OpenAIIntegrationRPModelListResponse); err != nil {
return OpenAIClientListResponse{}, err
}
return result, nil
}

Просмотреть файл

@ -0,0 +1,166 @@
//go:build go1.18
// +build go1.18
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
// is regenerated.
// DO NOT EDIT.
package armelastic_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_List.json
func ExampleOpenAIClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armelastic.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
pager := clientFactory.NewOpenAIClient().NewListPager("myResourceGroup", "myMonitor", 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.OpenAIIntegrationRPModelListResponse = armelastic.OpenAIIntegrationRPModelListResponse{
// Value: []*armelastic.OpenAIIntegrationRPModel{
// {
// Name: to.Ptr("default"),
// Type: to.Ptr("Microsoft.Elastic/monitors/openAIIntegration"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Datadog/monitors/myMonitor/openAIIntegration/default"),
// Properties: &armelastic.OpenAIIntegrationProperties{
// LastRefreshAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-12T09:28:50.957Z"); return t}()),
// OpenAIResourceEndpoint: to.Ptr("https://myOpenAI.openai.azure.com/"),
// OpenAIResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/myOpenAI"),
// },
// }},
// }
}
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_Get.json
func ExampleOpenAIClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armelastic.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewOpenAIClient().Get(ctx, "myResourceGroup", "myMonitor", "default", 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.OpenAIIntegrationRPModel = armelastic.OpenAIIntegrationRPModel{
// Name: to.Ptr("default"),
// Type: to.Ptr("Microsoft.Elastic/monitors/openAIIntegration"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Datadog/monitors/myMonitor/openAIIntegration/default"),
// Properties: &armelastic.OpenAIIntegrationProperties{
// LastRefreshAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-12T09:28:50.957Z"); return t}()),
// OpenAIResourceEndpoint: to.Ptr("https://myOpenAI.openai.azure.com/"),
// OpenAIResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/myOpenAI"),
// },
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_CreateOrUpdate.json
func ExampleOpenAIClient_CreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armelastic.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewOpenAIClient().CreateOrUpdate(ctx, "myResourceGroup", "myMonitor", "default", &armelastic.OpenAIClientCreateOrUpdateOptions{Body: 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.OpenAIIntegrationRPModel = armelastic.OpenAIIntegrationRPModel{
// Name: to.Ptr("default"),
// Type: to.Ptr("Microsoft.Elastic/monitors/openAIIntegration"),
// ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Datadog/monitors/myMonitor/openAIIntegration/default"),
// Properties: &armelastic.OpenAIIntegrationProperties{
// LastRefreshAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-12T09:28:50.957Z"); return t}()),
// OpenAIResourceEndpoint: to.Ptr("https://myOpenAI.openai.azure.com/"),
// OpenAIResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.CognitiveServices/accounts/myOpenAI"),
// },
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_Delete.json
func ExampleOpenAIClient_Delete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armelastic.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
_, err = clientFactory.NewOpenAIClient().Delete(ctx, "myResourceGroup", "myMonitor", "default", 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/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/OpenAI_GetStatus.json
func ExampleOpenAIClient_GetStatus() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armelastic.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewOpenAIClient().GetStatus(ctx, "myResourceGroup", "myMonitor", "default", 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.OpenAIIntegrationStatusResponse = armelastic.OpenAIIntegrationStatusResponse{
// Properties: &armelastic.OpenAIIntegrationStatusResponseProperties{
// Status: to.Ptr("Succeeded"),
// },
// }
}

Просмотреть файл

@ -48,7 +48,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO
// NewListPager - List all operations provided by Microsoft.Elastic.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-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]{
@ -81,7 +81,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options *
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Operations_List.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Operations_List.json
func ExampleOperationsClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -32,6 +32,17 @@ type AssociateTrafficFilterClientBeginAssociateOptions struct {
RulesetID *string
}
// BillingInfoClientGetOptions contains the optional parameters for the BillingInfoClient.Get method.
type BillingInfoClientGetOptions struct {
// placeholder for future optional parameters
}
// ConnectedPartnerResourcesClientListOptions contains the optional parameters for the ConnectedPartnerResourcesClient.NewListPager
// method.
type ConnectedPartnerResourcesClientListOptions struct {
// placeholder for future optional parameters
}
// CreateAndAssociateIPFilterClientBeginCreateOptions contains the optional parameters for the CreateAndAssociateIPFilterClient.BeginCreate
// method.
type CreateAndAssociateIPFilterClientBeginCreateOptions struct {
@ -146,6 +157,31 @@ type MonitorsClientUpdateOptions struct {
Body *MonitorResourceUpdateParameters
}
// OpenAIClientCreateOrUpdateOptions contains the optional parameters for the OpenAIClient.CreateOrUpdate method.
type OpenAIClientCreateOrUpdateOptions struct {
Body *OpenAIIntegrationRPModel
}
// OpenAIClientDeleteOptions contains the optional parameters for the OpenAIClient.Delete method.
type OpenAIClientDeleteOptions struct {
// placeholder for future optional parameters
}
// OpenAIClientGetOptions contains the optional parameters for the OpenAIClient.Get method.
type OpenAIClientGetOptions struct {
// placeholder for future optional parameters
}
// OpenAIClientGetStatusOptions contains the optional parameters for the OpenAIClient.GetStatus method.
type OpenAIClientGetStatusOptions struct {
// placeholder for future optional parameters
}
// OpenAIClientListOptions contains the optional parameters for the OpenAIClient.NewListPager method.
type OpenAIClientListOptions struct {
// placeholder for future optional parameters
}
// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
type OperationsClientListOptions struct {
// placeholder for future optional parameters
@ -157,6 +193,12 @@ type OrganizationsClientGetAPIKeyOptions struct {
Body *UserEmailID
}
// OrganizationsClientGetElasticToAzureSubscriptionMappingOptions contains the optional parameters for the OrganizationsClient.GetElasticToAzureSubscriptionMapping
// method.
type OrganizationsClientGetElasticToAzureSubscriptionMappingOptions struct {
// placeholder for future optional parameters
}
// TagRulesClientBeginDeleteOptions contains the optional parameters for the TagRulesClient.BeginDelete method.
type TagRulesClientBeginDeleteOptions struct {
// Resumes the LRO from the provided token.

Просмотреть файл

@ -37,7 +37,7 @@ type OrganizationsClient struct {
}
// NewOrganizationsClient creates a new instance of OrganizationsClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewOrganizationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OrganizationsClient, error) {
@ -56,7 +56,7 @@ func NewOrganizationsClient(subscriptionID string, credential azcore.TokenCreden
// Organization.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
// - options - OrganizationsClientGetAPIKeyOptions contains the optional parameters for the OrganizationsClient.GetAPIKey method.
func (client *OrganizationsClient) GetAPIKey(ctx context.Context, options *OrganizationsClientGetAPIKeyOptions) (OrganizationsClientGetAPIKeyResponse, error) {
var err error
@ -92,7 +92,7 @@ func (client *OrganizationsClient) getAPIKeyCreateRequest(ctx context.Context, o
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if options != nil && options.Body != nil {
@ -112,3 +112,59 @@ func (client *OrganizationsClient) getAPIKeyHandleResponse(resp *http.Response)
}
return result, nil
}
// GetElasticToAzureSubscriptionMapping - Get Elastic Organization To Azure Subscription Mapping details for the logged-in
// user.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2024-03-01
// - options - OrganizationsClientGetElasticToAzureSubscriptionMappingOptions contains the optional parameters for the OrganizationsClient.GetElasticToAzureSubscriptionMapping
// method.
func (client *OrganizationsClient) GetElasticToAzureSubscriptionMapping(ctx context.Context, options *OrganizationsClientGetElasticToAzureSubscriptionMappingOptions) (OrganizationsClientGetElasticToAzureSubscriptionMappingResponse, error) {
var err error
const operationName = "OrganizationsClient.GetElasticToAzureSubscriptionMapping"
ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName)
ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil)
defer func() { endSpan(err) }()
req, err := client.getElasticToAzureSubscriptionMappingCreateRequest(ctx, options)
if err != nil {
return OrganizationsClientGetElasticToAzureSubscriptionMappingResponse{}, err
}
httpResp, err := client.internal.Pipeline().Do(req)
if err != nil {
return OrganizationsClientGetElasticToAzureSubscriptionMappingResponse{}, err
}
if !runtime.HasStatusCode(httpResp, http.StatusOK) {
err = runtime.NewResponseError(httpResp)
return OrganizationsClientGetElasticToAzureSubscriptionMappingResponse{}, err
}
resp, err := client.getElasticToAzureSubscriptionMappingHandleResponse(httpResp)
return resp, err
}
// getElasticToAzureSubscriptionMappingCreateRequest creates the GetElasticToAzureSubscriptionMapping request.
func (client *OrganizationsClient) getElasticToAzureSubscriptionMappingCreateRequest(ctx context.Context, options *OrganizationsClientGetElasticToAzureSubscriptionMappingOptions) (*policy.Request, error) {
urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/getElasticOrganizationToAzureSubscriptionMapping"
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.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))
if err != nil {
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
}
// getElasticToAzureSubscriptionMappingHandleResponse handles the GetElasticToAzureSubscriptionMapping response.
func (client *OrganizationsClient) getElasticToAzureSubscriptionMappingHandleResponse(resp *http.Response) (OrganizationsClientGetElasticToAzureSubscriptionMappingResponse, error) {
result := OrganizationsClientGetElasticToAzureSubscriptionMappingResponse{}
if err := runtime.UnmarshalAsJSON(resp, &result.OrganizationToAzureSubscriptionMappingResponse); err != nil {
return OrganizationsClientGetElasticToAzureSubscriptionMappingResponse{}, err
}
return result, nil
}

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/Organizations_GetApiKey.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Organizations_GetApiKey.json
func ExampleOrganizationsClient_GetAPIKey() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -49,3 +49,38 @@ func ExampleOrganizationsClient_GetAPIKey() {
// },
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/Organizations_GetElasticToAzureSubscriptionMapping.json
func ExampleOrganizationsClient_GetElasticToAzureSubscriptionMapping() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armelastic.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewOrganizationsClient().GetElasticToAzureSubscriptionMapping(ctx, 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.OrganizationToAzureSubscriptionMappingResponse = armelastic.OrganizationToAzureSubscriptionMappingResponse{
// Properties: &armelastic.OrganizationToAzureSubscriptionMappingResponseProperties{
// BilledAzureSubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"),
// ElasticOrganizationID: to.Ptr("1234567890"),
// ElasticOrganizationName: to.Ptr("elasticOrganizationName"),
// MarketplaceSaasInfo: &armelastic.MarketplaceSaaSInfo{
// MarketplaceName: to.Ptr("MP_RESOURCE"),
// MarketplaceResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.SaaS/resources/AzElastic_b1190c8f"),
// MarketplaceStatus: to.Ptr("Status"),
// MarketplaceSubscription: &armelastic.MarketplaceSaaSInfoMarketplaceSubscription{
// ID: to.Ptr("12345678-1234-1234-1234-123456789012"),
// },
// },
// },
// }
}

Просмотреть файл

@ -28,6 +28,18 @@ type AssociateTrafficFilterClientAssociateResponse struct {
// placeholder for future response values
}
// BillingInfoClientGetResponse contains the response from method BillingInfoClient.Get.
type BillingInfoClientGetResponse struct {
// Marketplace Subscription and Organization details to which resource gets billed into.
BillingInfoResponse
}
// ConnectedPartnerResourcesClientListResponse contains the response from method ConnectedPartnerResourcesClient.NewListPager.
type ConnectedPartnerResourcesClientListResponse struct {
// List of all active elastic deployments.
ConnectedPartnerResourcesListResponse
}
// CreateAndAssociateIPFilterClientCreateResponse contains the response from method CreateAndAssociateIPFilterClient.BeginCreate.
type CreateAndAssociateIPFilterClientCreateResponse struct {
// placeholder for future response values
@ -112,6 +124,35 @@ type MonitorsClientUpdateResponse struct {
MonitorResource
}
// OpenAIClientCreateOrUpdateResponse contains the response from method OpenAIClient.CreateOrUpdate.
type OpenAIClientCreateOrUpdateResponse struct {
// Capture properties of Open AI resource Integration.
OpenAIIntegrationRPModel
}
// OpenAIClientDeleteResponse contains the response from method OpenAIClient.Delete.
type OpenAIClientDeleteResponse struct {
// placeholder for future response values
}
// OpenAIClientGetResponse contains the response from method OpenAIClient.Get.
type OpenAIClientGetResponse struct {
// Capture properties of Open AI resource Integration.
OpenAIIntegrationRPModel
}
// OpenAIClientGetStatusResponse contains the response from method OpenAIClient.GetStatus.
type OpenAIClientGetStatusResponse struct {
// Status of the OpenAI Integration
OpenAIIntegrationStatusResponse
}
// OpenAIClientListResponse contains the response from method OpenAIClient.NewListPager.
type OpenAIClientListResponse struct {
// Response of a list operation.
OpenAIIntegrationRPModelListResponse
}
// OperationsClientListResponse contains the response from method OperationsClient.NewListPager.
type OperationsClientListResponse struct {
// Result of GET request to list the Microsoft.Elastic operations.
@ -124,6 +165,12 @@ type OrganizationsClientGetAPIKeyResponse struct {
UserAPIKeyResponse
}
// OrganizationsClientGetElasticToAzureSubscriptionMappingResponse contains the response from method OrganizationsClient.GetElasticToAzureSubscriptionMapping.
type OrganizationsClientGetElasticToAzureSubscriptionMappingResponse struct {
// The Azure Subscription ID to which the Organization of the logged in user belongs and gets billed into.
OrganizationToAzureSubscriptionMappingResponse
}
// TagRulesClientCreateOrUpdateResponse contains the response from method TagRulesClient.CreateOrUpdate.
type TagRulesClientCreateOrUpdateResponse struct {
// Capture logs and metrics of Azure resources based on ARM tags.

Просмотреть файл

@ -37,7 +37,7 @@ type TagRulesClient struct {
}
// NewTagRulesClient creates a new instance of TagRulesClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewTagRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TagRulesClient, error) {
@ -55,8 +55,8 @@ func NewTagRulesClient(subscriptionID string, credential azcore.TokenCredential,
// CreateOrUpdate - Create or update a tag rule set for a given monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - ruleSetName - Tag Rule Set resource name
// - options - TagRulesClientCreateOrUpdateOptions contains the optional parameters for the TagRulesClient.CreateOrUpdate method.
@ -106,7 +106,7 @@ func (client *TagRulesClient) createOrUpdateCreateRequest(ctx context.Context, r
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if options != nil && options.Body != nil {
@ -130,8 +130,8 @@ func (client *TagRulesClient) createOrUpdateHandleResponse(resp *http.Response)
// BeginDelete - Delete a tag rule set for a given monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - ruleSetName - Tag Rule Set resource name
// - options - TagRulesClientBeginDeleteOptions contains the optional parameters for the TagRulesClient.BeginDelete method.
@ -155,7 +155,7 @@ func (client *TagRulesClient) BeginDelete(ctx context.Context, resourceGroupName
// Delete - Delete a tag rule set for a given monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
func (client *TagRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, options *TagRulesClientBeginDeleteOptions) (*http.Response, error) {
var err error
const operationName = "TagRulesClient.BeginDelete"
@ -201,7 +201,7 @@ func (client *TagRulesClient) deleteCreateRequest(ctx context.Context, resourceG
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -210,8 +210,8 @@ func (client *TagRulesClient) deleteCreateRequest(ctx context.Context, resourceG
// Get - Get a tag rule set for a given monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - ruleSetName - Tag Rule Set resource name
// - options - TagRulesClientGetOptions contains the optional parameters for the TagRulesClient.Get method.
@ -261,7 +261,7 @@ func (client *TagRulesClient) getCreateRequest(ctx context.Context, resourceGrou
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil
@ -278,8 +278,8 @@ func (client *TagRulesClient) getHandleResponse(resp *http.Response) (TagRulesCl
// NewListPager - List the tag rules for a given monitor resource.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - TagRulesClientListOptions contains the optional parameters for the TagRulesClient.NewListPager method.
func (client *TagRulesClient) NewListPager(resourceGroupName string, monitorName string, options *TagRulesClientListOptions) *runtime.Pager[TagRulesClientListResponse] {
@ -325,7 +325,7 @@ func (client *TagRulesClient) listCreateRequest(ctx context.Context, resourceGro
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_List.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_List.json
func ExampleTagRulesClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -77,7 +77,7 @@ func ExampleTagRulesClient_NewListPager() {
}
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_CreateOrUpdate.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_CreateOrUpdate.json
func ExampleTagRulesClient_CreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -121,7 +121,7 @@ func ExampleTagRulesClient_CreateOrUpdate() {
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_Get.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_Get.json
func ExampleTagRulesClient_Get() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
@ -165,7 +165,7 @@ func ExampleTagRulesClient_Get() {
// }
}
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TagRules_Delete.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TagRules_Delete.json
func ExampleTagRulesClient_BeginDelete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -28,12 +28,16 @@ import (
)
// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases.
var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`)
var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`)
const (
utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"`
utcDateTime = "2006-01-02T15:04:05.999999999"
dateTimeJSON = `"` + time.RFC3339Nano + `"`
utcDateTime = "2006-01-02T15:04:05.999999999"
utcDateTimeJSON = `"` + utcDateTime + `"`
utcDateTimeNoT = "2006-01-02 15:04:05.999999999"
utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"`
dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00`
dateTimeJSON = `"` + time.RFC3339Nano + `"`
dateTimeJSONNoT = `"` + dateTimeNoT + `"`
)
type dateTimeRFC3339 time.Time
@ -49,17 +53,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) {
}
func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error {
layout := utcDateTimeJSON
if tzOffsetRegex.Match(data) {
tzOffset := tzOffsetRegex.Match(data)
hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t")
var layout string
if tzOffset && hasT {
layout = dateTimeJSON
} else if tzOffset {
layout = dateTimeJSONNoT
} else if hasT {
layout = utcDateTimeJSON
} else {
layout = utcDateTimeJSONNoT
}
return t.Parse(layout, string(data))
}
func (t *dateTimeRFC3339) UnmarshalText(data []byte) error {
layout := utcDateTime
if tzOffsetRegex.Match(data) {
tzOffset := tzOffsetRegex.Match(data)
hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t")
var layout string
if tzOffset && hasT {
layout = time.RFC3339Nano
} else if tzOffset {
layout = dateTimeNoT
} else if hasT {
layout = utcDateTime
} else {
layout = utcDateTimeNoT
}
return t.Parse(layout, string(data))
}
@ -70,6 +90,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error {
return err
}
func (t dateTimeRFC3339) String() string {
return time.Time(t).Format(time.RFC3339Nano)
}
func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) {
if t == nil {
return
@ -83,7 +107,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) {
}
func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error {
if data == nil || strings.EqualFold(string(data), "null") {
if data == nil || string(data) == "null" {
return nil
}
var aux dateTimeRFC3339

Просмотреть файл

@ -37,7 +37,7 @@ type TrafficFiltersClient struct {
}
// NewTrafficFiltersClient creates a new instance of TrafficFiltersClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewTrafficFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TrafficFiltersClient, error) {
@ -55,8 +55,8 @@ func NewTrafficFiltersClient(subscriptionID string, credential azcore.TokenCrede
// Delete - Delete traffic filter from the account.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - TrafficFiltersClientDeleteOptions contains the optional parameters for the TrafficFiltersClient.Delete method.
func (client *TrafficFiltersClient) Delete(ctx context.Context, resourceGroupName string, monitorName string, options *TrafficFiltersClientDeleteOptions) (TrafficFiltersClientDeleteResponse, error) {
@ -100,7 +100,7 @@ func (client *TrafficFiltersClient) deleteCreateRequest(ctx context.Context, res
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
if options != nil && options.RulesetID != nil {
reqQP.Set("rulesetId", *options.RulesetID)
}

Просмотреть файл

@ -26,7 +26,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/TrafficFilters_Delete.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/TrafficFilters_Delete.json
func ExampleTrafficFiltersClient_Delete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type UpgradableVersionsClient struct {
}
// NewUpgradableVersionsClient creates a new instance of UpgradableVersionsClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewUpgradableVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpgradableVersionsClient, error) {
@ -55,8 +55,8 @@ func NewUpgradableVersionsClient(subscriptionID string, credential azcore.TokenC
// Details - List of upgradable versions for a given monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - UpgradableVersionsClientDetailsOptions contains the optional parameters for the UpgradableVersionsClient.Details
// method.
@ -102,7 +102,7 @@ func (client *UpgradableVersionsClient) detailsCreateRequest(ctx context.Context
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/UpgradableVersions_Details.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/UpgradableVersions_Details.json
func ExampleUpgradableVersionsClient_Details() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type VersionsClient struct {
}
// NewVersionsClient creates a new instance of VersionsClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VersionsClient, error) {
@ -54,7 +54,7 @@ func NewVersionsClient(subscriptionID string, credential azcore.TokenCredential,
// NewListPager - Get a list of available versions for a region.
//
// Generated from API version 2023-02-01-preview
// Generated from API version 2024-03-01
// - region - Region where elastic deployment will take place.
// - options - VersionsClientListOptions contains the optional parameters for the VersionsClient.NewListPager method.
func (client *VersionsClient) NewListPager(region string, options *VersionsClientListOptions) *runtime.Pager[VersionsClientListResponse] {
@ -92,7 +92,7 @@ func (client *VersionsClient) listCreateRequest(ctx context.Context, region stri
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
reqQP.Set("region", region)
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/ElasticVersions_List.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/ElasticVersions_List.json
func ExampleVersionsClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type VMCollectionClient struct {
}
// NewVMCollectionClient creates a new instance of VMCollectionClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewVMCollectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VMCollectionClient, error) {
@ -55,8 +55,8 @@ func NewVMCollectionClient(subscriptionID string, credential azcore.TokenCredent
// Update - Update the vm details that will be monitored by the Elastic monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - VMCollectionClientUpdateOptions contains the optional parameters for the VMCollectionClient.Update method.
func (client *VMCollectionClient) Update(ctx context.Context, resourceGroupName string, monitorName string, options *VMCollectionClientUpdateOptions) (VMCollectionClientUpdateResponse, error) {
@ -100,7 +100,7 @@ func (client *VMCollectionClient) updateCreateRequest(ctx context.Context, resou
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
if options != nil && options.Body != nil {

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/VMCollection_Update.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMCollection_Update.json
func ExampleVMCollectionClient_Update() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type VMHostClient struct {
}
// NewVMHostClient creates a new instance of VMHostClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewVMHostClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VMHostClient, error) {
@ -54,8 +54,8 @@ func NewVMHostClient(subscriptionID string, credential azcore.TokenCredential, o
// NewListPager - List the vm resources currently being monitored by the Elastic monitor resource.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - VMHostClientListOptions contains the optional parameters for the VMHostClient.NewListPager method.
func (client *VMHostClient) NewListPager(resourceGroupName string, monitorName string, options *VMHostClientListOptions) *runtime.Pager[VMHostClientListResponse] {
@ -101,7 +101,7 @@ func (client *VMHostClient) listCreateRequest(ctx context.Context, resourceGroup
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/VMHost_List.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMHost_List.json
func ExampleVMHostClient_NewListPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {

Просмотреть файл

@ -37,7 +37,7 @@ type VMIngestionClient struct {
}
// NewVMIngestionClient creates a new instance of VMIngestionClient with the specified values.
// - subscriptionID - The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000)
// - subscriptionID - The ID of the target subscription. The value must be an UUID.
// - credential - used to authorize requests. Usually a credential from azidentity.
// - options - pass nil to accept the default values.
func NewVMIngestionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VMIngestionClient, error) {
@ -55,8 +55,8 @@ func NewVMIngestionClient(subscriptionID string, credential azcore.TokenCredenti
// Details - List the vm ingestion details that will be monitored by the Elastic monitor resource.
// If the operation fails it returns an *azcore.ResponseError type.
//
// Generated from API version 2023-02-01-preview
// - resourceGroupName - The name of the resource group to which the Elastic resource belongs.
// Generated from API version 2024-03-01
// - resourceGroupName - The name of the resource group. The name is case insensitive.
// - monitorName - Monitor resource name
// - options - VMIngestionClientDetailsOptions contains the optional parameters for the VMIngestionClient.Details method.
func (client *VMIngestionClient) Details(ctx context.Context, resourceGroupName string, monitorName string, options *VMIngestionClientDetailsOptions) (VMIngestionClientDetailsResponse, error) {
@ -101,7 +101,7 @@ func (client *VMIngestionClient) detailsCreateRequest(ctx context.Context, resou
return nil, err
}
reqQP := req.Raw().URL.Query()
reqQP.Set("api-version", "2023-02-01-preview")
reqQP.Set("api-version", "2024-03-01")
req.Raw().URL.RawQuery = reqQP.Encode()
req.Raw().Header["Accept"] = []string{"application/json"}
return req, nil

Просмотреть файл

@ -25,7 +25,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/elastic/armelastic"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/dbd896bc9a795bcb3ec7db0a340b517fd3059620/specification/elastic/resource-manager/Microsoft.Elastic/preview/2023-02-01-preview/examples/VMIngestion_Details.json
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/elastic/resource-manager/Microsoft.Elastic/stable/2024-03-01/examples/VMIngestion_Details.json
func ExampleVMIngestionClient_Details() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {