diff --git a/eng/swagger_to_sdk_config.json b/eng/swagger_to_sdk_config.json index e47880efcbad..74ad2c044667 100644 --- a/eng/swagger_to_sdk_config.json +++ b/eng/swagger_to_sdk_config.json @@ -23,6 +23,8 @@ } }, "packageOptions": { - "breakingChangeLabel": "CI-BreakingChange-Go" + "breakingChangeLabel": "CI-BreakingChange-Go", + "breakingChangesLabel": "BreakingChange-Go-Sdk", + "breakingChangeSuppressionLabel": "BreakingChange-Go-Suppression" } } diff --git a/sdk/resourcemanager/agrifood/armagrifood/CHANGELOG.md b/sdk/resourcemanager/agrifood/armagrifood/CHANGELOG.md index b94b8113e4a7..4403fd2e9046 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/CHANGELOG.md +++ b/sdk/resourcemanager/agrifood/armagrifood/CHANGELOG.md @@ -1,5 +1,144 @@ # Release History +## 0.10.0 (2024-04-23) +### Breaking Changes + +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `interface{}` +- Const `PublicNetworkAccessHybrid` from type alias `PublicNetworkAccess` has been removed +- Function `NewClientFactory` has been removed +- Function `*ClientFactory.NewExtensionsClient` has been removed +- Function `*ClientFactory.NewFarmBeatsExtensionsClient` has been removed +- Function `*ClientFactory.NewFarmBeatsModelsClient` has been removed +- Function `*ClientFactory.NewLocationsClient` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewPrivateEndpointConnectionsClient` has been removed +- Function `*ClientFactory.NewPrivateLinkResourcesClient` has been removed +- Function `*ExtensionsClient.Create` has been removed +- Function `*ExtensionsClient.NewListByFarmBeatsPager` has been removed +- Function `*ExtensionsClient.Update` has been removed +- Function `NewFarmBeatsExtensionsClient` has been removed +- Function `*FarmBeatsExtensionsClient.Get` has been removed +- Function `*FarmBeatsExtensionsClient.NewListPager` has been removed +- Function `NewFarmBeatsModelsClient` has been removed +- Function `*FarmBeatsModelsClient.CreateOrUpdate` has been removed +- Function `*FarmBeatsModelsClient.Delete` has been removed +- Function `*FarmBeatsModelsClient.Get` has been removed +- Function `*FarmBeatsModelsClient.GetOperationResult` has been removed +- Function `*FarmBeatsModelsClient.NewListByResourceGroupPager` has been removed +- Function `*FarmBeatsModelsClient.NewListBySubscriptionPager` has been removed +- Function `*FarmBeatsModelsClient.BeginUpdate` has been removed +- Function `NewLocationsClient` has been removed +- Function `*LocationsClient.CheckNameAvailability` has been removed +- Function `*PrivateEndpointConnectionsClient.NewListByResourcePager` has been removed +- Function `*PrivateLinkResourcesClient.NewListByResourcePager` has been removed +- Function `dateTimeRFC3339.MarshalText` has been removed +- Function `*dateTimeRFC3339.Parse` has been removed +- Function `*dateTimeRFC3339.UnmarshalText` has been removed +- Struct `ClientFactory` has been removed +- Struct `ExtensionsClientListByFarmBeatsResponse` has been removed +- Struct `FarmBeats` has been removed +- Struct `FarmBeatsExtension` has been removed +- Struct `FarmBeatsExtensionListResponse` has been removed +- Struct `FarmBeatsExtensionProperties` has been removed +- Struct `FarmBeatsExtensionsClientListResponse` has been removed +- Struct `FarmBeatsListResponse` has been removed +- Struct `FarmBeatsModelsClientListByResourceGroupResponse` has been removed +- Struct `FarmBeatsModelsClientListBySubscriptionResponse` has been removed +- Struct `FarmBeatsModelsClientUpdateResponse` has been removed +- Struct `FarmBeatsProperties` has been removed +- Struct `FarmBeatsUpdateProperties` has been removed +- Struct `FarmBeatsUpdateRequestModel` has been removed + +### Features Added + +- New value `ProvisioningStateRunning` added to type alias `ProvisioningState` +- New value `PublicNetworkAccessDisabled` added to type alias `PublicNetworkAccess` +- New type alias `AuthCredentialsKind` with values `AuthCredentialsKindAPIKeyAuthCredentials`, `AuthCredentialsKindOAuthClientCredentials` +- New function `*APIKeyAuthCredentials.GetAuthCredentials() *AuthCredentials` +- New function `*AuthCredentials.GetAuthCredentials() *AuthCredentials` +- New function `NewCheckNameAvailabilityClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CheckNameAvailabilityClient, error)` +- New function `*CheckNameAvailabilityClient.CheckNameAvailability(context.Context, CheckNameAvailabilityRequest, *CheckNameAvailabilityClientCheckNameAvailabilityOptions) (CheckNameAvailabilityClientCheckNameAvailabilityResponse, error)` +- New function `NewDataConnectorsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DataConnectorsClient, error)` +- New function `*DataConnectorsClient.CreateOrUpdate(context.Context, string, string, string, DataConnector, *DataConnectorsClientCreateOrUpdateOptions) (DataConnectorsClientCreateOrUpdateResponse, error)` +- New function `*DataConnectorsClient.Delete(context.Context, string, string, string, *DataConnectorsClientDeleteOptions) (DataConnectorsClientDeleteResponse, error)` +- New function `*DataConnectorsClient.Get(context.Context, string, string, string, *DataConnectorsClientGetOptions) (DataConnectorsClientGetResponse, error)` +- New function `*DataConnectorsClient.NewListPager(string, string, *DataConnectorsClientListOptions) *runtime.Pager[DataConnectorsClientListResponse]` +- New function `NewDataManagerForAgricultureExtensionsClient(azcore.TokenCredential, *arm.ClientOptions) (*DataManagerForAgricultureExtensionsClient, error)` +- New function `*DataManagerForAgricultureExtensionsClient.Get(context.Context, string, *DataManagerForAgricultureExtensionsClientGetOptions) (DataManagerForAgricultureExtensionsClientGetResponse, error)` +- New function `*DataManagerForAgricultureExtensionsClient.NewListPager(*DataManagerForAgricultureExtensionsClientListOptions) *runtime.Pager[DataManagerForAgricultureExtensionsClientListResponse]` +- New function `NewDataManagerForAgricultureResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DataManagerForAgricultureResourcesClient, error)` +- New function `*DataManagerForAgricultureResourcesClient.CreateOrUpdate(context.Context, string, string, DataManagerForAgriculture, *DataManagerForAgricultureResourcesClientCreateOrUpdateOptions) (DataManagerForAgricultureResourcesClientCreateOrUpdateResponse, error)` +- New function `*DataManagerForAgricultureResourcesClient.Delete(context.Context, string, string, *DataManagerForAgricultureResourcesClientDeleteOptions) (DataManagerForAgricultureResourcesClientDeleteResponse, error)` +- New function `*DataManagerForAgricultureResourcesClient.Get(context.Context, string, string, *DataManagerForAgricultureResourcesClientGetOptions) (DataManagerForAgricultureResourcesClientGetResponse, error)` +- New function `*DataManagerForAgricultureResourcesClient.NewListByResourceGroupPager(string, *DataManagerForAgricultureResourcesClientListByResourceGroupOptions) *runtime.Pager[DataManagerForAgricultureResourcesClientListByResourceGroupResponse]` +- New function `*DataManagerForAgricultureResourcesClient.NewListBySubscriptionPager(*DataManagerForAgricultureResourcesClientListBySubscriptionOptions) *runtime.Pager[DataManagerForAgricultureResourcesClientListBySubscriptionResponse]` +- New function `*DataManagerForAgricultureResourcesClient.BeginUpdate(context.Context, string, string, DataManagerForAgricultureUpdateRequestModel, *DataManagerForAgricultureResourcesClientBeginUpdateOptions) (*runtime.Poller[DataManagerForAgricultureResourcesClientUpdateResponse], error)` +- New function `*ExtensionsClient.CreateOrUpdate(context.Context, string, string, string, *ExtensionsClientCreateOrUpdateOptions) (ExtensionsClientCreateOrUpdateResponse, error)` +- New function `*ExtensionsClient.NewListByDataManagerForAgriculturePager(string, string, *ExtensionsClientListByDataManagerForAgricultureOptions) *runtime.Pager[ExtensionsClientListByDataManagerForAgricultureResponse]` +- New function `*OAuthClientCredentials.GetAuthCredentials() *AuthCredentials` +- New function `NewOperationResultsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OperationResultsClient, error)` +- New function `*OperationResultsClient.Get(context.Context, string, string, *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error)` +- New function `*PrivateEndpointConnectionsClient.ListByResource(context.Context, string, string, *PrivateEndpointConnectionsClientListByResourceOptions) (PrivateEndpointConnectionsClientListByResourceResponse, error)` +- New function `*PrivateLinkResourcesClient.ListByResource(context.Context, string, string, *PrivateLinkResourcesClientListByResourceOptions) (PrivateLinkResourcesClientListByResourceResponse, error)` +- New function `NewSolutionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SolutionsClient, error)` +- New function `*SolutionsClient.CreateOrUpdate(context.Context, string, string, string, *SolutionsClientCreateOrUpdateOptions) (SolutionsClientCreateOrUpdateResponse, error)` +- New function `*SolutionsClient.Delete(context.Context, string, string, string, *SolutionsClientDeleteOptions) (SolutionsClientDeleteResponse, error)` +- New function `*SolutionsClient.Get(context.Context, string, string, string, *SolutionsClientGetOptions) (SolutionsClientGetResponse, error)` +- New function `*SolutionsClient.NewListPager(string, string, *SolutionsClientListOptions) *runtime.Pager[SolutionsClientListResponse]` +- New function `NewSolutionsDiscoverabilityClient(azcore.TokenCredential, *arm.ClientOptions) (*SolutionsDiscoverabilityClient, error)` +- New function `*SolutionsDiscoverabilityClient.Get(context.Context, string, *SolutionsDiscoverabilityClientGetOptions) (SolutionsDiscoverabilityClientGetResponse, error)` +- New function `*SolutionsDiscoverabilityClient.NewListPager(*SolutionsDiscoverabilityClientListOptions) *runtime.Pager[SolutionsDiscoverabilityClientListResponse]` +- New function `timeRFC3339.MarshalText() ([]byte, error)` +- New function `*timeRFC3339.Parse(string) error` +- New function `*timeRFC3339.UnmarshalText([]byte) error` +- New struct `APIKeyAuthCredentials` +- New struct `APIProperties` +- New struct `ArmAsyncOperationError` +- New struct `CheckNameAvailabilityClient` +- New struct `DataConnector` +- New struct `DataConnectorListResponse` +- New struct `DataConnectorProperties` +- New struct `DataConnectorsClient` +- New struct `DataConnectorsClientListResponse` +- New struct `DataManagerForAgriculture` +- New struct `DataManagerForAgricultureExtension` +- New struct `DataManagerForAgricultureExtensionListResponse` +- New struct `DataManagerForAgricultureExtensionProperties` +- New struct `DataManagerForAgricultureExtensionsClient` +- New struct `DataManagerForAgricultureExtensionsClientListResponse` +- New struct `DataManagerForAgricultureListResponse` +- New struct `DataManagerForAgricultureProperties` +- New struct `DataManagerForAgricultureResourcesClient` +- New struct `DataManagerForAgricultureResourcesClientListByResourceGroupResponse` +- New struct `DataManagerForAgricultureResourcesClientListBySubscriptionResponse` +- New struct `DataManagerForAgricultureResourcesClientUpdateResponse` +- New struct `DataManagerForAgricultureSolution` +- New struct `DataManagerForAgricultureSolutionListResponse` +- New struct `DataManagerForAgricultureSolutionProperties` +- New struct `DataManagerForAgricultureUpdateProperties` +- New struct `DataManagerForAgricultureUpdateRequestModel` +- New struct `ExtensionInstallationRequest` +- New struct `ExtensionsClientListByDataManagerForAgricultureResponse` +- New struct `KeyVaultProperties` +- New struct `MarketplaceOfferDetails` +- New struct `OAuthClientCredentials` +- New struct `OperationResultsClient` +- New struct `Solution` +- New struct `SolutionListResponse` +- New struct `SolutionProperties` +- New struct `SolutionsClient` +- New struct `SolutionsClientListResponse` +- New struct `SolutionsDiscoverabilityClient` +- New struct `SolutionsDiscoverabilityClientListResponse` +- New field `Error` in struct `ArmAsyncOperation` +- New field `APIDefaultInputParameters` in struct `DetailedInformation` +- New field `APIDocsLink` in struct `DetailedInformation` +- New field `APIType` in struct `DetailedInformation` +- New field `SkipToken` in struct `ExtensionListResponse` +- New field `AdditionalAPIProperties` in struct `ExtensionProperties` +- New field `GroupIDs` in struct `PrivateEndpointConnectionProperties` + + ## 0.7.0 (2022-08-23) ### Breaking Changes diff --git a/sdk/resourcemanager/agrifood/armagrifood/autorest.md b/sdk/resourcemanager/agrifood/armagrifood/autorest.md index 80610dcc5fdb..4f009714f94e 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/autorest.md +++ b/sdk/resourcemanager/agrifood/armagrifood/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/a7af6049f4b4743ef3b649f3852bcc7bd9a43ee0/specification/agrifood/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/a7af6049f4b4743ef3b649f3852bcc7bd9a43ee0/specification/agrifood/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/agrifood/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/agrifood/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.7.0 +module-version: 0.10.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/agrifood/armagrifood/locations_client.go b/sdk/resourcemanager/agrifood/armagrifood/checknameavailability_client.go similarity index 54% rename from sdk/resourcemanager/agrifood/armagrifood/locations_client.go rename to sdk/resourcemanager/agrifood/armagrifood/checknameavailability_client.go index 9822e0ea1291..42c4dd1f44dc 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/locations_client.go +++ b/sdk/resourcemanager/agrifood/armagrifood/checknameavailability_client.go @@ -11,7 +11,6 @@ package armagrifood import ( "context" - "errors" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" @@ -23,19 +22,19 @@ import ( "strings" ) -// LocationsClient contains the methods for the Locations group. -// Don't use this type directly, use NewLocationsClient() instead. -type LocationsClient struct { +// CheckNameAvailabilityClient contains the methods for the CheckNameAvailability group. +// Don't use this type directly, use NewCheckNameAvailabilityClient() instead. +type CheckNameAvailabilityClient struct { host string subscriptionID string pl runtime.Pipeline } -// NewLocationsClient creates a new instance of LocationsClient with the specified values. -// subscriptionID - The ID of the target subscription. +// NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient 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 NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { +func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityClient, error) { if options == nil { options = &arm.ClientOptions{} } @@ -47,7 +46,7 @@ func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential if err != nil { return nil, err } - client := &LocationsClient{ + client := &CheckNameAvailabilityClient{ subscriptionID: subscriptionID, host: ep, pl: pl, @@ -57,48 +56,45 @@ func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential // CheckNameAvailability - Checks the name availability of the resource with requested resource name. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// body - NameAvailabilityRequest object. -// options - LocationsClientCheckNameAvailabilityOptions contains the optional parameters for the LocationsClient.CheckNameAvailability +// Generated from API version 2023-06-01-preview +// nameAvailabilityRequest - NameAvailabilityRequest object. +// options - CheckNameAvailabilityClientCheckNameAvailabilityOptions contains the optional parameters for the CheckNameAvailabilityClient.CheckNameAvailability // method. -func (client *LocationsClient) CheckNameAvailability(ctx context.Context, body CheckNameAvailabilityRequest, options *LocationsClientCheckNameAvailabilityOptions) (LocationsClientCheckNameAvailabilityResponse, error) { - req, err := client.checkNameAvailabilityCreateRequest(ctx, body, options) +func (client *CheckNameAvailabilityClient) CheckNameAvailability(ctx context.Context, nameAvailabilityRequest CheckNameAvailabilityRequest, options *CheckNameAvailabilityClientCheckNameAvailabilityOptions) (CheckNameAvailabilityClientCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, nameAvailabilityRequest, options) if err != nil { - return LocationsClientCheckNameAvailabilityResponse{}, err + return CheckNameAvailabilityClientCheckNameAvailabilityResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return LocationsClientCheckNameAvailabilityResponse{}, err + return CheckNameAvailabilityClientCheckNameAvailabilityResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return LocationsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + return CheckNameAvailabilityClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) } return client.checkNameAvailabilityHandleResponse(resp) } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Context, body CheckNameAvailabilityRequest, options *LocationsClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *CheckNameAvailabilityClient) checkNameAvailabilityCreateRequest(ctx context.Context, nameAvailabilityRequest CheckNameAvailabilityRequest, options *CheckNameAvailabilityClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/checkNameAvailability" - 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.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + return req, runtime.MarshalAsJSON(req, nameAvailabilityRequest) } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. -func (client *LocationsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (LocationsClientCheckNameAvailabilityResponse, error) { - result := LocationsClientCheckNameAvailabilityResponse{} +func (client *CheckNameAvailabilityClient) checkNameAvailabilityHandleResponse(resp *http.Response) (CheckNameAvailabilityClientCheckNameAvailabilityResponse, error) { + result := CheckNameAvailabilityClientCheckNameAvailabilityResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { - return LocationsClientCheckNameAvailabilityResponse{}, err + return CheckNameAvailabilityClientCheckNameAvailabilityResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/agrifood/armagrifood/constants.go b/sdk/resourcemanager/agrifood/armagrifood/constants.go index 17caa0658e53..fbce6ad8c931 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/constants.go +++ b/sdk/resourcemanager/agrifood/armagrifood/constants.go @@ -11,7 +11,7 @@ package armagrifood const ( moduleName = "armagrifood" - moduleVersion = "v0.7.0" + moduleVersion = "v0.10.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -28,6 +28,22 @@ func PossibleActionTypeValues() []ActionType { } } +// AuthCredentialsKind - Enum for different types of AuthCredentials supported. +type AuthCredentialsKind string + +const ( + AuthCredentialsKindAPIKeyAuthCredentials AuthCredentialsKind = "ApiKeyAuthCredentials" + AuthCredentialsKindOAuthClientCredentials AuthCredentialsKind = "OAuthClientCredentials" +) + +// PossibleAuthCredentialsKindValues returns the possible values for the AuthCredentialsKind const type. +func PossibleAuthCredentialsKindValues() []AuthCredentialsKind { + return []AuthCredentialsKind{ + AuthCredentialsKindAPIKeyAuthCredentials, + AuthCredentialsKindOAuthClientCredentials, + } +} + // CheckNameAvailabilityReason - The reason why the given name is not available. type CheckNameAvailabilityReason string @@ -121,13 +137,14 @@ func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointSer } } -// ProvisioningState - Sensor integration instance provisioning state. +// ProvisioningState - Data Manager For Agriculture instance provisioning state. type ProvisioningState string const ( ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateRunning ProvisioningState = "Running" ProvisioningStateSucceeded ProvisioningState = "Succeeded" ProvisioningStateUpdating ProvisioningState = "Updating" ) @@ -138,23 +155,24 @@ func PossibleProvisioningStateValues() []ProvisioningState { ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, + ProvisioningStateRunning, ProvisioningStateSucceeded, ProvisioningStateUpdating, } } -// PublicNetworkAccess - Property to allow or block public traffic for an Azure FarmBeats resource. +// PublicNetworkAccess - Property to allow or block public traffic for an Azure Data Manager For Agriculture resource. type PublicNetworkAccess string const ( - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" - PublicNetworkAccessHybrid PublicNetworkAccess = "Hybrid" + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" ) // PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, PublicNetworkAccessEnabled, - PublicNetworkAccessHybrid, } } diff --git a/sdk/resourcemanager/agrifood/armagrifood/dataconnectors_client.go b/sdk/resourcemanager/agrifood/armagrifood/dataconnectors_client.go new file mode 100644 index 000000000000..97e5bf76da94 --- /dev/null +++ b/sdk/resourcemanager/agrifood/armagrifood/dataconnectors_client.go @@ -0,0 +1,295 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armagrifood + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// DataConnectorsClient contains the methods for the DataConnectors group. +// Don't use this type directly, use NewDataConnectorsClient() instead. +type DataConnectorsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDataConnectorsClient creates a new instance of DataConnectorsClient 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 NewDataConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataConnectorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DataConnectorsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create or update Data Connector For MADMA resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// dataConnectorName - Connector name. +// body - Body must be valid DataConnector request. +// options - DataConnectorsClientCreateOrUpdateOptions contains the optional parameters for the DataConnectorsClient.CreateOrUpdate +// method. +func (client *DataConnectorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, dataConnectorName string, body DataConnector, options *DataConnectorsClientCreateOrUpdateOptions) (DataConnectorsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, dataConnectorName, body, options) + if err != nil { + return DataConnectorsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataConnectorsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return DataConnectorsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DataConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, dataConnectorName string, body DataConnector, options *DataConnectorsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/dataConnectors/{dataConnectorName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + if dataConnectorName == "" { + return nil, errors.New("parameter dataConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataConnectorName}", url.PathEscape(dataConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, body) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *DataConnectorsClient) createOrUpdateHandleResponse(resp *http.Response) (DataConnectorsClientCreateOrUpdateResponse, error) { + result := DataConnectorsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataConnector); err != nil { + return DataConnectorsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Data Connectors with given dataConnector name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// dataConnectorName - Connector name. +// options - DataConnectorsClientDeleteOptions contains the optional parameters for the DataConnectorsClient.Delete method. +func (client *DataConnectorsClient) Delete(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, dataConnectorName string, options *DataConnectorsClientDeleteOptions) (DataConnectorsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, dataConnectorName, options) + if err != nil { + return DataConnectorsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataConnectorsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return DataConnectorsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return DataConnectorsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DataConnectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, dataConnectorName string, options *DataConnectorsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/dataConnectors/{dataConnectorName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + if dataConnectorName == "" { + return nil, errors.New("parameter dataConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataConnectorName}", url.PathEscape(dataConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get specific Data Connector resource by DataConnectorName. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// dataConnectorName - Connector name. +// options - DataConnectorsClientGetOptions contains the optional parameters for the DataConnectorsClient.Get method. +func (client *DataConnectorsClient) Get(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, dataConnectorName string, options *DataConnectorsClientGetOptions) (DataConnectorsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, dataConnectorName, options) + if err != nil { + return DataConnectorsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataConnectorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DataConnectorsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DataConnectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, dataConnectorName string, options *DataConnectorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/dataConnectors/{dataConnectorName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + if dataConnectorName == "" { + return nil, errors.New("parameter dataConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataConnectorName}", url.PathEscape(dataConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DataConnectorsClient) getHandleResponse(resp *http.Response) (DataConnectorsClientGetResponse, error) { + result := DataConnectorsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataConnector); err != nil { + return DataConnectorsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the Data Connector Credentials for MADMA instance. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// options - DataConnectorsClientListOptions contains the optional parameters for the DataConnectorsClient.List method. +func (client *DataConnectorsClient) NewListPager(resourceGroupName string, dataManagerForAgricultureResourceName string, options *DataConnectorsClientListOptions) *runtime.Pager[DataConnectorsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DataConnectorsClientListResponse]{ + More: func(page DataConnectorsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DataConnectorsClientListResponse) (DataConnectorsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DataConnectorsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataConnectorsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DataConnectorsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *DataConnectorsClient) listCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *DataConnectorsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/dataConnectors" + 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 dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + if options != nil && options.MaxPageSize != nil { + reqQP.Set("$maxPageSize", strconv.FormatInt(int64(*options.MaxPageSize), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DataConnectorsClient) listHandleResponse(resp *http.Response) (DataConnectorsClientListResponse, error) { + result := DataConnectorsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataConnectorListResponse); err != nil { + return DataConnectorsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/agrifood/armagrifood/datamanagerforagricultureextensions_client.go b/sdk/resourcemanager/agrifood/armagrifood/datamanagerforagricultureextensions_client.go new file mode 100644 index 000000000000..00ebd5c57955 --- /dev/null +++ b/sdk/resourcemanager/agrifood/armagrifood/datamanagerforagricultureextensions_client.go @@ -0,0 +1,180 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armagrifood + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// DataManagerForAgricultureExtensionsClient contains the methods for the DataManagerForAgricultureExtensions group. +// Don't use this type directly, use NewDataManagerForAgricultureExtensionsClient() instead. +type DataManagerForAgricultureExtensionsClient struct { + host string + pl runtime.Pipeline +} + +// NewDataManagerForAgricultureExtensionsClient creates a new instance of DataManagerForAgricultureExtensionsClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewDataManagerForAgricultureExtensionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DataManagerForAgricultureExtensionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DataManagerForAgricultureExtensionsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get Data Manager For Agriculture extension. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// dataManagerForAgricultureExtensionID - dataManagerForAgricultureExtensionId to be queried. +// options - DataManagerForAgricultureExtensionsClientGetOptions contains the optional parameters for the DataManagerForAgricultureExtensionsClient.Get +// method. +func (client *DataManagerForAgricultureExtensionsClient) Get(ctx context.Context, dataManagerForAgricultureExtensionID string, options *DataManagerForAgricultureExtensionsClientGetOptions) (DataManagerForAgricultureExtensionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, dataManagerForAgricultureExtensionID, options) + if err != nil { + return DataManagerForAgricultureExtensionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataManagerForAgricultureExtensionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DataManagerForAgricultureExtensionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DataManagerForAgricultureExtensionsClient) getCreateRequest(ctx context.Context, dataManagerForAgricultureExtensionID string, options *DataManagerForAgricultureExtensionsClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.AgFoodPlatform/farmBeatsExtensionDefinitions/{dataManagerForAgricultureExtensionId}" + if dataManagerForAgricultureExtensionID == "" { + return nil, errors.New("parameter dataManagerForAgricultureExtensionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureExtensionId}", url.PathEscape(dataManagerForAgricultureExtensionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DataManagerForAgricultureExtensionsClient) getHandleResponse(resp *http.Response) (DataManagerForAgricultureExtensionsClientGetResponse, error) { + result := DataManagerForAgricultureExtensionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataManagerForAgricultureExtension); err != nil { + return DataManagerForAgricultureExtensionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get list of Data Manager For Agriculture extension. +// Generated from API version 2023-06-01-preview +// options - DataManagerForAgricultureExtensionsClientListOptions contains the optional parameters for the DataManagerForAgricultureExtensionsClient.List +// method. +func (client *DataManagerForAgricultureExtensionsClient) NewListPager(options *DataManagerForAgricultureExtensionsClientListOptions) *runtime.Pager[DataManagerForAgricultureExtensionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DataManagerForAgricultureExtensionsClientListResponse]{ + More: func(page DataManagerForAgricultureExtensionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DataManagerForAgricultureExtensionsClientListResponse) (DataManagerForAgricultureExtensionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DataManagerForAgricultureExtensionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataManagerForAgricultureExtensionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DataManagerForAgricultureExtensionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *DataManagerForAgricultureExtensionsClient) listCreateRequest(ctx context.Context, options *DataManagerForAgricultureExtensionsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.AgFoodPlatform/farmBeatsExtensionDefinitions" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.FarmBeatsExtensionIDs != nil { + for _, qv := range options.FarmBeatsExtensionIDs { + reqQP.Add("farmBeatsExtensionIds", qv) + } + } + if options != nil && options.FarmBeatsExtensionNames != nil { + for _, qv := range options.FarmBeatsExtensionNames { + reqQP.Add("farmBeatsExtensionNames", qv) + } + } + if options != nil && options.ExtensionCategories != nil { + for _, qv := range options.ExtensionCategories { + reqQP.Add("extensionCategories", qv) + } + } + if options != nil && options.PublisherIDs != nil { + for _, qv := range options.PublisherIDs { + reqQP.Add("publisherIds", qv) + } + } + if options != nil && options.MaxPageSize != nil { + reqQP.Set("$maxPageSize", strconv.FormatInt(int64(*options.MaxPageSize), 10)) + } + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *DataManagerForAgricultureExtensionsClient) listHandleResponse(resp *http.Response) (DataManagerForAgricultureExtensionsClientListResponse, error) { + result := DataManagerForAgricultureExtensionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataManagerForAgricultureExtensionListResponse); err != nil { + return DataManagerForAgricultureExtensionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/agrifood/armagrifood/datamanagerforagricultureresources_client.go b/sdk/resourcemanager/agrifood/armagrifood/datamanagerforagricultureresources_client.go new file mode 100644 index 000000000000..05f94b64c002 --- /dev/null +++ b/sdk/resourcemanager/agrifood/armagrifood/datamanagerforagricultureresources_client.go @@ -0,0 +1,403 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armagrifood + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// DataManagerForAgricultureResourcesClient contains the methods for the DataManagerForAgricultureResources group. +// Don't use this type directly, use NewDataManagerForAgricultureResourcesClient() instead. +type DataManagerForAgricultureResourcesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewDataManagerForAgricultureResourcesClient creates a new instance of DataManagerForAgricultureResourcesClient 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 NewDataManagerForAgricultureResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataManagerForAgricultureResourcesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &DataManagerForAgricultureResourcesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Create or update Data Manager For Agriculture resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// request - Data Manager For Agriculture resource create or update request object. +// options - DataManagerForAgricultureResourcesClientCreateOrUpdateOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.CreateOrUpdate +// method. +func (client *DataManagerForAgricultureResourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, request DataManagerForAgriculture, options *DataManagerForAgricultureResourcesClientCreateOrUpdateOptions) (DataManagerForAgricultureResourcesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, request, options) + if err != nil { + return DataManagerForAgricultureResourcesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataManagerForAgricultureResourcesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return DataManagerForAgricultureResourcesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *DataManagerForAgricultureResourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, request DataManagerForAgriculture, options *DataManagerForAgricultureResourcesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}" + 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 dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, request) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *DataManagerForAgricultureResourcesClient) createOrUpdateHandleResponse(resp *http.Response) (DataManagerForAgricultureResourcesClientCreateOrUpdateResponse, error) { + result := DataManagerForAgricultureResourcesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataManagerForAgriculture); err != nil { + return DataManagerForAgricultureResourcesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Data Manager For Agriculture resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// options - DataManagerForAgricultureResourcesClientDeleteOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.Delete +// method. +func (client *DataManagerForAgricultureResourcesClient) Delete(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *DataManagerForAgricultureResourcesClientDeleteOptions) (DataManagerForAgricultureResourcesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, options) + if err != nil { + return DataManagerForAgricultureResourcesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataManagerForAgricultureResourcesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return DataManagerForAgricultureResourcesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return DataManagerForAgricultureResourcesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *DataManagerForAgricultureResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *DataManagerForAgricultureResourcesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}" + 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 dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get DataManagerForAgriculture resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// options - DataManagerForAgricultureResourcesClientGetOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.Get +// method. +func (client *DataManagerForAgricultureResourcesClient) Get(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *DataManagerForAgricultureResourcesClientGetOptions) (DataManagerForAgricultureResourcesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, options) + if err != nil { + return DataManagerForAgricultureResourcesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataManagerForAgricultureResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DataManagerForAgricultureResourcesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *DataManagerForAgricultureResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *DataManagerForAgricultureResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}" + 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 dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *DataManagerForAgricultureResourcesClient) getHandleResponse(resp *http.Response) (DataManagerForAgricultureResourcesClientGetResponse, error) { + result := DataManagerForAgricultureResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataManagerForAgriculture); err != nil { + return DataManagerForAgricultureResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Lists the DataManagerForAgriculture instances for a resource group. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// options - DataManagerForAgricultureResourcesClientListByResourceGroupOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.ListByResourceGroup +// method. +func (client *DataManagerForAgricultureResourcesClient) NewListByResourceGroupPager(resourceGroupName string, options *DataManagerForAgricultureResourcesClientListByResourceGroupOptions) *runtime.Pager[DataManagerForAgricultureResourcesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[DataManagerForAgricultureResourcesClientListByResourceGroupResponse]{ + More: func(page DataManagerForAgricultureResourcesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DataManagerForAgricultureResourcesClientListByResourceGroupResponse) (DataManagerForAgricultureResourcesClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DataManagerForAgricultureResourcesClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataManagerForAgricultureResourcesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DataManagerForAgricultureResourcesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *DataManagerForAgricultureResourcesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DataManagerForAgricultureResourcesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.MaxPageSize != nil { + reqQP.Set("$maxPageSize", strconv.FormatInt(int64(*options.MaxPageSize), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *DataManagerForAgricultureResourcesClient) listByResourceGroupHandleResponse(resp *http.Response) (DataManagerForAgricultureResourcesClientListByResourceGroupResponse, error) { + result := DataManagerForAgricultureResourcesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataManagerForAgricultureListResponse); err != nil { + return DataManagerForAgricultureResourcesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists the DataManagerForAgriculture instances for a subscription. +// Generated from API version 2023-06-01-preview +// options - DataManagerForAgricultureResourcesClientListBySubscriptionOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.ListBySubscription +// method. +func (client *DataManagerForAgricultureResourcesClient) NewListBySubscriptionPager(options *DataManagerForAgricultureResourcesClientListBySubscriptionOptions) *runtime.Pager[DataManagerForAgricultureResourcesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[DataManagerForAgricultureResourcesClientListBySubscriptionResponse]{ + More: func(page DataManagerForAgricultureResourcesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DataManagerForAgricultureResourcesClientListBySubscriptionResponse) (DataManagerForAgricultureResourcesClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return DataManagerForAgricultureResourcesClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return DataManagerForAgricultureResourcesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DataManagerForAgricultureResourcesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *DataManagerForAgricultureResourcesClient) listBySubscriptionCreateRequest(ctx context.Context, options *DataManagerForAgricultureResourcesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/farmBeats" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.MaxPageSize != nil { + reqQP.Set("$maxPageSize", strconv.FormatInt(int64(*options.MaxPageSize), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *DataManagerForAgricultureResourcesClient) listBySubscriptionHandleResponse(resp *http.Response) (DataManagerForAgricultureResourcesClientListBySubscriptionResponse, error) { + result := DataManagerForAgricultureResourcesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataManagerForAgricultureListResponse); err != nil { + return DataManagerForAgricultureResourcesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a Data Manager For Agriculture resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// request - Request object. +// options - DataManagerForAgricultureResourcesClientBeginUpdateOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.BeginUpdate +// method. +func (client *DataManagerForAgricultureResourcesClient) BeginUpdate(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, request DataManagerForAgricultureUpdateRequestModel, options *DataManagerForAgricultureResourcesClientBeginUpdateOptions) (*runtime.Poller[DataManagerForAgricultureResourcesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, dataManagerForAgricultureResourceName, request, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[DataManagerForAgricultureResourcesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[DataManagerForAgricultureResourcesClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Update a Data Manager For Agriculture resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +func (client *DataManagerForAgricultureResourcesClient) update(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, request DataManagerForAgricultureUpdateRequestModel, options *DataManagerForAgricultureResourcesClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, request, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *DataManagerForAgricultureResourcesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, request DataManagerForAgricultureUpdateRequestModel, options *DataManagerForAgricultureResourcesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}" + 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 dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, request) +} diff --git a/sdk/resourcemanager/agrifood/armagrifood/extensions_client.go b/sdk/resourcemanager/agrifood/armagrifood/extensions_client.go index dd5896ace544..b9adc6e8ae3b 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/extensions_client.go +++ b/sdk/resourcemanager/agrifood/armagrifood/extensions_client.go @@ -33,7 +33,7 @@ type ExtensionsClient struct { } // NewExtensionsClient creates a new instance of ExtensionsClient with the specified values. -// subscriptionID - The ID of the target subscription. +// 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 NewExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExtensionsClient, error) { @@ -56,43 +56,42 @@ func NewExtensionsClient(subscriptionID string, credential azcore.TokenCredentia return client, nil } -// Create - Install extension. +// CreateOrUpdate - Install or Update extension. Additional Api Properties are merged patch and if the extension is updated +// to a new version then the obsolete entries will be auto deleted from Additional Api Properties. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2023-06-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. // extensionID - Id of extension resource. -// options - ExtensionsClientCreateOptions contains the optional parameters for the ExtensionsClient.Create method. -func (client *ExtensionsClient) Create(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, extensionID string, options *ExtensionsClientCreateOptions) (ExtensionsClientCreateResponse, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, extensionID, options) +// options - ExtensionsClientCreateOrUpdateOptions contains the optional parameters for the ExtensionsClient.CreateOrUpdate +// method. +func (client *ExtensionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, extensionID string, options *ExtensionsClientCreateOrUpdateOptions) (ExtensionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, extensionID, options) if err != nil { - return ExtensionsClientCreateResponse{}, err + return ExtensionsClientCreateOrUpdateResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return ExtensionsClientCreateResponse{}, err + return ExtensionsClientCreateOrUpdateResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusCreated) { - return ExtensionsClientCreateResponse{}, runtime.NewResponseError(resp) + return ExtensionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) } - return client.createHandleResponse(resp) + return client.createOrUpdateHandleResponse(resp) } -// createCreateRequest creates the Create request. -func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, extensionID string, options *ExtensionsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, extensionID string, options *ExtensionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/extensions/{extensionId}" 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) if extensionID == "" { return nil, errors.New("parameter extensionID cannot be empty") } @@ -102,30 +101,33 @@ func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.RequestBody != nil { + return req, runtime.MarshalAsJSON(req, *options.RequestBody) + } return req, nil } -// createHandleResponse handles the Create response. -func (client *ExtensionsClient) createHandleResponse(resp *http.Response) (ExtensionsClientCreateResponse, error) { - result := ExtensionsClientCreateResponse{} +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ExtensionsClient) createOrUpdateHandleResponse(resp *http.Response) (ExtensionsClientCreateOrUpdateResponse, error) { + result := ExtensionsClientCreateOrUpdateResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.Extension); err != nil { - return ExtensionsClientCreateResponse{}, err + return ExtensionsClientCreateOrUpdateResponse{}, err } return result, nil } // Delete - Uninstall extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2023-06-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. // extensionID - Id of extension resource. // options - ExtensionsClientDeleteOptions contains the optional parameters for the ExtensionsClient.Delete method. -func (client *ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, extensionID string, options *ExtensionsClientDeleteOptions) (ExtensionsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, extensionID, options) +func (client *ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, extensionID string, options *ExtensionsClientDeleteOptions) (ExtensionsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, extensionID, options) if err != nil { return ExtensionsClientDeleteResponse{}, err } @@ -140,20 +142,17 @@ func (client *ExtensionsClient) Delete(ctx context.Context, resourceGroupName st } // deleteCreateRequest creates the Delete request. -func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, extensionID string, options *ExtensionsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, extensionID string, options *ExtensionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/extensions/{extensionId}" 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) if extensionID == "" { return nil, errors.New("parameter extensionID cannot be empty") } @@ -163,7 +162,7 @@ func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -171,13 +170,13 @@ func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourc // Get - Get installed extension details by extension id. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2023-06-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. // extensionID - Id of extension resource. // options - ExtensionsClientGetOptions contains the optional parameters for the ExtensionsClient.Get method. -func (client *ExtensionsClient) Get(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, extensionID string, options *ExtensionsClientGetOptions) (ExtensionsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, extensionID, options) +func (client *ExtensionsClient) Get(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, extensionID string, options *ExtensionsClientGetOptions) (ExtensionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, extensionID, options) if err != nil { return ExtensionsClientGetResponse{}, err } @@ -192,20 +191,17 @@ func (client *ExtensionsClient) Get(ctx context.Context, resourceGroupName strin } // getCreateRequest creates the Get request. -func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, extensionID string, options *ExtensionsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, extensionID string, options *ExtensionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/extensions/{extensionId}" 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) if extensionID == "" { return nil, errors.New("parameter extensionID cannot be empty") } @@ -215,7 +211,7 @@ func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -230,62 +226,58 @@ func (client *ExtensionsClient) getHandleResponse(resp *http.Response) (Extensio return result, nil } -// NewListByFarmBeatsPager - Get installed extensions details. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// NewListByDataManagerForAgriculturePager - Get installed extensions details. +// Generated from API version 2023-06-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. -// options - ExtensionsClientListByFarmBeatsOptions contains the optional parameters for the ExtensionsClient.ListByFarmBeats +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// options - ExtensionsClientListByDataManagerForAgricultureOptions contains the optional parameters for the ExtensionsClient.ListByDataManagerForAgriculture // method. -func (client *ExtensionsClient) NewListByFarmBeatsPager(resourceGroupName string, farmBeatsResourceName string, options *ExtensionsClientListByFarmBeatsOptions) *runtime.Pager[ExtensionsClientListByFarmBeatsResponse] { - return runtime.NewPager(runtime.PagingHandler[ExtensionsClientListByFarmBeatsResponse]{ - More: func(page ExtensionsClientListByFarmBeatsResponse) bool { +func (client *ExtensionsClient) NewListByDataManagerForAgriculturePager(resourceGroupName string, dataManagerForAgricultureResourceName string, options *ExtensionsClientListByDataManagerForAgricultureOptions) *runtime.Pager[ExtensionsClientListByDataManagerForAgricultureResponse] { + return runtime.NewPager(runtime.PagingHandler[ExtensionsClientListByDataManagerForAgricultureResponse]{ + More: func(page ExtensionsClientListByDataManagerForAgricultureResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *ExtensionsClientListByFarmBeatsResponse) (ExtensionsClientListByFarmBeatsResponse, error) { + Fetcher: func(ctx context.Context, page *ExtensionsClientListByDataManagerForAgricultureResponse) (ExtensionsClientListByDataManagerForAgricultureResponse, error) { var req *policy.Request var err error if page == nil { - req, err = client.listByFarmBeatsCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, options) + req, err = client.listByDataManagerForAgricultureCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { - return ExtensionsClientListByFarmBeatsResponse{}, err + return ExtensionsClientListByDataManagerForAgricultureResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return ExtensionsClientListByFarmBeatsResponse{}, err + return ExtensionsClientListByDataManagerForAgricultureResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExtensionsClientListByFarmBeatsResponse{}, runtime.NewResponseError(resp) + return ExtensionsClientListByDataManagerForAgricultureResponse{}, runtime.NewResponseError(resp) } - return client.listByFarmBeatsHandleResponse(resp) + return client.listByDataManagerForAgricultureHandleResponse(resp) }, }) } -// listByFarmBeatsCreateRequest creates the ListByFarmBeats request. -func (client *ExtensionsClient) listByFarmBeatsCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, options *ExtensionsClientListByFarmBeatsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +// listByDataManagerForAgricultureCreateRequest creates the ListByDataManagerForAgriculture request. +func (client *ExtensionsClient) listByDataManagerForAgricultureCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *ExtensionsClientListByDataManagerForAgricultureOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/extensions" 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") if options != nil && options.ExtensionIDs != nil { for _, qv := range options.ExtensionIDs { reqQP.Add("extensionIds", qv) @@ -307,72 +299,11 @@ func (client *ExtensionsClient) listByFarmBeatsCreateRequest(ctx context.Context return req, nil } -// listByFarmBeatsHandleResponse handles the ListByFarmBeats response. -func (client *ExtensionsClient) listByFarmBeatsHandleResponse(resp *http.Response) (ExtensionsClientListByFarmBeatsResponse, error) { - result := ExtensionsClientListByFarmBeatsResponse{} +// listByDataManagerForAgricultureHandleResponse handles the ListByDataManagerForAgriculture response. +func (client *ExtensionsClient) listByDataManagerForAgricultureHandleResponse(resp *http.Response) (ExtensionsClientListByDataManagerForAgricultureResponse, error) { + result := ExtensionsClientListByDataManagerForAgricultureResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionListResponse); err != nil { - return ExtensionsClientListByFarmBeatsResponse{}, err - } - return result, nil -} - -// Update - Upgrade to latest extension. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. -// extensionID - Id of extension resource. -// options - ExtensionsClientUpdateOptions contains the optional parameters for the ExtensionsClient.Update method. -func (client *ExtensionsClient) Update(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, extensionID string, options *ExtensionsClientUpdateOptions) (ExtensionsClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, extensionID, options) - if err != nil { - return ExtensionsClientUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ExtensionsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExtensionsClientUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.updateHandleResponse(resp) -} - -// updateCreateRequest creates the Update request. -func (client *ExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, extensionID string, options *ExtensionsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/extensions/{extensionId}" - 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) - if extensionID == "" { - return nil, errors.New("parameter extensionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{extensionId}", url.PathEscape(extensionID)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *ExtensionsClient) updateHandleResponse(resp *http.Response) (ExtensionsClientUpdateResponse, error) { - result := ExtensionsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Extension); err != nil { - return ExtensionsClientUpdateResponse{}, err + return ExtensionsClientListByDataManagerForAgricultureResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/agrifood/armagrifood/extensions_client_example_test.go b/sdk/resourcemanager/agrifood/armagrifood/extensions_client_example_test.go deleted file mode 100644 index 29b73a70246c..000000000000 --- a/sdk/resourcemanager/agrifood/armagrifood/extensions_client_example_test.go +++ /dev/null @@ -1,117 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armagrifood_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agrifood/armagrifood" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Extensions_Create.json -func ExampleExtensionsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewExtensionsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Create(ctx, "examples-rg", "examples-farmbeatsResourceName", "provider.extension", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Extensions_Get.json -func ExampleExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewExtensionsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "examples-rg", "examples-farmbeatsResourceName", "provider.extension", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Extensions_Update.json -func ExampleExtensionsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewExtensionsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "examples-rg", "examples-farmbeatsResourceName", "provider.extension", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Extensions_Delete.json -func ExampleExtensionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewExtensionsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "examples-rg", "examples-farmbeatsResourceName", "provider.extension", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Extensions_ListByFarmBeats.json -func ExampleExtensionsClient_NewListByFarmBeatsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewExtensionsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByFarmBeatsPager("examples-rg", "examples-farmbeatsResourceName", &armagrifood.ExtensionsClientListByFarmBeatsOptions{ExtensionIDs: []string{}, - ExtensionCategories: []string{}, - MaxPageSize: nil, - SkipToken: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/agrifood/armagrifood/farmbeatsextensions_client.go b/sdk/resourcemanager/agrifood/armagrifood/farmbeatsextensions_client.go deleted file mode 100644 index 2c32ce78b522..000000000000 --- a/sdk/resourcemanager/agrifood/armagrifood/farmbeatsextensions_client.go +++ /dev/null @@ -1,180 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armagrifood - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// FarmBeatsExtensionsClient contains the methods for the FarmBeatsExtensions group. -// Don't use this type directly, use NewFarmBeatsExtensionsClient() instead. -type FarmBeatsExtensionsClient struct { - host string - pl runtime.Pipeline -} - -// NewFarmBeatsExtensionsClient creates a new instance of FarmBeatsExtensionsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewFarmBeatsExtensionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*FarmBeatsExtensionsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &FarmBeatsExtensionsClient{ - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Get farmBeats extension. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// farmBeatsExtensionID - farmBeatsExtensionId to be queried. -// options - FarmBeatsExtensionsClientGetOptions contains the optional parameters for the FarmBeatsExtensionsClient.Get method. -func (client *FarmBeatsExtensionsClient) Get(ctx context.Context, farmBeatsExtensionID string, options *FarmBeatsExtensionsClientGetOptions) (FarmBeatsExtensionsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, farmBeatsExtensionID, options) - if err != nil { - return FarmBeatsExtensionsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return FarmBeatsExtensionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FarmBeatsExtensionsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *FarmBeatsExtensionsClient) getCreateRequest(ctx context.Context, farmBeatsExtensionID string, options *FarmBeatsExtensionsClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.AgFoodPlatform/farmBeatsExtensionDefinitions/{farmBeatsExtensionId}" - if farmBeatsExtensionID == "" { - return nil, errors.New("parameter farmBeatsExtensionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsExtensionId}", url.PathEscape(farmBeatsExtensionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *FarmBeatsExtensionsClient) getHandleResponse(resp *http.Response) (FarmBeatsExtensionsClientGetResponse, error) { - result := FarmBeatsExtensionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeatsExtension); err != nil { - return FarmBeatsExtensionsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Get list of farmBeats extension. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// options - FarmBeatsExtensionsClientListOptions contains the optional parameters for the FarmBeatsExtensionsClient.List -// method. -func (client *FarmBeatsExtensionsClient) NewListPager(options *FarmBeatsExtensionsClientListOptions) *runtime.Pager[FarmBeatsExtensionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[FarmBeatsExtensionsClientListResponse]{ - More: func(page FarmBeatsExtensionsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *FarmBeatsExtensionsClientListResponse) (FarmBeatsExtensionsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return FarmBeatsExtensionsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return FarmBeatsExtensionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FarmBeatsExtensionsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *FarmBeatsExtensionsClient) listCreateRequest(ctx context.Context, options *FarmBeatsExtensionsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.AgFoodPlatform/farmBeatsExtensionDefinitions" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.FarmBeatsExtensionIDs != nil { - for _, qv := range options.FarmBeatsExtensionIDs { - reqQP.Add("farmBeatsExtensionIds", qv) - } - } - if options != nil && options.FarmBeatsExtensionNames != nil { - for _, qv := range options.FarmBeatsExtensionNames { - reqQP.Add("farmBeatsExtensionNames", qv) - } - } - if options != nil && options.ExtensionCategories != nil { - for _, qv := range options.ExtensionCategories { - reqQP.Add("extensionCategories", qv) - } - } - if options != nil && options.PublisherIDs != nil { - for _, qv := range options.PublisherIDs { - reqQP.Add("publisherIds", qv) - } - } - if options != nil && options.MaxPageSize != nil { - reqQP.Set("$maxPageSize", strconv.FormatInt(int64(*options.MaxPageSize), 10)) - } - reqQP.Set("api-version", "2021-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *FarmBeatsExtensionsClient) listHandleResponse(resp *http.Response) (FarmBeatsExtensionsClientListResponse, error) { - result := FarmBeatsExtensionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeatsExtensionListResponse); err != nil { - return FarmBeatsExtensionsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/agrifood/armagrifood/farmbeatsextensions_client_example_test.go b/sdk/resourcemanager/agrifood/armagrifood/farmbeatsextensions_client_example_test.go deleted file mode 100644 index 6ae667233d48..000000000000 --- a/sdk/resourcemanager/agrifood/armagrifood/farmbeatsextensions_client_example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armagrifood_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agrifood/armagrifood" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsExtensions_List.json -func ExampleFarmBeatsExtensionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewFarmBeatsExtensionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armagrifood.FarmBeatsExtensionsClientListOptions{FarmBeatsExtensionIDs: []string{}, - FarmBeatsExtensionNames: []string{}, - ExtensionCategories: []string{}, - PublisherIDs: []string{}, - MaxPageSize: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsExtensions_Get.json -func ExampleFarmBeatsExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewFarmBeatsExtensionsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "DTN.ContentServices", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/agrifood/armagrifood/farmbeatsmodels_client.go b/sdk/resourcemanager/agrifood/armagrifood/farmbeatsmodels_client.go deleted file mode 100644 index f14905320235..000000000000 --- a/sdk/resourcemanager/agrifood/armagrifood/farmbeatsmodels_client.go +++ /dev/null @@ -1,483 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armagrifood - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// FarmBeatsModelsClient contains the methods for the FarmBeatsModels group. -// Don't use this type directly, use NewFarmBeatsModelsClient() instead. -type FarmBeatsModelsClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewFarmBeatsModelsClient creates a new instance of FarmBeatsModelsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewFarmBeatsModelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FarmBeatsModelsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &FarmBeatsModelsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// CreateOrUpdate - Create or update FarmBeats resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. -// body - FarmBeats resource create or update request object. -// options - FarmBeatsModelsClientCreateOrUpdateOptions contains the optional parameters for the FarmBeatsModelsClient.CreateOrUpdate -// method. -func (client *FarmBeatsModelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, body FarmBeats, options *FarmBeatsModelsClientCreateOrUpdateOptions) (FarmBeatsModelsClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, body, options) - if err != nil { - return FarmBeatsModelsClientCreateOrUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return FarmBeatsModelsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return FarmBeatsModelsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.createOrUpdateHandleResponse(resp) -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *FarmBeatsModelsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, body FarmBeats, options *FarmBeatsModelsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}" - 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *FarmBeatsModelsClient) createOrUpdateHandleResponse(resp *http.Response) (FarmBeatsModelsClientCreateOrUpdateResponse, error) { - result := FarmBeatsModelsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeats); err != nil { - return FarmBeatsModelsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete a FarmBeats resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. -// options - FarmBeatsModelsClientDeleteOptions contains the optional parameters for the FarmBeatsModelsClient.Delete method. -func (client *FarmBeatsModelsClient) Delete(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, options *FarmBeatsModelsClientDeleteOptions) (FarmBeatsModelsClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, options) - if err != nil { - return FarmBeatsModelsClientDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return FarmBeatsModelsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return FarmBeatsModelsClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return FarmBeatsModelsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *FarmBeatsModelsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, options *FarmBeatsModelsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}" - 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get FarmBeats resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. -// options - FarmBeatsModelsClientGetOptions contains the optional parameters for the FarmBeatsModelsClient.Get method. -func (client *FarmBeatsModelsClient) Get(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, options *FarmBeatsModelsClientGetOptions) (FarmBeatsModelsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, options) - if err != nil { - return FarmBeatsModelsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return FarmBeatsModelsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FarmBeatsModelsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *FarmBeatsModelsClient) getCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, options *FarmBeatsModelsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}" - 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *FarmBeatsModelsClient) getHandleResponse(resp *http.Response) (FarmBeatsModelsClientGetResponse, error) { - result := FarmBeatsModelsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeats); err != nil { - return FarmBeatsModelsClientGetResponse{}, err - } - return result, nil -} - -// GetOperationResult - Get operationResults for a FarmBeats resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. -// operationResultsID - The operation results id. -// options - FarmBeatsModelsClientGetOperationResultOptions contains the optional parameters for the FarmBeatsModelsClient.GetOperationResult -// method. -func (client *FarmBeatsModelsClient) GetOperationResult(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, operationResultsID string, options *FarmBeatsModelsClientGetOperationResultOptions) (FarmBeatsModelsClientGetOperationResultResponse, error) { - req, err := client.getOperationResultCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, operationResultsID, options) - if err != nil { - return FarmBeatsModelsClientGetOperationResultResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return FarmBeatsModelsClientGetOperationResultResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FarmBeatsModelsClientGetOperationResultResponse{}, runtime.NewResponseError(resp) - } - return client.getOperationResultHandleResponse(resp) -} - -// getOperationResultCreateRequest creates the GetOperationResult request. -func (client *FarmBeatsModelsClient) getOperationResultCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, operationResultsID string, options *FarmBeatsModelsClientGetOperationResultOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/operationResults/{operationResultsId}" - 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) - if operationResultsID == "" { - return nil, errors.New("parameter operationResultsID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationResultsId}", url.PathEscape(operationResultsID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getOperationResultHandleResponse handles the GetOperationResult response. -func (client *FarmBeatsModelsClient) getOperationResultHandleResponse(resp *http.Response) (FarmBeatsModelsClientGetOperationResultResponse, error) { - result := FarmBeatsModelsClientGetOperationResultResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ArmAsyncOperation); err != nil { - return FarmBeatsModelsClientGetOperationResultResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Lists the FarmBeats instances for a resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - FarmBeatsModelsClientListByResourceGroupOptions contains the optional parameters for the FarmBeatsModelsClient.ListByResourceGroup -// method. -func (client *FarmBeatsModelsClient) NewListByResourceGroupPager(resourceGroupName string, options *FarmBeatsModelsClientListByResourceGroupOptions) *runtime.Pager[FarmBeatsModelsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[FarmBeatsModelsClientListByResourceGroupResponse]{ - More: func(page FarmBeatsModelsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *FarmBeatsModelsClientListByResourceGroupResponse) (FarmBeatsModelsClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return FarmBeatsModelsClientListByResourceGroupResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return FarmBeatsModelsClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FarmBeatsModelsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *FarmBeatsModelsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *FarmBeatsModelsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.MaxPageSize != nil { - reqQP.Set("$maxPageSize", strconv.FormatInt(int64(*options.MaxPageSize), 10)) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - reqQP.Set("api-version", "2021-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *FarmBeatsModelsClient) listByResourceGroupHandleResponse(resp *http.Response) (FarmBeatsModelsClientListByResourceGroupResponse, error) { - result := FarmBeatsModelsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeatsListResponse); err != nil { - return FarmBeatsModelsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Lists the FarmBeats instances for a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// options - FarmBeatsModelsClientListBySubscriptionOptions contains the optional parameters for the FarmBeatsModelsClient.ListBySubscription -// method. -func (client *FarmBeatsModelsClient) NewListBySubscriptionPager(options *FarmBeatsModelsClientListBySubscriptionOptions) *runtime.Pager[FarmBeatsModelsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[FarmBeatsModelsClientListBySubscriptionResponse]{ - More: func(page FarmBeatsModelsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *FarmBeatsModelsClientListBySubscriptionResponse) (FarmBeatsModelsClientListBySubscriptionResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listBySubscriptionCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return FarmBeatsModelsClientListBySubscriptionResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return FarmBeatsModelsClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FarmBeatsModelsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *FarmBeatsModelsClient) listBySubscriptionCreateRequest(ctx context.Context, options *FarmBeatsModelsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/farmBeats" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.MaxPageSize != nil { - reqQP.Set("$maxPageSize", strconv.FormatInt(int64(*options.MaxPageSize), 10)) - } - if options != nil && options.SkipToken != nil { - reqQP.Set("$skipToken", *options.SkipToken) - } - reqQP.Set("api-version", "2021-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *FarmBeatsModelsClient) listBySubscriptionHandleResponse(resp *http.Response) (FarmBeatsModelsClientListBySubscriptionResponse, error) { - result := FarmBeatsModelsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeatsListResponse); err != nil { - return FarmBeatsModelsClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// BeginUpdate - Update a FarmBeats resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. -// body - Request object. -// options - FarmBeatsModelsClientBeginUpdateOptions contains the optional parameters for the FarmBeatsModelsClient.BeginUpdate -// method. -func (client *FarmBeatsModelsClient) BeginUpdate(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, body FarmBeatsUpdateRequestModel, options *FarmBeatsModelsClientBeginUpdateOptions) (*runtime.Poller[FarmBeatsModelsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, farmBeatsResourceName, body, options) - if err != nil { - return nil, err - } - return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FarmBeatsModelsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) - } else { - return runtime.NewPollerFromResumeToken[FarmBeatsModelsClientUpdateResponse](options.ResumeToken, client.pl, nil) - } -} - -// Update - Update a FarmBeats resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -func (client *FarmBeatsModelsClient) update(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, body FarmBeatsUpdateRequestModel, options *FarmBeatsModelsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, body, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *FarmBeatsModelsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, body FarmBeatsUpdateRequestModel, options *FarmBeatsModelsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}" - 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) -} diff --git a/sdk/resourcemanager/agrifood/armagrifood/farmbeatsmodels_client_example_test.go b/sdk/resourcemanager/agrifood/armagrifood/farmbeatsmodels_client_example_test.go deleted file mode 100644 index 43c3a51617c2..000000000000 --- a/sdk/resourcemanager/agrifood/armagrifood/farmbeatsmodels_client_example_test.go +++ /dev/null @@ -1,214 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armagrifood_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agrifood/armagrifood" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_Get.json -func ExampleFarmBeatsModelsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewFarmBeatsModelsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "examples-rg", "examples-farmBeatsResourceName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_CreateOrUpdate.json -func ExampleFarmBeatsModelsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewFarmBeatsModelsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "examples-rg", "examples-farmbeatsResourceName", armagrifood.FarmBeats{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_Update.json -func ExampleFarmBeatsModelsClient_BeginUpdate_farmBeatsModelsUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewFarmBeatsModelsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "examples-rg", "examples-farmBeatsResourceName", armagrifood.FarmBeatsUpdateRequestModel{ - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_UpdateWithSensor.json -func ExampleFarmBeatsModelsClient_BeginUpdate_farmBeatsModelsUpdateWithSensor() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewFarmBeatsModelsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "examples-rg", "examples-farmBeatsResourceName", armagrifood.FarmBeatsUpdateRequestModel{ - Identity: &armagrifood.Identity{ - Type: to.Ptr("SystemAssigned"), - }, - Properties: &armagrifood.FarmBeatsUpdateProperties{ - SensorIntegration: &armagrifood.SensorIntegration{ - Enabled: to.Ptr("True"), - }, - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_Delete.json -func ExampleFarmBeatsModelsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewFarmBeatsModelsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "examples-rg", "examples-farmBeatsResourceName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_ListBySubscription.json -func ExampleFarmBeatsModelsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewFarmBeatsModelsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armagrifood.FarmBeatsModelsClientListBySubscriptionOptions{MaxPageSize: nil, - SkipToken: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_ListByResourceGroup.json -func ExampleFarmBeatsModelsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewFarmBeatsModelsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("examples-rg", &armagrifood.FarmBeatsModelsClientListByResourceGroupOptions{MaxPageSize: nil, - SkipToken: nil, - }) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/FarmBeatsModels_GetOperationResult.json -func ExampleFarmBeatsModelsClient_GetOperationResult() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewFarmBeatsModelsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetOperationResult(ctx, "examples-rg", "examples-farmBeatsResourceName", "resource-provisioning-id-farmBeatsResourceName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/agrifood/armagrifood/go.mod b/sdk/resourcemanager/agrifood/armagrifood/go.mod index e903bc6e7953..cffb921dab7d 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/go.mod +++ b/sdk/resourcemanager/agrifood/armagrifood/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agrifood/armagrifoo go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/agrifood/armagrifood/go.sum b/sdk/resourcemanager/agrifood/armagrifood/go.sum index 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/go.sum +++ b/sdk/resourcemanager/agrifood/armagrifood/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/agrifood/armagrifood/locations_client_example_test.go b/sdk/resourcemanager/agrifood/armagrifood/locations_client_example_test.go deleted file mode 100644 index 343f338ef573..000000000000 --- a/sdk/resourcemanager/agrifood/armagrifood/locations_client_example_test.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armagrifood_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agrifood/armagrifood" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Locations_CheckNameAvailability_AlreadyExists.json -func ExampleLocationsClient_CheckNameAvailability_locationsCheckNameAvailabilityAlreadyExists() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewLocationsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, armagrifood.CheckNameAvailabilityRequest{ - Name: to.Ptr("existingaccountname"), - Type: to.Ptr("Microsoft.AgFoodPlatform/farmBeats"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Locations_CheckNameAvailability_Available.json -func ExampleLocationsClient_CheckNameAvailability_locationsCheckNameAvailabilityAvailable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewLocationsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, armagrifood.CheckNameAvailabilityRequest{ - Name: to.Ptr("newaccountname"), - Type: to.Ptr("Microsoft.AgFoodPlatform/farmBeats"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/agrifood/armagrifood/models.go b/sdk/resourcemanager/agrifood/armagrifood/models.go index bf7f2ea8bcfe..188b21f5a2aa 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/models.go +++ b/sdk/resourcemanager/agrifood/armagrifood/models.go @@ -11,12 +11,70 @@ package armagrifood import "time" +// APIKeyAuthCredentials - ApiKeyAuthCredentials class for ApiKey based Auth. +type APIKeyAuthCredentials struct { + // REQUIRED; Properties of the key vault. + APIKey *KeyVaultProperties `json:"apiKey,omitempty"` + + // REQUIRED; Enum for different types of AuthCredentials supported. + Kind *AuthCredentialsKind `json:"kind,omitempty"` +} + +// GetAuthCredentials implements the AuthCredentialsClassification interface for type APIKeyAuthCredentials. +func (a *APIKeyAuthCredentials) GetAuthCredentials() *AuthCredentials { + return &AuthCredentials{ + Kind: a.Kind, + } +} + +// APIProperties - Api properties. +type APIProperties struct { + // Interval in minutes for which the weather data for the api needs to be refreshed. + APIFreshnessTimeInMinutes *int32 `json:"apiFreshnessTimeInMinutes,omitempty"` +} + // ArmAsyncOperation - Arm async operation class. Ref: https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/async-operations. type ArmAsyncOperation struct { + // Arm async operation error class. Ref: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#azure-asyncoperation-resource-format. + Error *ArmAsyncOperationError `json:"error,omitempty"` + // Status of the async operation. Status *string `json:"status,omitempty"` } +// ArmAsyncOperationError - Arm async operation error class. Ref: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/async-api-reference.md#azure-asyncoperation-resource-format. +type ArmAsyncOperationError struct { + // Status of the async operation. + Code *string `json:"code,omitempty"` + + // Status of the async operation. + Message *string `json:"message,omitempty"` +} + +// AuthCredentialsClassification provides polymorphic access to related types. +// Call the interface's GetAuthCredentials() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *APIKeyAuthCredentials, *AuthCredentials, *OAuthClientCredentials +type AuthCredentialsClassification interface { + // GetAuthCredentials returns the AuthCredentials content of the underlying type. + GetAuthCredentials() *AuthCredentials +} + +// AuthCredentials abstract base class for Auth Purpose. +type AuthCredentials struct { + // REQUIRED; Enum for different types of AuthCredentials supported. + Kind *AuthCredentialsKind `json:"kind,omitempty"` +} + +// GetAuthCredentials implements the AuthCredentialsClassification interface for type AuthCredentials. +func (a *AuthCredentials) GetAuthCredentials() *AuthCredentials { return a } + +// CheckNameAvailabilityClientCheckNameAvailabilityOptions contains the optional parameters for the CheckNameAvailabilityClient.CheckNameAvailability +// method. +type CheckNameAvailabilityClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + // CheckNameAvailabilityRequest - The check availability request body. type CheckNameAvailabilityRequest struct { // The name of the resource for which availability needs to be checked. @@ -38,67 +96,15 @@ type CheckNameAvailabilityResponse struct { Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` } -// DetailedInformation - Model to capture detailed information for farmBeatsExtensions. -type DetailedInformation struct { - // List of apiInputParameters. - APIInputParameters []*string `json:"apiInputParameters,omitempty"` - - // ApiName available for the farmBeatsExtension. - APIName *string `json:"apiName,omitempty"` - - // List of customParameters. - CustomParameters []*string `json:"customParameters,omitempty"` - - // List of platformParameters. - PlatformParameters []*string `json:"platformParameters,omitempty"` - - // Unit systems info for the data provider. - UnitsSupported *UnitSystemsInfo `json:"unitsSupported,omitempty"` -} - -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` - - // READ-ONLY; The additional info type. - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` - - // READ-ONLY; The error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; The error details. - Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` - - // READ-ONLY; The error message. - Message *string `json:"message,omitempty" azure:"ro"` - - // READ-ONLY; The error target. - Target *string `json:"target,omitempty" azure:"ro"` -} - -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail `json:"error,omitempty"` -} - -// Extension resource. -type Extension struct { - // Extension resource properties. - Properties *ExtensionProperties `json:"properties,omitempty"` +// DataConnector Model. +type DataConnector struct { + // REQUIRED; DataConnector Properties. + Properties *DataConnectorProperties `json:"properties,omitempty"` // READ-ONLY; The ETag value to implement optimistic concurrency. ETag *string `json:"eTag,omitempty" azure:"ro"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource @@ -111,80 +117,60 @@ type Extension struct { Type *string `json:"type,omitempty" azure:"ro"` } -// ExtensionListResponse - Paged response contains list of requested objects and a URL link to get the next set of results. -type ExtensionListResponse struct { - // List of requested objects. - Value []*Extension `json:"value,omitempty"` +// DataConnectorListResponse - Paged response contains list of requested objects and a URL link to get the next set of results. +type DataConnectorListResponse struct { + // REQUIRED; List of requested objects. + Value []*DataConnector `json:"value,omitempty"` - // READ-ONLY; Continuation link (absolute URI) to the next page of results in the list. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + // Continuation link (absolute URI) to the next page of results in the list. + NextLink *string `json:"nextLink,omitempty"` } -// ExtensionProperties - Extension resource properties. -type ExtensionProperties struct { - // READ-ONLY; Extension api docs link. - ExtensionAPIDocsLink *string `json:"extensionApiDocsLink,omitempty" azure:"ro"` - - // READ-ONLY; Extension auth link. - ExtensionAuthLink *string `json:"extensionAuthLink,omitempty" azure:"ro"` - - // READ-ONLY; Extension category. e.g. weather/sensor/satellite. - ExtensionCategory *string `json:"extensionCategory,omitempty" azure:"ro"` - - // READ-ONLY; Extension Id. - ExtensionID *string `json:"extensionId,omitempty" azure:"ro"` - - // READ-ONLY; Installed extension version. - InstalledExtensionVersion *string `json:"installedExtensionVersion,omitempty" azure:"ro"` +// DataConnectorProperties - DataConnector Properties. +type DataConnectorProperties struct { + // REQUIRED; AuthCredentials abstract base class for Auth Purpose. + Credentials AuthCredentialsClassification `json:"credentials,omitempty"` } -// ExtensionsClientCreateOptions contains the optional parameters for the ExtensionsClient.Create method. -type ExtensionsClientCreateOptions struct { +// DataConnectorsClientCreateOrUpdateOptions contains the optional parameters for the DataConnectorsClient.CreateOrUpdate +// method. +type DataConnectorsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters } -// ExtensionsClientDeleteOptions contains the optional parameters for the ExtensionsClient.Delete method. -type ExtensionsClientDeleteOptions struct { +// DataConnectorsClientDeleteOptions contains the optional parameters for the DataConnectorsClient.Delete method. +type DataConnectorsClientDeleteOptions struct { // placeholder for future optional parameters } -// ExtensionsClientGetOptions contains the optional parameters for the ExtensionsClient.Get method. -type ExtensionsClientGetOptions struct { +// DataConnectorsClientGetOptions contains the optional parameters for the DataConnectorsClient.Get method. +type DataConnectorsClientGetOptions struct { // placeholder for future optional parameters } -// ExtensionsClientListByFarmBeatsOptions contains the optional parameters for the ExtensionsClient.ListByFarmBeats method. -type ExtensionsClientListByFarmBeatsOptions struct { - // Installed extension categories. - ExtensionCategories []string - // Installed extension ids. - ExtensionIDs []string +// DataConnectorsClientListOptions contains the optional parameters for the DataConnectorsClient.List method. +type DataConnectorsClientListOptions struct { // Maximum number of items needed (inclusive). Minimum = 10, Maximum = 1000, Default value = 50. MaxPageSize *int32 - // Skip token for getting next set of results. + // Continuation token for getting next set of results. SkipToken *string } -// ExtensionsClientUpdateOptions contains the optional parameters for the ExtensionsClient.Update method. -type ExtensionsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// FarmBeats ARM Resource. -type FarmBeats struct { +// DataManagerForAgriculture - Data Manager For Agriculture ARM Resource. +type DataManagerForAgriculture struct { // REQUIRED; The geo-location where the resource lives Location *string `json:"location,omitempty"` // Identity for the resource. Identity *Identity `json:"identity,omitempty"` - // FarmBeats ARM Resource properties. - Properties *FarmBeatsProperties `json:"properties,omitempty"` + // Data Manager For Agriculture ARM Resource properties. + Properties *DataManagerForAgricultureProperties `json:"properties,omitempty"` // Resource tags. Tags map[string]*string `json:"tags,omitempty"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource @@ -197,12 +183,12 @@ type FarmBeats struct { Type *string `json:"type,omitempty" azure:"ro"` } -// FarmBeatsExtension - FarmBeats extension resource. -type FarmBeatsExtension struct { - // FarmBeatsExtension properties. - Properties *FarmBeatsExtensionProperties `json:"properties,omitempty"` +// DataManagerForAgricultureExtension - DataManagerForAgriculture extension resource. +type DataManagerForAgricultureExtension struct { + // DataManagerForAgricultureExtension properties. + Properties *DataManagerForAgricultureExtensionProperties `json:"properties,omitempty"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource @@ -215,18 +201,21 @@ type FarmBeatsExtension struct { Type *string `json:"type,omitempty" azure:"ro"` } -// FarmBeatsExtensionListResponse - Paged response contains list of requested objects and a URL link to get the next set of -// results. -type FarmBeatsExtensionListResponse struct { - // List of requested objects. - Value []*FarmBeatsExtension `json:"value,omitempty"` +// DataManagerForAgricultureExtensionListResponse - Paged response contains list of requested objects and a URL link to get +// the next set of results. +type DataManagerForAgricultureExtensionListResponse struct { + // REQUIRED; List of requested objects. + Value []*DataManagerForAgricultureExtension `json:"value,omitempty"` - // READ-ONLY; Continuation link (absolute URI) to the next page of results in the list. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + // Continuation link (absolute URI) to the next page of results in the list. + NextLink *string `json:"nextLink,omitempty"` + + // Token used in retrieving the next page. If null, there are no additional pages. + SkipToken *string `json:"$skipToken,omitempty"` } -// FarmBeatsExtensionProperties - FarmBeatsExtension properties. -type FarmBeatsExtensionProperties struct { +// DataManagerForAgricultureExtensionProperties - DataManagerForAgricultureExtension properties. +type DataManagerForAgricultureExtensionProperties struct { // READ-ONLY; Textual description. Description *string `json:"description,omitempty" azure:"ro"` @@ -235,43 +224,45 @@ type FarmBeatsExtensionProperties struct { // PlatformParameters and Units supported. DetailedInformation []*DetailedInformation `json:"detailedInformation,omitempty" azure:"ro"` - // READ-ONLY; FarmBeatsExtension api docs link. + // READ-ONLY; Data Manager For Agriculture Extension api docs link. ExtensionAPIDocsLink *string `json:"extensionApiDocsLink,omitempty" azure:"ro"` - // READ-ONLY; FarmBeatsExtension auth link. + // READ-ONLY; Data Manager For Agriculture Extension auth link. ExtensionAuthLink *string `json:"extensionAuthLink,omitempty" azure:"ro"` // READ-ONLY; Category of the extension. e.g. weather/sensor/satellite. ExtensionCategory *string `json:"extensionCategory,omitempty" azure:"ro"` - // READ-ONLY; FarmBeatsExtension ID. + // READ-ONLY; Data Manager For Agriculture Extension ID. FarmBeatsExtensionID *string `json:"farmBeatsExtensionId,omitempty" azure:"ro"` - // READ-ONLY; FarmBeatsExtension name. + // READ-ONLY; Data Manager For Agriculture Extension name. FarmBeatsExtensionName *string `json:"farmBeatsExtensionName,omitempty" azure:"ro"` - // READ-ONLY; FarmBeatsExtension version. + // READ-ONLY; Data Manager For Agriculture Extension version. FarmBeatsExtensionVersion *string `json:"farmBeatsExtensionVersion,omitempty" azure:"ro"` // READ-ONLY; Publisher ID. PublisherID *string `json:"publisherId,omitempty" azure:"ro"` - // READ-ONLY; Target ResourceType of the farmBeatsExtension. + // READ-ONLY; Target ResourceType of the Data Manager For Agriculture Extension. TargetResourceType *string `json:"targetResourceType,omitempty" azure:"ro"` } -// FarmBeatsExtensionsClientGetOptions contains the optional parameters for the FarmBeatsExtensionsClient.Get method. -type FarmBeatsExtensionsClientGetOptions struct { +// DataManagerForAgricultureExtensionsClientGetOptions contains the optional parameters for the DataManagerForAgricultureExtensionsClient.Get +// method. +type DataManagerForAgricultureExtensionsClientGetOptions struct { // placeholder for future optional parameters } -// FarmBeatsExtensionsClientListOptions contains the optional parameters for the FarmBeatsExtensionsClient.List method. -type FarmBeatsExtensionsClientListOptions struct { +// DataManagerForAgricultureExtensionsClientListOptions contains the optional parameters for the DataManagerForAgricultureExtensionsClient.List +// method. +type DataManagerForAgricultureExtensionsClientListOptions struct { // Extension categories. ExtensionCategories []string - // FarmBeatsExtension ids. + // DataManagerForAgricultureExtension ids. FarmBeatsExtensionIDs []string - // FarmBeats extension names. + // DataManagerForAgriculture extension names. FarmBeatsExtensionNames []string // Maximum number of items needed (inclusive). Minimum = 10, Maximum = 1000, Default value = 50. MaxPageSize *int32 @@ -279,119 +270,373 @@ type FarmBeatsExtensionsClientListOptions struct { PublisherIDs []string } -// FarmBeatsListResponse - Paged response contains list of requested objects and a URL link to get the next set of results. -type FarmBeatsListResponse struct { - // List of requested objects. - Value []*FarmBeats `json:"value,omitempty"` +// DataManagerForAgricultureListResponse - Paged response contains list of requested objects and a URL link to get the next +// set of results. +type DataManagerForAgricultureListResponse struct { + // REQUIRED; List of requested objects. + Value []*DataManagerForAgriculture `json:"value,omitempty"` - // READ-ONLY; Continuation link (absolute URI) to the next page of results in the list. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` + // Continuation link (absolute URI) to the next page of results in the list. + NextLink *string `json:"nextLink,omitempty"` + + // Token used in retrieving the next page. If null, there are no additional pages. + SkipToken *string `json:"$skipToken,omitempty"` } -// FarmBeatsModelsClientBeginUpdateOptions contains the optional parameters for the FarmBeatsModelsClient.BeginUpdate method. -type FarmBeatsModelsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string +// DataManagerForAgricultureProperties - Data Manager For Agriculture ARM Resource properties. +type DataManagerForAgricultureProperties struct { + // Property to allow or block public traffic for an Azure Data Manager For Agriculture resource. + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + + // Sensor integration request model. + SensorIntegration *SensorIntegration `json:"sensorIntegration,omitempty"` + + // READ-ONLY; Uri of the Data Manager For Agriculture instance. + InstanceURI *string `json:"instanceUri,omitempty" azure:"ro"` + + // READ-ONLY; Private endpoints. + PrivateEndpointConnections []*PrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` + + // READ-ONLY; Data Manager For Agriculture instance provisioning state. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// FarmBeatsModelsClientCreateOrUpdateOptions contains the optional parameters for the FarmBeatsModelsClient.CreateOrUpdate +// DataManagerForAgricultureResourcesClientBeginUpdateOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.BeginUpdate // method. -type FarmBeatsModelsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters +type DataManagerForAgricultureResourcesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// FarmBeatsModelsClientDeleteOptions contains the optional parameters for the FarmBeatsModelsClient.Delete method. -type FarmBeatsModelsClientDeleteOptions struct { +// DataManagerForAgricultureResourcesClientCreateOrUpdateOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.CreateOrUpdate +// method. +type DataManagerForAgricultureResourcesClientCreateOrUpdateOptions struct { // placeholder for future optional parameters } -// FarmBeatsModelsClientGetOperationResultOptions contains the optional parameters for the FarmBeatsModelsClient.GetOperationResult +// DataManagerForAgricultureResourcesClientDeleteOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.Delete // method. -type FarmBeatsModelsClientGetOperationResultOptions struct { +type DataManagerForAgricultureResourcesClientDeleteOptions struct { // placeholder for future optional parameters } -// FarmBeatsModelsClientGetOptions contains the optional parameters for the FarmBeatsModelsClient.Get method. -type FarmBeatsModelsClientGetOptions struct { +// DataManagerForAgricultureResourcesClientGetOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.Get +// method. +type DataManagerForAgricultureResourcesClientGetOptions struct { // placeholder for future optional parameters } -// FarmBeatsModelsClientListByResourceGroupOptions contains the optional parameters for the FarmBeatsModelsClient.ListByResourceGroup +// DataManagerForAgricultureResourcesClientListByResourceGroupOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.ListByResourceGroup // method. -type FarmBeatsModelsClientListByResourceGroupOptions struct { +type DataManagerForAgricultureResourcesClientListByResourceGroupOptions struct { // Maximum number of items needed (inclusive). Minimum = 10, Maximum = 1000, Default value = 50. MaxPageSize *int32 // Continuation token for getting next set of results. SkipToken *string } -// FarmBeatsModelsClientListBySubscriptionOptions contains the optional parameters for the FarmBeatsModelsClient.ListBySubscription +// DataManagerForAgricultureResourcesClientListBySubscriptionOptions contains the optional parameters for the DataManagerForAgricultureResourcesClient.ListBySubscription // method. -type FarmBeatsModelsClientListBySubscriptionOptions struct { +type DataManagerForAgricultureResourcesClientListBySubscriptionOptions struct { // Maximum number of items needed (inclusive). Minimum = 10, Maximum = 1000, Default value = 50. MaxPageSize *int32 // Skip token for getting next set of results. SkipToken *string } -// FarmBeatsProperties - FarmBeats ARM Resource properties. -type FarmBeatsProperties struct { - // Property to allow or block public traffic for an Azure FarmBeats resource. - PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +// DataManagerForAgricultureSolution - DataManagerForAgriculture solution resource. +type DataManagerForAgricultureSolution struct { + // DataManagerForAgricultureSolution properties. + Properties *DataManagerForAgricultureSolutionProperties `json:"properties,omitempty"` - // Sensor integration request model. - SensorIntegration *SensorIntegration `json:"sensorIntegration,omitempty"` + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; Uri of the FarmBeats instance. - InstanceURI *string `json:"instanceUri,omitempty" azure:"ro"` + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The Private Endpoint Connection resource. - PrivateEndpointConnections *PrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - // READ-ONLY; FarmBeats instance provisioning state. - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// DataManagerForAgricultureSolutionListResponse - Paged response contains list of requested objects and a URL link to get +// the next set of results. +type DataManagerForAgricultureSolutionListResponse struct { + // REQUIRED; List of requested objects. + Value []*DataManagerForAgricultureSolution `json:"value,omitempty"` + + // Continuation link (absolute URI) to the next page of results in the list. + NextLink *string `json:"nextLink,omitempty"` + + // Token used in retrieving the next page. If null, there are no additional pages. + SkipToken *string `json:"$skipToken,omitempty"` } -// FarmBeatsUpdateProperties - FarmBeats ARM Resource properties. -type FarmBeatsUpdateProperties struct { - // Property to allow or block public traffic for an Azure FarmBeats resource. +// DataManagerForAgricultureSolutionProperties - DataManagerForAgricultureSolution properties. +type DataManagerForAgricultureSolutionProperties struct { + MarketplaceOfferDetails *MarketplaceOfferDetails `json:"marketplaceOfferDetails,omitempty"` + + // READ-ONLY; Application id of the multi tenant application to be used by partner to access Data Manager For Agriculture + // data. + AccessFBApplicationID *string `json:"accessFBApplicationId,omitempty" azure:"ro"` + + // READ-ONLY; Application name of the multi tenant application to be used by partner to access Data Manager For Agriculture + // Data. + AccessFBApplicationName *string `json:"accessFBApplicationName,omitempty" azure:"ro"` + + // READ-ONLY; List of ActionIds needed to make the SaaS multi tenant application access relevant fb data. + ActionIDs []*string `json:"actionIds,omitempty" azure:"ro"` + + // READ-ONLY; Gets scope of the Data manager For Agriculture data access that's required for processing solution request to + // partner. Example: For gdd they might need weatherScope and satelliteScope. + DataAccessScopes []*string `json:"dataAccessScopes,omitempty" azure:"ro"` + + // READ-ONLY; Gets api-version Swagger Document Dictionary to capture all api-versions of swagger exposed by partner to Data + // Manager For Agriculture. + OpenAPISpecsDictionary map[string]interface{} `json:"openApiSpecsDictionary,omitempty" azure:"ro"` + + // READ-ONLY; Solution Partner Id. + PartnerID *string `json:"partnerId,omitempty" azure:"ro"` + + // READ-ONLY; Solution Partner Tenant Id. + PartnerTenantID *string `json:"partnerTenantId,omitempty" azure:"ro"` + + // READ-ONLY; Role Id of the SaaS multi tenant application to access relevant fb data. + RoleID *string `json:"roleId,omitempty" azure:"ro"` + + // READ-ONLY; Role Name of the SaaS multi tenant application to access relevant fb data. + RoleName *string `json:"roleName,omitempty" azure:"ro"` + + // READ-ONLY; Application id of the SaaS multi tenant application. + SaaSApplicationID *string `json:"saaSApplicationId,omitempty" azure:"ro"` +} + +// DataManagerForAgricultureUpdateProperties - Data Manager For Agriculture ARM Resource properties. +type DataManagerForAgricultureUpdateProperties struct { + // Property to allow or block public traffic for an Azure Data Manager For Agriculture resource. PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` // Sensor integration request model. SensorIntegration *SensorIntegration `json:"sensorIntegration,omitempty"` } -// FarmBeatsUpdateRequestModel - FarmBeats update request. -type FarmBeatsUpdateRequestModel struct { +// DataManagerForAgricultureUpdateRequestModel - DataManagerForAgriculture update request. +type DataManagerForAgricultureUpdateRequestModel struct { // Identity for the resource. Identity *Identity `json:"identity,omitempty"` // Geo-location where the resource lives. Location *string `json:"location,omitempty"` - // FarmBeats ARM Resource properties. - Properties *FarmBeatsUpdateProperties `json:"properties,omitempty"` + // Data Manager For Agriculture ARM Resource properties. + Properties *DataManagerForAgricultureUpdateProperties `json:"properties,omitempty"` // Resource tags. Tags map[string]*string `json:"tags,omitempty"` } +// DetailedInformation - Model to capture detailed information for Data Manager For AgricultureExtensions. +type DetailedInformation struct { + // List of defaultParameters. + APIDefaultInputParameters []*string `json:"apiDefaultInputParameters,omitempty"` + + // Extension provider's API documentation link. + APIDocsLink *string `json:"apiDocsLink,omitempty"` + + // List of apiInputParameters. + APIInputParameters []*string `json:"apiInputParameters,omitempty"` + + // ApiName available for the Data Manager For Agriculture Extension. + APIName *string `json:"apiName,omitempty"` + + // Type of Api in Extension. + APIType *string `json:"apiType,omitempty"` + + // List of customParameters. + CustomParameters []*string `json:"customParameters,omitempty"` + + // List of platformParameters. + PlatformParameters []*string `json:"platformParameters,omitempty"` + + // Unit systems info for the data provider. + UnitsSupported *UnitSystemsInfo `json:"unitsSupported,omitempty"` +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Extension resource. +type Extension struct { + // Extension resource properties. + Properties *ExtensionProperties `json:"properties,omitempty"` + + // READ-ONLY; The ETag value to implement optimistic concurrency. + ETag *string `json:"eTag,omitempty" azure:"ro"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ExtensionInstallationRequest - Extension Installation Request Body. +type ExtensionInstallationRequest struct { + // Additional Api Properties. + AdditionalAPIProperties map[string]*APIProperties `json:"additionalApiProperties,omitempty"` + + // Extension Version. + ExtensionVersion *string `json:"extensionVersion,omitempty"` +} + +// ExtensionListResponse - Paged response contains list of requested objects and a URL link to get the next set of results. +type ExtensionListResponse struct { + // REQUIRED; List of requested objects. + Value []*Extension `json:"value,omitempty"` + + // Token used in retrieving the next page. If null, there are no additional pages. + SkipToken *string `json:"$skipToken,omitempty"` + + // READ-ONLY; Continuation link (absolute URI) to the next page of results in the list. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ExtensionProperties - Extension resource properties. +type ExtensionProperties struct { + // READ-ONLY; Additional Api Properties. + AdditionalAPIProperties map[string]*APIProperties `json:"additionalApiProperties,omitempty" azure:"ro"` + + // READ-ONLY; Extension api docs link. + ExtensionAPIDocsLink *string `json:"extensionApiDocsLink,omitempty" azure:"ro"` + + // READ-ONLY; Extension auth link. + ExtensionAuthLink *string `json:"extensionAuthLink,omitempty" azure:"ro"` + + // READ-ONLY; Extension category. e.g. weather/sensor/satellite. + ExtensionCategory *string `json:"extensionCategory,omitempty" azure:"ro"` + + // READ-ONLY; Extension Id. + ExtensionID *string `json:"extensionId,omitempty" azure:"ro"` + + // READ-ONLY; Installed extension version. + InstalledExtensionVersion *string `json:"installedExtensionVersion,omitempty" azure:"ro"` +} + +// ExtensionsClientCreateOrUpdateOptions contains the optional parameters for the ExtensionsClient.CreateOrUpdate method. +type ExtensionsClientCreateOrUpdateOptions struct { + // Extension resource request body. + RequestBody *ExtensionInstallationRequest +} + +// ExtensionsClientDeleteOptions contains the optional parameters for the ExtensionsClient.Delete method. +type ExtensionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ExtensionsClientGetOptions contains the optional parameters for the ExtensionsClient.Get method. +type ExtensionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExtensionsClientListByDataManagerForAgricultureOptions contains the optional parameters for the ExtensionsClient.ListByDataManagerForAgriculture +// method. +type ExtensionsClientListByDataManagerForAgricultureOptions struct { + // Installed extension categories. + ExtensionCategories []string + // Installed extension ids. + ExtensionIDs []string + // Maximum number of items needed (inclusive). Minimum = 10, Maximum = 1000, Default value = 50. + MaxPageSize *int32 + // Skip token for getting next set of results. + SkipToken *string +} + // Identity for the resource. type Identity struct { // The identity type. Type *string `json:"type,omitempty"` - // READ-ONLY; The principal ID of resource identity. + // READ-ONLY; The principal ID of resource identity. The value must be an UUID. PrincipalID *string `json:"principalId,omitempty" azure:"ro"` - // READ-ONLY; The tenant ID of resource. + // READ-ONLY; The tenant ID of resource. The value must be an UUID. TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// LocationsClientCheckNameAvailabilityOptions contains the optional parameters for the LocationsClient.CheckNameAvailability -// method. -type LocationsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters +// KeyVaultProperties - Properties of the key vault. +type KeyVaultProperties struct { + // REQUIRED; Name of Key Vault key. + KeyName *string `json:"keyName,omitempty"` + + // REQUIRED; Uri of the key vault. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + + // REQUIRED; Version of Key Vault key. + KeyVersion *string `json:"keyVersion,omitempty"` +} + +type MarketplaceOfferDetails struct { + PublisherID *string `json:"publisherId,omitempty"` + SaasOfferID *string `json:"saasOfferId,omitempty"` +} + +// OAuthClientCredentials for clientId clientSecret auth. +type OAuthClientCredentials struct { + // REQUIRED; ClientId associated with the provider. + ClientID *string `json:"clientId,omitempty"` + + // REQUIRED; Properties of the key vault. + ClientSecret *KeyVaultProperties `json:"clientSecret,omitempty"` + + // REQUIRED; Enum for different types of AuthCredentials supported. + Kind *AuthCredentialsKind `json:"kind,omitempty"` +} + +// GetAuthCredentials implements the AuthCredentialsClassification interface for type OAuthClientCredentials. +func (o *OAuthClientCredentials) GetAuthCredentials() *AuthCredentials { + return &AuthCredentials{ + Kind: o.Kind, + } } // Operation - Details of a REST API operation, returned from the Resource Provider Operations API @@ -443,23 +688,28 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty" azure:"ro"` } +// OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +type OperationResultsClientGetOptions struct { + // placeholder for future optional parameters +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters } -// PrivateEndpoint - The Private Endpoint resource. +// PrivateEndpoint - The private endpoint resource. type PrivateEndpoint struct { - // READ-ONLY; The ARM identifier for Private Endpoint + // READ-ONLY; The ARM identifier for private endpoint. ID *string `json:"id,omitempty" azure:"ro"` } -// PrivateEndpointConnection - The Private Endpoint Connection resource. +// PrivateEndpointConnection - The private endpoint connection resource. type PrivateEndpointConnection struct { // Resource properties. Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource @@ -472,20 +722,23 @@ type PrivateEndpointConnection struct { Type *string `json:"type,omitempty" azure:"ro"` } -// PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account +// PrivateEndpointConnectionListResult - List of private endpoint connections associated with the specified resource. type PrivateEndpointConnectionListResult struct { - // Array of private endpoint connections + // Array of private endpoint connections. Value []*PrivateEndpointConnection `json:"value,omitempty"` } -// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. +// PrivateEndpointConnectionProperties - Properties of the private endpoint connection. type PrivateEndpointConnectionProperties struct { // REQUIRED; A collection of information about the state of the connection between service consumer and provider. PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` - // The resource of private end point. + // The private endpoint resource. PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // READ-ONLY; The group ids for the private endpoint resource. + GroupIDs []*string `json:"groupIds,omitempty" azure:"ro"` + // READ-ONLY; The provisioning state of the private endpoint connection resource. ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } @@ -515,12 +768,12 @@ type PrivateEndpointConnectionsClientListByResourceOptions struct { // placeholder for future optional parameters } -// PrivateLinkResource - A private link resource +// PrivateLinkResource - A private link resource. type PrivateLinkResource struct { // Resource properties. Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource @@ -533,7 +786,7 @@ type PrivateLinkResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// PrivateLinkResourceListResult - A list of private link resources +// PrivateLinkResourceListResult - A list of private link resources. type PrivateLinkResourceListResult struct { // Array of private link resources Value []*PrivateLinkResource `json:"value,omitempty"` @@ -541,7 +794,7 @@ type PrivateLinkResourceListResult struct { // PrivateLinkResourceProperties - Properties of a private link resource. type PrivateLinkResourceProperties struct { - // The private link resource Private link DNS zone name. + // The private link resource private link DNS zone name. RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` // READ-ONLY; The private link resource group id. @@ -578,7 +831,7 @@ type PrivateLinkServiceConnectionState struct { // ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a // location type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource @@ -593,7 +846,7 @@ type ProxyResource struct { // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource @@ -608,7 +861,7 @@ type Resource struct { // SensorIntegration - Sensor integration request model. type SensorIntegration struct { - // Sensor integration enable state. Allowed values are True, None + // Sensor integration enable state. Enabled *string `json:"enabled,omitempty"` // Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows @@ -619,6 +872,127 @@ type SensorIntegration struct { ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } +// Solution resource. +type Solution struct { + // Solution resource properties. + Properties *SolutionProperties `json:"properties,omitempty"` + + // READ-ONLY; The ETag value to implement optimistic concurrency. + ETag *string `json:"eTag,omitempty" azure:"ro"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// SolutionListResponse - Paged response contains list of requested objects and a URL link to get the next set of results. +type SolutionListResponse struct { + // REQUIRED; List of requested objects. + Value []*Solution `json:"value,omitempty"` + + // Continuation link (absolute URI) to the next page of results in the list. + NextLink *string `json:"nextLink,omitempty"` + + // Token used in retrieving the next page. If null, there are no additional pages. + SkipToken *string `json:"$skipToken,omitempty"` +} + +// SolutionProperties - Solution resource properties. +type SolutionProperties struct { + // REQUIRED; SaaS application Marketplace Publisher Id. + MarketplacePublisherID *string `json:"marketplacePublisherId,omitempty"` + + // REQUIRED; SaaS application Offer Id. + OfferID *string `json:"offerId,omitempty"` + + // REQUIRED; SaaS application Plan Id. + PlanID *string `json:"planId,omitempty"` + + // REQUIRED; SaaS subscriptionId of the installed SaaS application. + SaasSubscriptionID *string `json:"saasSubscriptionId,omitempty"` + + // REQUIRED; SaaS subscription name of the installed SaaS application. + SaasSubscriptionName *string `json:"saasSubscriptionName,omitempty"` + + // REQUIRED; SaaS application Term Id. + TermID *string `json:"termId,omitempty"` + + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]interface{} + + // Role Assignment Id. + RoleAssignmentID *string `json:"roleAssignmentId,omitempty"` + + // READ-ONLY; Partner Id of the Solution. + PartnerID *string `json:"partnerId,omitempty" azure:"ro"` +} + +// SolutionsClientCreateOrUpdateOptions contains the optional parameters for the SolutionsClient.CreateOrUpdate method. +type SolutionsClientCreateOrUpdateOptions struct { + // Solution resource request body. + RequestBody *Solution +} + +// SolutionsClientDeleteOptions contains the optional parameters for the SolutionsClient.Delete method. +type SolutionsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SolutionsClientGetOptions contains the optional parameters for the SolutionsClient.Get method. +type SolutionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SolutionsClientListOptions contains the optional parameters for the SolutionsClient.List method. +type SolutionsClientListOptions struct { + // Ids of the resource. + IDs []string + // Maximum creation date of resource (inclusive). + MaxCreatedDateTime *time.Time + // Maximum last modified date of resource (inclusive). + MaxLastModifiedDateTime *time.Time + // Maximum number of items needed (inclusive). Minimum = 10, Maximum = 1000, Default value = 50. + MaxPageSize *int32 + // Minimum creation date of resource (inclusive). + MinCreatedDateTime *time.Time + // Minimum last modified date of resource (inclusive). + MinLastModifiedDateTime *time.Time + // Names of the resource. + Names []string + // Filters on key-value pairs within the Properties object. eg. "{testKey} eq {testValue}". + PropertyFilters []string + // Skip token for getting next set of results. + SkipToken *string + // Installed Solution ids. + SolutionIDs []string + // Statuses of the resource. + Statuses []string +} + +// SolutionsDiscoverabilityClientGetOptions contains the optional parameters for the SolutionsDiscoverabilityClient.Get method. +type SolutionsDiscoverabilityClientGetOptions struct { + // placeholder for future optional parameters +} + +// SolutionsDiscoverabilityClientListOptions contains the optional parameters for the SolutionsDiscoverabilityClient.List +// method. +type SolutionsDiscoverabilityClientListOptions struct { + // Ids of Data Manager For Agriculture Solutions which the customer requests to fetch. + FarmBeatsSolutionIDs []string + // Names of Data Manager For Agriculture Solutions which the customer requests to fetch. + FarmBeatsSolutionNames []string + // Maximum number of items needed (inclusive). Minimum = 10, Maximum = 1000, Default value = 50. + MaxPageSize *int32 +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -649,7 +1023,7 @@ type TrackedResource struct { // Resource tags. Tags map[string]*string `json:"tags,omitempty"` - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string `json:"id,omitempty" azure:"ro"` // READ-ONLY; The name of the resource diff --git a/sdk/resourcemanager/agrifood/armagrifood/models_serde.go b/sdk/resourcemanager/agrifood/armagrifood/models_serde.go index 326a0a2fa94d..820f09270c90 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/models_serde.go +++ b/sdk/resourcemanager/agrifood/armagrifood/models_serde.go @@ -16,9 +16,68 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type APIKeyAuthCredentials. +func (a APIKeyAuthCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiKey", a.APIKey) + objectMap["kind"] = AuthCredentialsKindAPIKeyAuthCredentials + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIKeyAuthCredentials. +func (a *APIKeyAuthCredentials) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiKey": + err = unpopulate(val, "APIKey", &a.APIKey) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type APIProperties. +func (a APIProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiFreshnessTimeInMinutes", a.APIFreshnessTimeInMinutes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIProperties. +func (a *APIProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiFreshnessTimeInMinutes": + err = unpopulate(val, "APIFreshnessTimeInMinutes", &a.APIFreshnessTimeInMinutes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ArmAsyncOperation. func (a ArmAsyncOperation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "error", a.Error) populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } @@ -32,6 +91,9 @@ func (a *ArmAsyncOperation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "error": + err = unpopulate(val, "Error", &a.Error) + delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) @@ -43,6 +105,64 @@ func (a *ArmAsyncOperation) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ArmAsyncOperationError. +func (a ArmAsyncOperationError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", a.Code) + populate(objectMap, "message", a.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmAsyncOperationError. +func (a *ArmAsyncOperationError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthCredentials. +func (a AuthCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = a.Kind + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthCredentials. +func (a *AuthCredentials) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest. func (c CheckNameAvailabilityRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) @@ -109,19 +229,20 @@ func (c *CheckNameAvailabilityResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DetailedInformation. -func (d DetailedInformation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataConnector. +func (d DataConnector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "apiInputParameters", d.APIInputParameters) - populate(objectMap, "apiName", d.APIName) - populate(objectMap, "customParameters", d.CustomParameters) - populate(objectMap, "platformParameters", d.PlatformParameters) - populate(objectMap, "unitsSupported", d.UnitsSupported) + populate(objectMap, "eTag", d.ETag) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DetailedInformation. -func (d *DetailedInformation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnector. +func (d *DataConnector) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -129,20 +250,23 @@ func (d *DetailedInformation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "apiInputParameters": - err = unpopulate(val, "APIInputParameters", &d.APIInputParameters) + case "eTag": + err = unpopulate(val, "ETag", &d.ETag) delete(rawMsg, key) - case "apiName": - err = unpopulate(val, "APIName", &d.APIName) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "customParameters": - err = unpopulate(val, "CustomParameters", &d.CustomParameters) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "platformParameters": - err = unpopulate(val, "PlatformParameters", &d.PlatformParameters) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "unitsSupported": - err = unpopulate(val, "UnitsSupported", &d.UnitsSupported) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { @@ -152,219 +276,673 @@ func (d *DetailedInformation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataConnectorListResponse. +func (d DataConnectorListResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "info", &e.Info) - populate(objectMap, "type", e.Type) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectorListResponse. +func (d *DataConnectorListResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataConnectorProperties. +func (d DataConnectorProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) + populate(objectMap, "credentials", d.Credentials) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectorProperties. +func (d *DataConnectorProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "credentials": + d.Credentials, err = unmarshalAuthCredentialsClassification(val) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgriculture. +func (d DataManagerForAgriculture) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "error", e.Error) + populate(objectMap, "id", d.ID) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "tags", d.Tags) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgriculture. +func (d *DataManagerForAgriculture) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Extension. -func (e Extension) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgricultureExtension. +func (d DataManagerForAgricultureExtension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "eTag", e.ETag) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Extension. -func (e *Extension) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureExtension. +func (d *DataManagerForAgricultureExtension) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "eTag": - err = unpopulate(val, "ETag", &e.ETag) - delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &e.ID) + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &e.Name) + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &e.Properties) + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &e.SystemData) + err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExtensionListResponse. -func (e ExtensionListResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgricultureExtensionListResponse. +func (d DataManagerForAgricultureExtensionListResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "$skipToken", d.SkipToken) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionListResponse. -func (e *ExtensionListResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureExtensionListResponse. +func (d *DataManagerForAgricultureExtensionListResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "$skipToken": + err = unpopulate(val, "SkipToken", &d.SkipToken) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &e.Value) + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExtensionProperties. -func (e ExtensionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgricultureExtensionProperties. +func (d DataManagerForAgricultureExtensionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "extensionApiDocsLink", e.ExtensionAPIDocsLink) - populate(objectMap, "extensionAuthLink", e.ExtensionAuthLink) - populate(objectMap, "extensionCategory", e.ExtensionCategory) - populate(objectMap, "extensionId", e.ExtensionID) - populate(objectMap, "installedExtensionVersion", e.InstalledExtensionVersion) + populate(objectMap, "description", d.Description) + populate(objectMap, "detailedInformation", d.DetailedInformation) + populate(objectMap, "extensionApiDocsLink", d.ExtensionAPIDocsLink) + populate(objectMap, "extensionAuthLink", d.ExtensionAuthLink) + populate(objectMap, "extensionCategory", d.ExtensionCategory) + populate(objectMap, "farmBeatsExtensionId", d.FarmBeatsExtensionID) + populate(objectMap, "farmBeatsExtensionName", d.FarmBeatsExtensionName) + populate(objectMap, "farmBeatsExtensionVersion", d.FarmBeatsExtensionVersion) + populate(objectMap, "publisherId", d.PublisherID) + populate(objectMap, "targetResourceType", d.TargetResourceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionProperties. -func (e *ExtensionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureExtensionProperties. +func (d *DataManagerForAgricultureExtensionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "detailedInformation": + err = unpopulate(val, "DetailedInformation", &d.DetailedInformation) + delete(rawMsg, key) case "extensionApiDocsLink": - err = unpopulate(val, "ExtensionAPIDocsLink", &e.ExtensionAPIDocsLink) + err = unpopulate(val, "ExtensionAPIDocsLink", &d.ExtensionAPIDocsLink) + delete(rawMsg, key) + case "extensionAuthLink": + err = unpopulate(val, "ExtensionAuthLink", &d.ExtensionAuthLink) + delete(rawMsg, key) + case "extensionCategory": + err = unpopulate(val, "ExtensionCategory", &d.ExtensionCategory) + delete(rawMsg, key) + case "farmBeatsExtensionId": + err = unpopulate(val, "FarmBeatsExtensionID", &d.FarmBeatsExtensionID) + delete(rawMsg, key) + case "farmBeatsExtensionName": + err = unpopulate(val, "FarmBeatsExtensionName", &d.FarmBeatsExtensionName) + delete(rawMsg, key) + case "farmBeatsExtensionVersion": + err = unpopulate(val, "FarmBeatsExtensionVersion", &d.FarmBeatsExtensionVersion) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &d.PublisherID) + delete(rawMsg, key) + case "targetResourceType": + err = unpopulate(val, "TargetResourceType", &d.TargetResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgricultureListResponse. +func (d DataManagerForAgricultureListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "$skipToken", d.SkipToken) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureListResponse. +func (d *DataManagerForAgricultureListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "$skipToken": + err = unpopulate(val, "SkipToken", &d.SkipToken) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgricultureProperties. +func (d DataManagerForAgricultureProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "instanceUri", d.InstanceURI) + populate(objectMap, "privateEndpointConnections", d.PrivateEndpointConnections) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + populate(objectMap, "sensorIntegration", d.SensorIntegration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureProperties. +func (d *DataManagerForAgricultureProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceUri": + err = unpopulate(val, "InstanceURI", &d.InstanceURI) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &d.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + delete(rawMsg, key) + case "sensorIntegration": + err = unpopulate(val, "SensorIntegration", &d.SensorIntegration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgricultureSolution. +func (d DataManagerForAgricultureSolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureSolution. +func (d *DataManagerForAgricultureSolution) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgricultureSolutionListResponse. +func (d DataManagerForAgricultureSolutionListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "$skipToken", d.SkipToken) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureSolutionListResponse. +func (d *DataManagerForAgricultureSolutionListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "$skipToken": + err = unpopulate(val, "SkipToken", &d.SkipToken) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgricultureSolutionProperties. +func (d DataManagerForAgricultureSolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessFBApplicationId", d.AccessFBApplicationID) + populate(objectMap, "accessFBApplicationName", d.AccessFBApplicationName) + populate(objectMap, "actionIds", d.ActionIDs) + populate(objectMap, "dataAccessScopes", d.DataAccessScopes) + populate(objectMap, "marketplaceOfferDetails", d.MarketplaceOfferDetails) + populate(objectMap, "openApiSpecsDictionary", d.OpenAPISpecsDictionary) + populate(objectMap, "partnerId", d.PartnerID) + populate(objectMap, "partnerTenantId", d.PartnerTenantID) + populate(objectMap, "roleId", d.RoleID) + populate(objectMap, "roleName", d.RoleName) + populate(objectMap, "saaSApplicationId", d.SaaSApplicationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureSolutionProperties. +func (d *DataManagerForAgricultureSolutionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessFBApplicationId": + err = unpopulate(val, "AccessFBApplicationID", &d.AccessFBApplicationID) + delete(rawMsg, key) + case "accessFBApplicationName": + err = unpopulate(val, "AccessFBApplicationName", &d.AccessFBApplicationName) + delete(rawMsg, key) + case "actionIds": + err = unpopulate(val, "ActionIDs", &d.ActionIDs) + delete(rawMsg, key) + case "dataAccessScopes": + err = unpopulate(val, "DataAccessScopes", &d.DataAccessScopes) + delete(rawMsg, key) + case "marketplaceOfferDetails": + err = unpopulate(val, "MarketplaceOfferDetails", &d.MarketplaceOfferDetails) + delete(rawMsg, key) + case "openApiSpecsDictionary": + err = unpopulate(val, "OpenAPISpecsDictionary", &d.OpenAPISpecsDictionary) + delete(rawMsg, key) + case "partnerId": + err = unpopulate(val, "PartnerID", &d.PartnerID) + delete(rawMsg, key) + case "partnerTenantId": + err = unpopulate(val, "PartnerTenantID", &d.PartnerTenantID) + delete(rawMsg, key) + case "roleId": + err = unpopulate(val, "RoleID", &d.RoleID) + delete(rawMsg, key) + case "roleName": + err = unpopulate(val, "RoleName", &d.RoleName) + delete(rawMsg, key) + case "saaSApplicationId": + err = unpopulate(val, "SaaSApplicationID", &d.SaaSApplicationID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgricultureUpdateProperties. +func (d DataManagerForAgricultureUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) + populate(objectMap, "sensorIntegration", d.SensorIntegration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureUpdateProperties. +func (d *DataManagerForAgricultureUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) + delete(rawMsg, key) + case "sensorIntegration": + err = unpopulate(val, "SensorIntegration", &d.SensorIntegration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataManagerForAgricultureUpdateRequestModel. +func (d DataManagerForAgricultureUpdateRequestModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", d.Identity) + populate(objectMap, "location", d.Location) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "tags", d.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureUpdateRequestModel. +func (d *DataManagerForAgricultureUpdateRequestModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &d.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &d.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DetailedInformation. +func (d DetailedInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "apiDefaultInputParameters", d.APIDefaultInputParameters) + populate(objectMap, "apiDocsLink", d.APIDocsLink) + populate(objectMap, "apiInputParameters", d.APIInputParameters) + populate(objectMap, "apiName", d.APIName) + populate(objectMap, "apiType", d.APIType) + populate(objectMap, "customParameters", d.CustomParameters) + populate(objectMap, "platformParameters", d.PlatformParameters) + populate(objectMap, "unitsSupported", d.UnitsSupported) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DetailedInformation. +func (d *DetailedInformation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "apiDefaultInputParameters": + err = unpopulate(val, "APIDefaultInputParameters", &d.APIDefaultInputParameters) + delete(rawMsg, key) + case "apiDocsLink": + err = unpopulate(val, "APIDocsLink", &d.APIDocsLink) + delete(rawMsg, key) + case "apiInputParameters": + err = unpopulate(val, "APIInputParameters", &d.APIInputParameters) + delete(rawMsg, key) + case "apiName": + err = unpopulate(val, "APIName", &d.APIName) + delete(rawMsg, key) + case "apiType": + err = unpopulate(val, "APIType", &d.APIType) + delete(rawMsg, key) + case "customParameters": + err = unpopulate(val, "CustomParameters", &d.CustomParameters) + delete(rawMsg, key) + case "platformParameters": + err = unpopulate(val, "PlatformParameters", &d.PlatformParameters) + delete(rawMsg, key) + case "unitsSupported": + err = unpopulate(val, "UnitsSupported", &d.UnitsSupported) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) delete(rawMsg, key) - case "extensionAuthLink": - err = unpopulate(val, "ExtensionAuthLink", &e.ExtensionAuthLink) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "extensionCategory": - err = unpopulate(val, "ExtensionCategory", &e.ExtensionCategory) + case "details": + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) - case "extensionId": - err = unpopulate(val, "ExtensionID", &e.ExtensionID) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) - case "installedExtensionVersion": - err = unpopulate(val, "InstalledExtensionVersion", &e.InstalledExtensionVersion) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { @@ -374,372 +952,324 @@ func (e *ExtensionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FarmBeats. -func (f FarmBeats) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "id", f.ID) - populate(objectMap, "identity", f.Identity) - populate(objectMap, "location", f.Location) - populate(objectMap, "name", f.Name) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "tags", f.Tags) - populate(objectMap, "type", f.Type) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FarmBeats. -func (f *FarmBeats) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &f.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &f.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &f.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &f.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &f.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &f.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &f.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &f.Type) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FarmBeatsExtension. -func (f FarmBeatsExtension) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Extension. +func (e Extension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "id", f.ID) - populate(objectMap, "name", f.Name) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "type", f.Type) + populate(objectMap, "eTag", e.ETag) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FarmBeatsExtension. -func (f *FarmBeatsExtension) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Extension. +func (e *Extension) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { + case "eTag": + err = unpopulate(val, "ETag", &e.ETag) + delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &f.ID) + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &f.Name) + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &f.Properties) + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &f.SystemData) + err = unpopulate(val, "SystemData", &e.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &f.Type) + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FarmBeatsExtensionListResponse. -func (f FarmBeatsExtensionListResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionInstallationRequest. +func (e ExtensionInstallationRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", f.NextLink) - populate(objectMap, "value", f.Value) + populate(objectMap, "additionalApiProperties", e.AdditionalAPIProperties) + populate(objectMap, "extensionVersion", e.ExtensionVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FarmBeatsExtensionListResponse. -func (f *FarmBeatsExtensionListResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionInstallationRequest. +func (e *ExtensionInstallationRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &f.NextLink) + case "additionalApiProperties": + err = unpopulate(val, "AdditionalAPIProperties", &e.AdditionalAPIProperties) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &f.Value) + case "extensionVersion": + err = unpopulate(val, "ExtensionVersion", &e.ExtensionVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FarmBeatsExtensionProperties. -func (f FarmBeatsExtensionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionListResponse. +func (e ExtensionListResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "description", f.Description) - populate(objectMap, "detailedInformation", f.DetailedInformation) - populate(objectMap, "extensionApiDocsLink", f.ExtensionAPIDocsLink) - populate(objectMap, "extensionAuthLink", f.ExtensionAuthLink) - populate(objectMap, "extensionCategory", f.ExtensionCategory) - populate(objectMap, "farmBeatsExtensionId", f.FarmBeatsExtensionID) - populate(objectMap, "farmBeatsExtensionName", f.FarmBeatsExtensionName) - populate(objectMap, "farmBeatsExtensionVersion", f.FarmBeatsExtensionVersion) - populate(objectMap, "publisherId", f.PublisherID) - populate(objectMap, "targetResourceType", f.TargetResourceType) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "$skipToken", e.SkipToken) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FarmBeatsExtensionProperties. -func (f *FarmBeatsExtensionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionListResponse. +func (e *ExtensionListResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "description": - err = unpopulate(val, "Description", &f.Description) - delete(rawMsg, key) - case "detailedInformation": - err = unpopulate(val, "DetailedInformation", &f.DetailedInformation) - delete(rawMsg, key) - case "extensionApiDocsLink": - err = unpopulate(val, "ExtensionAPIDocsLink", &f.ExtensionAPIDocsLink) - delete(rawMsg, key) - case "extensionAuthLink": - err = unpopulate(val, "ExtensionAuthLink", &f.ExtensionAuthLink) - delete(rawMsg, key) - case "extensionCategory": - err = unpopulate(val, "ExtensionCategory", &f.ExtensionCategory) - delete(rawMsg, key) - case "farmBeatsExtensionId": - err = unpopulate(val, "FarmBeatsExtensionID", &f.FarmBeatsExtensionID) - delete(rawMsg, key) - case "farmBeatsExtensionName": - err = unpopulate(val, "FarmBeatsExtensionName", &f.FarmBeatsExtensionName) - delete(rawMsg, key) - case "farmBeatsExtensionVersion": - err = unpopulate(val, "FarmBeatsExtensionVersion", &f.FarmBeatsExtensionVersion) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) - case "publisherId": - err = unpopulate(val, "PublisherID", &f.PublisherID) + case "$skipToken": + err = unpopulate(val, "SkipToken", &e.SkipToken) delete(rawMsg, key) - case "targetResourceType": - err = unpopulate(val, "TargetResourceType", &f.TargetResourceType) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FarmBeatsListResponse. -func (f FarmBeatsListResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", f.NextLink) - populate(objectMap, "value", f.Value) + populate(objectMap, "additionalApiProperties", e.AdditionalAPIProperties) + populate(objectMap, "extensionApiDocsLink", e.ExtensionAPIDocsLink) + populate(objectMap, "extensionAuthLink", e.ExtensionAuthLink) + populate(objectMap, "extensionCategory", e.ExtensionCategory) + populate(objectMap, "extensionId", e.ExtensionID) + populate(objectMap, "installedExtensionVersion", e.InstalledExtensionVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FarmBeatsListResponse. -func (f *FarmBeatsListResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionProperties. +func (e *ExtensionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &f.NextLink) + case "additionalApiProperties": + err = unpopulate(val, "AdditionalAPIProperties", &e.AdditionalAPIProperties) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &f.Value) + case "extensionApiDocsLink": + err = unpopulate(val, "ExtensionAPIDocsLink", &e.ExtensionAPIDocsLink) + delete(rawMsg, key) + case "extensionAuthLink": + err = unpopulate(val, "ExtensionAuthLink", &e.ExtensionAuthLink) + delete(rawMsg, key) + case "extensionCategory": + err = unpopulate(val, "ExtensionCategory", &e.ExtensionCategory) + delete(rawMsg, key) + case "extensionId": + err = unpopulate(val, "ExtensionID", &e.ExtensionID) + delete(rawMsg, key) + case "installedExtensionVersion": + err = unpopulate(val, "InstalledExtensionVersion", &e.InstalledExtensionVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FarmBeatsProperties. -func (f FarmBeatsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "instanceUri", f.InstanceURI) - populate(objectMap, "privateEndpointConnections", f.PrivateEndpointConnections) - populate(objectMap, "provisioningState", f.ProvisioningState) - populate(objectMap, "publicNetworkAccess", f.PublicNetworkAccess) - populate(objectMap, "sensorIntegration", f.SensorIntegration) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + objectMap["type"] = "SystemAssigned" return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FarmBeatsProperties. -func (f *FarmBeatsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "instanceUri": - err = unpopulate(val, "InstanceURI", &f.InstanceURI) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &f.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &f.PublicNetworkAccess) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) delete(rawMsg, key) - case "sensorIntegration": - err = unpopulate(val, "SensorIntegration", &f.SensorIntegration) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FarmBeatsUpdateProperties. -func (f FarmBeatsUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. +func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "publicNetworkAccess", f.PublicNetworkAccess) - populate(objectMap, "sensorIntegration", f.SensorIntegration) + populate(objectMap, "keyName", k.KeyName) + populate(objectMap, "keyVaultUri", k.KeyVaultURI) + populate(objectMap, "keyVersion", k.KeyVersion) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FarmBeatsUpdateProperties. -func (f *FarmBeatsUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultProperties. +func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } for key, val := range rawMsg { var err error switch key { - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &f.PublicNetworkAccess) + case "keyName": + err = unpopulate(val, "KeyName", &k.KeyName) delete(rawMsg, key) - case "sensorIntegration": - err = unpopulate(val, "SensorIntegration", &f.SensorIntegration) + case "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &k.KeyVaultURI) + delete(rawMsg, key) + case "keyVersion": + err = unpopulate(val, "KeyVersion", &k.KeyVersion) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", k, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FarmBeatsUpdateRequestModel. -func (f FarmBeatsUpdateRequestModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MarketplaceOfferDetails. +func (m MarketplaceOfferDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "identity", f.Identity) - populate(objectMap, "location", f.Location) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "tags", f.Tags) + populate(objectMap, "publisherId", m.PublisherID) + populate(objectMap, "saasOfferId", m.SaasOfferID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FarmBeatsUpdateRequestModel. -func (f *FarmBeatsUpdateRequestModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceOfferDetails. +func (m *MarketplaceOfferDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "identity": - err = unpopulate(val, "Identity", &f.Identity) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &f.Location) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &f.Properties) + case "publisherId": + err = unpopulate(val, "PublisherID", &m.PublisherID) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &f.Tags) + case "saasOfferId": + err = unpopulate(val, "SaasOfferID", &m.SaasOfferID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OAuthClientCredentials. +func (o OAuthClientCredentials) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - objectMap["type"] = "SystemAssigned" + populate(objectMap, "clientId", o.ClientID) + populate(objectMap, "clientSecret", o.ClientSecret) + objectMap["kind"] = AuthCredentialsKindOAuthClientCredentials return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. -func (i *Identity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OAuthClientCredentials. +func (o *OAuthClientCredentials) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) + case "clientId": + err = unpopulate(val, "ClientID", &o.ClientID) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) + case "clientSecret": + err = unpopulate(val, "ClientSecret", &o.ClientSecret) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) + case "kind": + err = unpopulate(val, "Kind", &o.Kind) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil @@ -958,6 +1488,7 @@ func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", p.GroupIDs) populate(objectMap, "privateEndpoint", p.PrivateEndpoint) populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) populate(objectMap, "provisioningState", p.ProvisioningState) @@ -973,6 +1504,9 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) case "privateEndpoint": err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) delete(rawMsg, key) @@ -1243,6 +1777,158 @@ func (s *SensorIntegration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Solution. +func (s Solution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eTag", s.ETag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Solution. +func (s *Solution) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eTag": + err = unpopulate(val, "ETag", &s.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SolutionListResponse. +func (s SolutionListResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "$skipToken", s.SkipToken) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionListResponse. +func (s *SolutionListResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "$skipToken": + err = unpopulate(val, "SkipToken", &s.SkipToken) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SolutionProperties. +func (s SolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "marketplacePublisherId", s.MarketplacePublisherID) + populate(objectMap, "offerId", s.OfferID) + populate(objectMap, "partnerId", s.PartnerID) + populate(objectMap, "planId", s.PlanID) + populate(objectMap, "roleAssignmentId", s.RoleAssignmentID) + populate(objectMap, "saasSubscriptionId", s.SaasSubscriptionID) + populate(objectMap, "saasSubscriptionName", s.SaasSubscriptionName) + populate(objectMap, "termId", s.TermID) + if s.AdditionalProperties != nil { + for key, val := range s.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionProperties. +func (s *SolutionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "marketplacePublisherId": + err = unpopulate(val, "MarketplacePublisherID", &s.MarketplacePublisherID) + delete(rawMsg, key) + case "offerId": + err = unpopulate(val, "OfferID", &s.OfferID) + delete(rawMsg, key) + case "partnerId": + err = unpopulate(val, "PartnerID", &s.PartnerID) + delete(rawMsg, key) + case "planId": + err = unpopulate(val, "PlanID", &s.PlanID) + delete(rawMsg, key) + case "roleAssignmentId": + err = unpopulate(val, "RoleAssignmentID", &s.RoleAssignmentID) + delete(rawMsg, key) + case "saasSubscriptionId": + err = unpopulate(val, "SaasSubscriptionID", &s.SaasSubscriptionID) + delete(rawMsg, key) + case "saasSubscriptionName": + err = unpopulate(val, "SaasSubscriptionName", &s.SaasSubscriptionName) + delete(rawMsg, key) + case "termId": + err = unpopulate(val, "TermID", &s.TermID) + delete(rawMsg, key) + default: + if s.AdditionalProperties == nil { + s.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + s.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) diff --git a/sdk/resourcemanager/agrifood/armagrifood/operationresults_client.go b/sdk/resourcemanager/agrifood/armagrifood/operationresults_client.go new file mode 100644 index 000000000000..f63337b88f79 --- /dev/null +++ b/sdk/resourcemanager/agrifood/armagrifood/operationresults_client.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armagrifood + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// OperationResultsClient contains the methods for the OperationResults group. +// Don't use this type directly, use NewOperationResultsClient() instead. +type OperationResultsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewOperationResultsClient creates a new instance of OperationResultsClient 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 NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationResultsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get operationResults for a Data Manager For Agriculture resource. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// locations - Location. +// operationResultsID - operationResultsId for a specific location. +// options - OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +func (client *OperationResultsClient) Get(ctx context.Context, locations string, operationResultsID string, options *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, locations, operationResultsID, options) + if err != nil { + return OperationResultsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationResultsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationResultsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OperationResultsClient) getCreateRequest(ctx context.Context, locations string, operationResultsID string, options *OperationResultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AgFoodPlatform/locations/{locations}/operationResults/{operationResultsId}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locations == "" { + return nil, errors.New("parameter locations cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locations}", url.PathEscape(locations)) + if operationResultsID == "" { + return nil, errors.New("parameter operationResultsID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationResultsId}", url.PathEscape(operationResultsID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OperationResultsClient) getHandleResponse(resp *http.Response) (OperationResultsClientGetResponse, error) { + result := OperationResultsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArmAsyncOperation); err != nil { + return OperationResultsClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/agrifood/armagrifood/operations_client.go b/sdk/resourcemanager/agrifood/armagrifood/operations_client.go index 3fe73a901ce5..3306cc150d49 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/operations_client.go +++ b/sdk/resourcemanager/agrifood/armagrifood/operations_client.go @@ -50,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists the available operations of Microsoft.AgFoodPlatform resource provider. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2023-06-01-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -89,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/agrifood/armagrifood/operations_client_example_test.go b/sdk/resourcemanager/agrifood/armagrifood/operations_client_example_test.go deleted file mode 100644 index 2d2d12b630e6..000000000000 --- a/sdk/resourcemanager/agrifood/armagrifood/operations_client_example_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armagrifood_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agrifood/armagrifood" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/agrifood/armagrifood/polymorphic_helpers.go b/sdk/resourcemanager/agrifood/armagrifood/polymorphic_helpers.go new file mode 100644 index 000000000000..0e13612323a1 --- /dev/null +++ b/sdk/resourcemanager/agrifood/armagrifood/polymorphic_helpers.go @@ -0,0 +1,32 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armagrifood + +import "encoding/json" + +func unmarshalAuthCredentialsClassification(rawMsg json.RawMessage) (AuthCredentialsClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AuthCredentialsClassification + switch m["kind"] { + case string(AuthCredentialsKindAPIKeyAuthCredentials): + b = &APIKeyAuthCredentials{} + case string(AuthCredentialsKindOAuthClientCredentials): + b = &OAuthClientCredentials{} + default: + b = &AuthCredentials{} + } + return b, json.Unmarshal(rawMsg, b) +} diff --git a/sdk/resourcemanager/agrifood/armagrifood/privateendpointconnections_client.go b/sdk/resourcemanager/agrifood/armagrifood/privateendpointconnections_client.go index eab5a3e7361e..a71e2b597b49 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/privateendpointconnections_client.go +++ b/sdk/resourcemanager/agrifood/armagrifood/privateendpointconnections_client.go @@ -32,7 +32,7 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// subscriptionID - The ID of the target subscription. +// 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 NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { @@ -57,15 +57,15 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // CreateOrUpdate - Approves or Rejects a Private endpoint connection request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2023-06-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. // privateEndpointConnectionName - Private endpoint connection name. -// body - Request object. +// request - Request object. // options - PrivateEndpointConnectionsClientCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.CreateOrUpdate // method. -func (client *PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, privateEndpointConnectionName string, body PrivateEndpointConnection, options *PrivateEndpointConnectionsClientCreateOrUpdateOptions) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, privateEndpointConnectionName, body, options) +func (client *PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, privateEndpointConnectionName string, request PrivateEndpointConnection, options *PrivateEndpointConnectionsClientCreateOrUpdateOptions) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, privateEndpointConnectionName, request, options) if err != nil { return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, err } @@ -80,20 +80,17 @@ func (client *PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Conte } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, privateEndpointConnectionName string, body PrivateEndpointConnection, options *PrivateEndpointConnectionsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, privateEndpointConnectionName string, request PrivateEndpointConnection, options *PrivateEndpointConnectionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) if privateEndpointConnectionName == "" { return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } @@ -103,10 +100,10 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, body) + return req, runtime.MarshalAsJSON(req, request) } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -120,20 +117,20 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(res // BeginDelete - Delete Private endpoint connection request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2023-06-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. // privateEndpointConnectionName - Private endpoint connection name. // options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. -func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, farmBeatsResourceName, privateEndpointConnectionName, options) + resp, err := client.deleteOperation(ctx, resourceGroupName, dataManagerForAgricultureResourceName, privateEndpointConnectionName, options) if err != nil { return nil, err } return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) @@ -142,9 +139,9 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Delete Private endpoint connection request. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview -func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, privateEndpointConnectionName, options) +// Generated from API version 2023-06-01-preview +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, privateEndpointConnectionName, options) if err != nil { return nil, err } @@ -159,20 +156,17 @@ func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) if privateEndpointConnectionName == "" { return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } @@ -182,7 +176,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,14 +184,14 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get Private endpoint connection object. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2023-06-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. // privateEndpointConnectionName - Private endpoint connection name. // options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. -func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, privateEndpointConnectionName, options) +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -212,20 +206,17 @@ func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourc } // getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/privateEndpointConnections/{privateEndpointConnectionName}" 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) if privateEndpointConnectionName == "" { return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } @@ -235,7 +226,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -250,56 +241,46 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res return result, nil } -// NewListByResourcePager - Get list of Private endpoint connections. +// ListByResource - Get list of Private endpoint connections. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2023-06-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. // options - PrivateEndpointConnectionsClientListByResourceOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByResource // method. -func (client *PrivateEndpointConnectionsClient) NewListByResourcePager(resourceGroupName string, farmBeatsResourceName string, options *PrivateEndpointConnectionsClientListByResourceOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByResourceResponse]{ - More: func(page PrivateEndpointConnectionsClientListByResourceResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByResourceResponse) (PrivateEndpointConnectionsClientListByResourceResponse, error) { - req, err := client.listByResourceCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, options) - if err != nil { - return PrivateEndpointConnectionsClientListByResourceResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PrivateEndpointConnectionsClientListByResourceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientListByResourceResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceHandleResponse(resp) - }, - }) +func (client *PrivateEndpointConnectionsClient) ListByResource(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *PrivateEndpointConnectionsClientListByResourceOptions) (PrivateEndpointConnectionsClientListByResourceResponse, error) { + req, err := client.listByResourceCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, options) + if err != nil { + return PrivateEndpointConnectionsClientListByResourceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListByResourceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientListByResourceResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceHandleResponse(resp) } // listByResourceCreateRequest creates the ListByResource request. -func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, options *PrivateEndpointConnectionsClientListByResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateEndpointConnections" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *PrivateEndpointConnectionsClientListByResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/privateEndpointConnections" 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/agrifood/armagrifood/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/agrifood/armagrifood/privateendpointconnections_client_example_test.go deleted file mode 100644 index 2b3b711d881c..000000000000 --- a/sdk/resourcemanager/agrifood/armagrifood/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,108 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armagrifood_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agrifood/armagrifood" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateEndpointConnections_CreateOrUpdate.json -func ExamplePrivateEndpointConnectionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewPrivateEndpointConnectionsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, "examples-rg", "examples-farmbeatsResourceName", "privateEndpointConnectionName", armagrifood.PrivateEndpointConnection{ - Properties: &armagrifood.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armagrifood.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr(armagrifood.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewPrivateEndpointConnectionsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "examples-rg", "examples-farmbeatsResourceName", "privateEndpointConnectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateEndpointConnections_Delete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewPrivateEndpointConnectionsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "examples-rg", "examples-farmbeatsResourceName", "privateEndpointConnectionName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateEndpointConnections_ListByResource.json -func ExamplePrivateEndpointConnectionsClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewPrivateEndpointConnectionsClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourcePager("examples-rg", "examples-farmbeatsResourceName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/agrifood/armagrifood/privatelinkresources_client.go b/sdk/resourcemanager/agrifood/armagrifood/privatelinkresources_client.go index ee473cf6c2fd..57b87135759e 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/privatelinkresources_client.go +++ b/sdk/resourcemanager/agrifood/armagrifood/privatelinkresources_client.go @@ -32,7 +32,7 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// subscriptionID - The ID of the target subscription. +// 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 NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { @@ -57,14 +57,14 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Get Private link resource object. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2023-06-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. // subResourceName - Sub resource name. // options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get // method. -func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, subResourceName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, subResourceName, options) +func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, subResourceName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, subResourceName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } @@ -79,20 +79,17 @@ func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, subResourceName string, options *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources/{subResourceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, subResourceName string, options *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/privateLinkResources/{subResourceName}" 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) if subResourceName == "" { return nil, errors.New("parameter subResourceName cannot be empty") } @@ -102,7 +99,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,56 +114,46 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) return result, nil } -// NewListByResourcePager - Get list of Private link resources. +// ListByResource - Get list of Private link resources. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-09-01-preview +// Generated from API version 2023-06-01-preview // resourceGroupName - The name of the resource group. The name is case insensitive. -// farmBeatsResourceName - FarmBeats resource name. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. // options - PrivateLinkResourcesClientListByResourceOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByResource // method. -func (client *PrivateLinkResourcesClient) NewListByResourcePager(resourceGroupName string, farmBeatsResourceName string, options *PrivateLinkResourcesClientListByResourceOptions) *runtime.Pager[PrivateLinkResourcesClientListByResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListByResourceResponse]{ - More: func(page PrivateLinkResourcesClientListByResourceResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListByResourceResponse) (PrivateLinkResourcesClientListByResourceResponse, error) { - req, err := client.listByResourceCreateRequest(ctx, resourceGroupName, farmBeatsResourceName, options) - if err != nil { - return PrivateLinkResourcesClientListByResourceResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PrivateLinkResourcesClientListByResourceResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientListByResourceResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceHandleResponse(resp) - }, - }) +func (client *PrivateLinkResourcesClient) ListByResource(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *PrivateLinkResourcesClientListByResourceOptions) (PrivateLinkResourcesClientListByResourceResponse, error) { + req, err := client.listByResourceCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, options) + if err != nil { + return PrivateLinkResourcesClientListByResourceResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesClientListByResourceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesClientListByResourceResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceHandleResponse(resp) } // listByResourceCreateRequest creates the ListByResource request. -func (client *PrivateLinkResourcesClient) listByResourceCreateRequest(ctx context.Context, resourceGroupName string, farmBeatsResourceName string, options *PrivateLinkResourcesClientListByResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{farmBeatsResourceName}/privateLinkResources" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *PrivateLinkResourcesClient) listByResourceCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *PrivateLinkResourcesClientListByResourceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/privateLinkResources" 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 farmBeatsResourceName == "" { - return nil, errors.New("parameter farmBeatsResourceName cannot be empty") + if dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{farmBeatsResourceName}", url.PathEscape(farmBeatsResourceName)) + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-09-01-preview") + reqQP.Set("api-version", "2023-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/agrifood/armagrifood/privatelinkresources_client_example_test.go b/sdk/resourcemanager/agrifood/armagrifood/privatelinkresources_client_example_test.go deleted file mode 100644 index b45c86d1a54e..000000000000 --- a/sdk/resourcemanager/agrifood/armagrifood/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,60 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armagrifood_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agrifood/armagrifood" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateLinkResources_ListByResource.json -func ExamplePrivateLinkResourcesClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewPrivateLinkResourcesClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourcePager("examples-rg", "examples-farmbeatsResourceName", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/agrifood/resource-manager/Microsoft.AgFoodPlatform/preview/2021-09-01-preview/examples/PrivateLinkResources_Get.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armagrifood.NewPrivateLinkResourcesClient("11111111-2222-3333-4444-555555555555", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "examples-rg", "examples-farmbeatsResourceName", "farmbeats", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/agrifood/armagrifood/response_types.go b/sdk/resourcemanager/agrifood/armagrifood/response_types.go index 08db51d71d0a..05e2568979c2 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/response_types.go +++ b/sdk/resourcemanager/agrifood/armagrifood/response_types.go @@ -9,79 +9,94 @@ package armagrifood -// ExtensionsClientCreateResponse contains the response from method ExtensionsClient.Create. -type ExtensionsClientCreateResponse struct { - Extension +// CheckNameAvailabilityClientCheckNameAvailabilityResponse contains the response from method CheckNameAvailabilityClient.CheckNameAvailability. +type CheckNameAvailabilityClientCheckNameAvailabilityResponse struct { + CheckNameAvailabilityResponse } -// ExtensionsClientDeleteResponse contains the response from method ExtensionsClient.Delete. -type ExtensionsClientDeleteResponse struct { - // placeholder for future response values +// DataConnectorsClientCreateOrUpdateResponse contains the response from method DataConnectorsClient.CreateOrUpdate. +type DataConnectorsClientCreateOrUpdateResponse struct { + DataConnector } -// ExtensionsClientGetResponse contains the response from method ExtensionsClient.Get. -type ExtensionsClientGetResponse struct { - Extension +// DataConnectorsClientDeleteResponse contains the response from method DataConnectorsClient.Delete. +type DataConnectorsClientDeleteResponse struct { + // placeholder for future response values } -// ExtensionsClientListByFarmBeatsResponse contains the response from method ExtensionsClient.ListByFarmBeats. -type ExtensionsClientListByFarmBeatsResponse struct { - ExtensionListResponse +// DataConnectorsClientGetResponse contains the response from method DataConnectorsClient.Get. +type DataConnectorsClientGetResponse struct { + DataConnector } -// ExtensionsClientUpdateResponse contains the response from method ExtensionsClient.Update. -type ExtensionsClientUpdateResponse struct { - Extension +// DataConnectorsClientListResponse contains the response from method DataConnectorsClient.List. +type DataConnectorsClientListResponse struct { + DataConnectorListResponse } -// FarmBeatsExtensionsClientGetResponse contains the response from method FarmBeatsExtensionsClient.Get. -type FarmBeatsExtensionsClientGetResponse struct { - FarmBeatsExtension +// DataManagerForAgricultureExtensionsClientGetResponse contains the response from method DataManagerForAgricultureExtensionsClient.Get. +type DataManagerForAgricultureExtensionsClientGetResponse struct { + DataManagerForAgricultureExtension } -// FarmBeatsExtensionsClientListResponse contains the response from method FarmBeatsExtensionsClient.List. -type FarmBeatsExtensionsClientListResponse struct { - FarmBeatsExtensionListResponse +// DataManagerForAgricultureExtensionsClientListResponse contains the response from method DataManagerForAgricultureExtensionsClient.List. +type DataManagerForAgricultureExtensionsClientListResponse struct { + DataManagerForAgricultureExtensionListResponse } -// FarmBeatsModelsClientCreateOrUpdateResponse contains the response from method FarmBeatsModelsClient.CreateOrUpdate. -type FarmBeatsModelsClientCreateOrUpdateResponse struct { - FarmBeats +// DataManagerForAgricultureResourcesClientCreateOrUpdateResponse contains the response from method DataManagerForAgricultureResourcesClient.CreateOrUpdate. +type DataManagerForAgricultureResourcesClientCreateOrUpdateResponse struct { + DataManagerForAgriculture } -// FarmBeatsModelsClientDeleteResponse contains the response from method FarmBeatsModelsClient.Delete. -type FarmBeatsModelsClientDeleteResponse struct { +// DataManagerForAgricultureResourcesClientDeleteResponse contains the response from method DataManagerForAgricultureResourcesClient.Delete. +type DataManagerForAgricultureResourcesClientDeleteResponse struct { // placeholder for future response values } -// FarmBeatsModelsClientGetOperationResultResponse contains the response from method FarmBeatsModelsClient.GetOperationResult. -type FarmBeatsModelsClientGetOperationResultResponse struct { - ArmAsyncOperation +// DataManagerForAgricultureResourcesClientGetResponse contains the response from method DataManagerForAgricultureResourcesClient.Get. +type DataManagerForAgricultureResourcesClientGetResponse struct { + DataManagerForAgriculture } -// FarmBeatsModelsClientGetResponse contains the response from method FarmBeatsModelsClient.Get. -type FarmBeatsModelsClientGetResponse struct { - FarmBeats +// DataManagerForAgricultureResourcesClientListByResourceGroupResponse contains the response from method DataManagerForAgricultureResourcesClient.ListByResourceGroup. +type DataManagerForAgricultureResourcesClientListByResourceGroupResponse struct { + DataManagerForAgricultureListResponse } -// FarmBeatsModelsClientListByResourceGroupResponse contains the response from method FarmBeatsModelsClient.ListByResourceGroup. -type FarmBeatsModelsClientListByResourceGroupResponse struct { - FarmBeatsListResponse +// DataManagerForAgricultureResourcesClientListBySubscriptionResponse contains the response from method DataManagerForAgricultureResourcesClient.ListBySubscription. +type DataManagerForAgricultureResourcesClientListBySubscriptionResponse struct { + DataManagerForAgricultureListResponse } -// FarmBeatsModelsClientListBySubscriptionResponse contains the response from method FarmBeatsModelsClient.ListBySubscription. -type FarmBeatsModelsClientListBySubscriptionResponse struct { - FarmBeatsListResponse +// DataManagerForAgricultureResourcesClientUpdateResponse contains the response from method DataManagerForAgricultureResourcesClient.Update. +type DataManagerForAgricultureResourcesClientUpdateResponse struct { + DataManagerForAgriculture } -// FarmBeatsModelsClientUpdateResponse contains the response from method FarmBeatsModelsClient.Update. -type FarmBeatsModelsClientUpdateResponse struct { - FarmBeats +// ExtensionsClientCreateOrUpdateResponse contains the response from method ExtensionsClient.CreateOrUpdate. +type ExtensionsClientCreateOrUpdateResponse struct { + Extension } -// LocationsClientCheckNameAvailabilityResponse contains the response from method LocationsClient.CheckNameAvailability. -type LocationsClientCheckNameAvailabilityResponse struct { - CheckNameAvailabilityResponse +// ExtensionsClientDeleteResponse contains the response from method ExtensionsClient.Delete. +type ExtensionsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExtensionsClientGetResponse contains the response from method ExtensionsClient.Get. +type ExtensionsClientGetResponse struct { + Extension +} + +// ExtensionsClientListByDataManagerForAgricultureResponse contains the response from method ExtensionsClient.ListByDataManagerForAgriculture. +type ExtensionsClientListByDataManagerForAgricultureResponse struct { + ExtensionListResponse +} + +// OperationResultsClientGetResponse contains the response from method OperationResultsClient.Get. +type OperationResultsClientGetResponse struct { + ArmAsyncOperation } // OperationsClientListResponse contains the response from method OperationsClient.List. @@ -118,3 +133,33 @@ type PrivateLinkResourcesClientGetResponse struct { type PrivateLinkResourcesClientListByResourceResponse struct { PrivateLinkResourceListResult } + +// SolutionsClientCreateOrUpdateResponse contains the response from method SolutionsClient.CreateOrUpdate. +type SolutionsClientCreateOrUpdateResponse struct { + Solution +} + +// SolutionsClientDeleteResponse contains the response from method SolutionsClient.Delete. +type SolutionsClientDeleteResponse struct { + // placeholder for future response values +} + +// SolutionsClientGetResponse contains the response from method SolutionsClient.Get. +type SolutionsClientGetResponse struct { + Solution +} + +// SolutionsClientListResponse contains the response from method SolutionsClient.List. +type SolutionsClientListResponse struct { + SolutionListResponse +} + +// SolutionsDiscoverabilityClientGetResponse contains the response from method SolutionsDiscoverabilityClient.Get. +type SolutionsDiscoverabilityClientGetResponse struct { + DataManagerForAgricultureSolution +} + +// SolutionsDiscoverabilityClientListResponse contains the response from method SolutionsDiscoverabilityClient.List. +type SolutionsDiscoverabilityClientListResponse struct { + DataManagerForAgricultureSolutionListResponse +} diff --git a/sdk/resourcemanager/agrifood/armagrifood/solutions_client.go b/sdk/resourcemanager/agrifood/armagrifood/solutions_client.go new file mode 100644 index 000000000000..a2f30af27f87 --- /dev/null +++ b/sdk/resourcemanager/agrifood/armagrifood/solutions_client.go @@ -0,0 +1,335 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armagrifood + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" + "time" +) + +// SolutionsClient contains the methods for the Solutions group. +// Don't use this type directly, use NewSolutionsClient() instead. +type SolutionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSolutionsClient creates a new instance of SolutionsClient 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 NewSolutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SolutionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Install Or Update Solution. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// solutionID - SolutionId for Data Manager For Agriculture Resource. +// options - SolutionsClientCreateOrUpdateOptions contains the optional parameters for the SolutionsClient.CreateOrUpdate +// method. +func (client *SolutionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, solutionID string, options *SolutionsClientCreateOrUpdateOptions) (SolutionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, solutionID, options) + if err != nil { + return SolutionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SolutionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return SolutionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SolutionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, solutionID string, options *SolutionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/solutions/{solutionId}" + 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 dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + if solutionID == "" { + return nil, errors.New("parameter solutionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionId}", url.PathEscape(solutionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.RequestBody != nil { + return req, runtime.MarshalAsJSON(req, *options.RequestBody) + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SolutionsClient) createOrUpdateHandleResponse(resp *http.Response) (SolutionsClientCreateOrUpdateResponse, error) { + result := SolutionsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Solution); err != nil { + return SolutionsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Uninstall Solution. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// solutionID - SolutionId for Data Manager For Agriculture Resource. +// options - SolutionsClientDeleteOptions contains the optional parameters for the SolutionsClient.Delete method. +func (client *SolutionsClient) Delete(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, solutionID string, options *SolutionsClientDeleteOptions) (SolutionsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, solutionID, options) + if err != nil { + return SolutionsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SolutionsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SolutionsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return SolutionsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SolutionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, solutionID string, options *SolutionsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/solutions/{solutionId}" + 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 dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + if solutionID == "" { + return nil, errors.New("parameter solutionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionId}", url.PathEscape(solutionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get installed Solution details by Solution id. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// solutionID - SolutionId for Data Manager For Agriculture Resource. +// options - SolutionsClientGetOptions contains the optional parameters for the SolutionsClient.Get method. +func (client *SolutionsClient) Get(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, solutionID string, options *SolutionsClientGetOptions) (SolutionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, solutionID, options) + if err != nil { + return SolutionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SolutionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SolutionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SolutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, solutionID string, options *SolutionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/solutions/{solutionId}" + 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 dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + if solutionID == "" { + return nil, errors.New("parameter solutionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{solutionId}", url.PathEscape(solutionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SolutionsClient) getHandleResponse(resp *http.Response) (SolutionsClientGetResponse, error) { + result := SolutionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Solution); err != nil { + return SolutionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get installed Solutions details. +// Generated from API version 2023-06-01-preview +// resourceGroupName - The name of the resource group. The name is case insensitive. +// dataManagerForAgricultureResourceName - DataManagerForAgriculture resource name. +// options - SolutionsClientListOptions contains the optional parameters for the SolutionsClient.List method. +func (client *SolutionsClient) NewListPager(resourceGroupName string, dataManagerForAgricultureResourceName string, options *SolutionsClientListOptions) *runtime.Pager[SolutionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SolutionsClientListResponse]{ + More: func(page SolutionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SolutionsClientListResponse) (SolutionsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, dataManagerForAgricultureResourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SolutionsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SolutionsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SolutionsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SolutionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, dataManagerForAgricultureResourceName string, options *SolutionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgFoodPlatform/farmBeats/{dataManagerForAgricultureResourceName}/solutions" + 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 dataManagerForAgricultureResourceName == "" { + return nil, errors.New("parameter dataManagerForAgricultureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureResourceName}", url.PathEscape(dataManagerForAgricultureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + if options != nil && options.SolutionIDs != nil { + for _, qv := range options.SolutionIDs { + reqQP.Add("solutionIds", qv) + } + } + if options != nil && options.IDs != nil { + for _, qv := range options.IDs { + reqQP.Add("ids", qv) + } + } + if options != nil && options.Names != nil { + for _, qv := range options.Names { + reqQP.Add("names", qv) + } + } + if options != nil && options.PropertyFilters != nil { + for _, qv := range options.PropertyFilters { + reqQP.Add("propertyFilters", qv) + } + } + if options != nil && options.Statuses != nil { + for _, qv := range options.Statuses { + reqQP.Add("statuses", qv) + } + } + if options != nil && options.MinCreatedDateTime != nil { + reqQP.Set("minCreatedDateTime", options.MinCreatedDateTime.Format(time.RFC3339Nano)) + } + if options != nil && options.MaxCreatedDateTime != nil { + reqQP.Set("maxCreatedDateTime", options.MaxCreatedDateTime.Format(time.RFC3339Nano)) + } + if options != nil && options.MinLastModifiedDateTime != nil { + reqQP.Set("minLastModifiedDateTime", options.MinLastModifiedDateTime.Format(time.RFC3339Nano)) + } + if options != nil && options.MaxLastModifiedDateTime != nil { + reqQP.Set("maxLastModifiedDateTime", options.MaxLastModifiedDateTime.Format(time.RFC3339Nano)) + } + if options != nil && options.MaxPageSize != nil { + reqQP.Set("$maxPageSize", strconv.FormatInt(int64(*options.MaxPageSize), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SolutionsClient) listHandleResponse(resp *http.Response) (SolutionsClientListResponse, error) { + result := SolutionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SolutionListResponse); err != nil { + return SolutionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/agrifood/armagrifood/solutionsdiscoverability_client.go b/sdk/resourcemanager/agrifood/armagrifood/solutionsdiscoverability_client.go new file mode 100644 index 000000000000..c8ba696b7fef --- /dev/null +++ b/sdk/resourcemanager/agrifood/armagrifood/solutionsdiscoverability_client.go @@ -0,0 +1,170 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armagrifood + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// SolutionsDiscoverabilityClient contains the methods for the SolutionsDiscoverability group. +// Don't use this type directly, use NewSolutionsDiscoverabilityClient() instead. +type SolutionsDiscoverabilityClient struct { + host string + pl runtime.Pipeline +} + +// NewSolutionsDiscoverabilityClient creates a new instance of SolutionsDiscoverabilityClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSolutionsDiscoverabilityClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionsDiscoverabilityClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SolutionsDiscoverabilityClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get Data Manager For Agriculture solution by id. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-06-01-preview +// dataManagerForAgricultureSolutionID - dataManagerForAgricultureSolutionId to be queried. +// options - SolutionsDiscoverabilityClientGetOptions contains the optional parameters for the SolutionsDiscoverabilityClient.Get +// method. +func (client *SolutionsDiscoverabilityClient) Get(ctx context.Context, dataManagerForAgricultureSolutionID string, options *SolutionsDiscoverabilityClientGetOptions) (SolutionsDiscoverabilityClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, dataManagerForAgricultureSolutionID, options) + if err != nil { + return SolutionsDiscoverabilityClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SolutionsDiscoverabilityClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SolutionsDiscoverabilityClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SolutionsDiscoverabilityClient) getCreateRequest(ctx context.Context, dataManagerForAgricultureSolutionID string, options *SolutionsDiscoverabilityClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.AgFoodPlatform/farmBeatsSolutionDefinitions/{dataManagerForAgricultureSolutionId}" + if dataManagerForAgricultureSolutionID == "" { + return nil, errors.New("parameter dataManagerForAgricultureSolutionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{dataManagerForAgricultureSolutionId}", url.PathEscape(dataManagerForAgricultureSolutionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SolutionsDiscoverabilityClient) getHandleResponse(resp *http.Response) (SolutionsDiscoverabilityClientGetResponse, error) { + result := SolutionsDiscoverabilityClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataManagerForAgricultureSolution); err != nil { + return SolutionsDiscoverabilityClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get list of Data Manager For Agriculture solutions. +// Generated from API version 2023-06-01-preview +// options - SolutionsDiscoverabilityClientListOptions contains the optional parameters for the SolutionsDiscoverabilityClient.List +// method. +func (client *SolutionsDiscoverabilityClient) NewListPager(options *SolutionsDiscoverabilityClientListOptions) *runtime.Pager[SolutionsDiscoverabilityClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SolutionsDiscoverabilityClientListResponse]{ + More: func(page SolutionsDiscoverabilityClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SolutionsDiscoverabilityClientListResponse) (SolutionsDiscoverabilityClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return SolutionsDiscoverabilityClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SolutionsDiscoverabilityClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SolutionsDiscoverabilityClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SolutionsDiscoverabilityClient) listCreateRequest(ctx context.Context, options *SolutionsDiscoverabilityClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.AgFoodPlatform/farmBeatsSolutionDefinitions" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.FarmBeatsSolutionIDs != nil { + for _, qv := range options.FarmBeatsSolutionIDs { + reqQP.Add("farmBeatsSolutionIds", qv) + } + } + if options != nil && options.FarmBeatsSolutionNames != nil { + for _, qv := range options.FarmBeatsSolutionNames { + reqQP.Add("farmBeatsSolutionNames", qv) + } + } + if options != nil && options.MaxPageSize != nil { + reqQP.Set("$maxPageSize", strconv.FormatInt(int64(*options.MaxPageSize), 10)) + } + reqQP.Set("api-version", "2023-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SolutionsDiscoverabilityClient) listHandleResponse(resp *http.Response) (SolutionsDiscoverabilityClientListResponse, error) { + result := SolutionsDiscoverabilityClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DataManagerForAgricultureSolutionListResponse); err != nil { + return SolutionsDiscoverabilityClientListResponse{}, err + } + return result, nil +}