From 25815e9ca1f12777706ace664c74145ddaf5c214 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 5 Nov 2023 12:30:18 +0000 Subject: [PATCH] CodeGen from PR 26530 in Azure/azure-rest-api-specs update azureintegrationspaces readme.go.md (#26530) --- .../armintegrationspaces/CHANGELOG.md | 7 + .../armintegrationspaces/LICENSE.txt | 21 + .../armintegrationspaces/README.md | 85 + .../applicationresources_client.go | 429 +++++ .../applications_client.go | 727 ++++++++ .../armintegrationspaces/autorest.md | 13 + .../armintegrationspaces/build.go | 7 + .../businessprocesses_client.go | 427 +++++ .../businessprocessversions_client.go | 228 +++ .../armintegrationspaces/ci.yml | 28 + .../armintegrationspaces/client_factory.go | 73 + .../armintegrationspaces/constants.go | 96 + .../armintegrationspaces/go.mod | 13 + .../armintegrationspaces/go.sum | 15 + .../infrastructureresources_client.go | 404 ++++ .../armintegrationspaces/models.go | 582 ++++++ .../armintegrationspaces/models_serde.go | 1643 +++++++++++++++++ .../armintegrationspaces/operations_client.go | 93 + .../armintegrationspaces/options.go | 309 ++++ .../armintegrationspaces/response_types.go | 206 +++ .../armintegrationspaces/spaces_client.go | 435 +++++ .../armintegrationspaces/time_rfc3339.go | 86 + 22 files changed, 5927 insertions(+) create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/CHANGELOG.md create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/LICENSE.txt create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/README.md create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/applicationresources_client.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/applications_client.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/autorest.md create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/build.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/businessprocesses_client.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/businessprocessversions_client.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/ci.yml create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/client_factory.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/constants.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/go.mod create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/go.sum create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/infrastructureresources_client.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/models.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/models_serde.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/operations_client.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/options.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/response_types.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/spaces_client.go create mode 100644 sdk/resourcemanager/integrationspaces/armintegrationspaces/time_rfc3339.go diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/CHANGELOG.md b/sdk/resourcemanager/integrationspaces/armintegrationspaces/CHANGELOG.md new file mode 100644 index 000000000000..87ff1e85c16f --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2023-11-05) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/integrationspaces/armintegrationspaces` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/LICENSE.txt b/sdk/resourcemanager/integrationspaces/armintegrationspaces/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/README.md b/sdk/resourcemanager/integrationspaces/armintegrationspaces/README.md new file mode 100644 index 000000000000..bf815eaadb0c --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/README.md @@ -0,0 +1,85 @@ +# Azure Integrationspaces Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/integrationspaces/armintegrationspaces)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/integrationspaces/armintegrationspaces) + +The `armintegrationspaces` module provides operations for working with Azure Integrationspaces. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/integrationspaces/armintegrationspaces) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Integrationspaces module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/integrationspaces/armintegrationspaces +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Integrationspaces. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Integrationspaces module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armintegrationspaces.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armintegrationspaces.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewBusinessProcessVersionsClient() +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Integrationspaces` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/applicationresources_client.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/applicationresources_client.go new file mode 100644 index 000000000000..b630ac819b03 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/applicationresources_client.go @@ -0,0 +1,429 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ApplicationResourcesClient contains the methods for the ApplicationResources group. +// Don't use this type directly, use NewApplicationResourcesClient() instead. +type ApplicationResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewApplicationResourcesClient creates a new instance of ApplicationResourcesClient 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 NewApplicationResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationResourcesClient, error) { + cl, err := arm.NewClient(moduleName+".ApplicationResourcesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ApplicationResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a ApplicationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - resourceName - The name of the application resource. +// - resource - Resource create parameters. +// - options - ApplicationResourcesClientCreateOrUpdateOptions contains the optional parameters for the ApplicationResourcesClient.CreateOrUpdate +// method. +func (client *ApplicationResourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, resourceName string, resource ApplicationResource, options *ApplicationResourcesClientCreateOrUpdateOptions) (ApplicationResourcesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, spaceName, applicationName, resourceName, resource, options) + if err != nil { + return ApplicationResourcesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationResourcesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ApplicationResourcesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ApplicationResourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, resourceName string, resource ApplicationResource, options *ApplicationResourcesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ApplicationResourcesClient) createOrUpdateHandleResponse(resp *http.Response) (ApplicationResourcesClientCreateOrUpdateResponse, error) { + result := ApplicationResourcesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationResource); err != nil { + return ApplicationResourcesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a ApplicationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - resourceName - The name of the application resource. +// - options - ApplicationResourcesClientDeleteOptions contains the optional parameters for the ApplicationResourcesClient.Delete +// method. +func (client *ApplicationResourcesClient) Delete(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, resourceName string, options *ApplicationResourcesClientDeleteOptions) (ApplicationResourcesClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, spaceName, applicationName, resourceName, options) + if err != nil { + return ApplicationResourcesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationResourcesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ApplicationResourcesClientDeleteResponse{}, err + } + return ApplicationResourcesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ApplicationResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, resourceName string, options *ApplicationResourcesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a ApplicationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - resourceName - The name of the application resource. +// - options - ApplicationResourcesClientGetOptions contains the optional parameters for the ApplicationResourcesClient.Get +// method. +func (client *ApplicationResourcesClient) Get(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, resourceName string, options *ApplicationResourcesClientGetOptions) (ApplicationResourcesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, spaceName, applicationName, resourceName, options) + if err != nil { + return ApplicationResourcesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationResourcesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ApplicationResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, resourceName string, options *ApplicationResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ApplicationResourcesClient) getHandleResponse(resp *http.Response) (ApplicationResourcesClientGetResponse, error) { + result := ApplicationResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationResource); err != nil { + return ApplicationResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListByApplicationPager - List ApplicationResource resources by Application +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - options - ApplicationResourcesClientListByApplicationOptions contains the optional parameters for the ApplicationResourcesClient.NewListByApplicationPager +// method. +func (client *ApplicationResourcesClient) NewListByApplicationPager(resourceGroupName string, spaceName string, applicationName string, options *ApplicationResourcesClientListByApplicationOptions) *runtime.Pager[ApplicationResourcesClientListByApplicationResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationResourcesClientListByApplicationResponse]{ + More: func(page ApplicationResourcesClientListByApplicationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationResourcesClientListByApplicationResponse) (ApplicationResourcesClientListByApplicationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByApplicationCreateRequest(ctx, resourceGroupName, spaceName, applicationName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationResourcesClientListByApplicationResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationResourcesClientListByApplicationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationResourcesClientListByApplicationResponse{}, runtime.NewResponseError(resp) + } + return client.listByApplicationHandleResponse(resp) + }, + }) +} + +// listByApplicationCreateRequest creates the ListByApplication request. +func (client *ApplicationResourcesClient) listByApplicationCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, options *ApplicationResourcesClientListByApplicationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Maxpagesize != nil { + reqQP.Set("maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10)) + } + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Select != nil { + for _, qv := range options.Select { + reqQP.Add("select", qv) + } + } + if options != nil && options.Expand != nil { + for _, qv := range options.Expand { + reqQP.Add("expand", qv) + } + } + if options != nil && options.Orderby != nil { + for _, qv := range options.Orderby { + reqQP.Add("orderby", qv) + } + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByApplicationHandleResponse handles the ListByApplication response. +func (client *ApplicationResourcesClient) listByApplicationHandleResponse(resp *http.Response) (ApplicationResourcesClientListByApplicationResponse, error) { + result := ApplicationResourcesClientListByApplicationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationResourceListResult); err != nil { + return ApplicationResourcesClientListByApplicationResponse{}, err + } + return result, nil +} + +// Patch - Update a ApplicationResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - resourceName - The name of the application resource. +// - properties - The resource properties to be updated. +// - options - ApplicationResourcesClientPatchOptions contains the optional parameters for the ApplicationResourcesClient.Patch +// method. +func (client *ApplicationResourcesClient) Patch(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, resourceName string, properties ApplicationResourceUpdate, options *ApplicationResourcesClientPatchOptions) (ApplicationResourcesClientPatchResponse, error) { + var err error + req, err := client.patchCreateRequest(ctx, resourceGroupName, spaceName, applicationName, resourceName, properties, options) + if err != nil { + return ApplicationResourcesClientPatchResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationResourcesClientPatchResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationResourcesClientPatchResponse{}, err + } + resp, err := client.patchHandleResponse(httpResp) + return resp, err +} + +// patchCreateRequest creates the Patch request. +func (client *ApplicationResourcesClient) patchCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, resourceName string, properties ApplicationResourceUpdate, options *ApplicationResourcesClientPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/resources/{resourceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// patchHandleResponse handles the Patch response. +func (client *ApplicationResourcesClient) patchHandleResponse(resp *http.Response) (ApplicationResourcesClientPatchResponse, error) { + result := ApplicationResourcesClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationResource); err != nil { + return ApplicationResourcesClientPatchResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/applications_client.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/applications_client.go new file mode 100644 index 000000000000..d9195b0c7f7f --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/applications_client.go @@ -0,0 +1,727 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ApplicationsClient contains the methods for the Applications group. +// Don't use this type directly, use NewApplicationsClient() instead. +type ApplicationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewApplicationsClient creates a new instance of ApplicationsClient 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 NewApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationsClient, error) { + cl, err := arm.NewClient(moduleName+".ApplicationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ApplicationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a Application +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - resource - Resource create parameters. +// - options - ApplicationsClientCreateOrUpdateOptions contains the optional parameters for the ApplicationsClient.CreateOrUpdate +// method. +func (client *ApplicationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, resource Application, options *ApplicationsClientCreateOrUpdateOptions) (ApplicationsClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, spaceName, applicationName, resource, options) + if err != nil { + return ApplicationsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ApplicationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, resource Application, options *ApplicationsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ApplicationsClient) createOrUpdateHandleResponse(resp *http.Response) (ApplicationsClientCreateOrUpdateResponse, error) { + result := ApplicationsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { + return ApplicationsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Application +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - options - ApplicationsClientDeleteOptions contains the optional parameters for the ApplicationsClient.Delete method. +func (client *ApplicationsClient) Delete(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, options *ApplicationsClientDeleteOptions) (ApplicationsClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, spaceName, applicationName, options) + if err != nil { + return ApplicationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientDeleteResponse{}, err + } + return ApplicationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, options *ApplicationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// DeleteBusinessProcessDevelopmentArtifact - The delete business process development artifact action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - body - The content of the action request +// - options - ApplicationsClientDeleteBusinessProcessDevelopmentArtifactOptions contains the optional parameters for the ApplicationsClient.DeleteBusinessProcessDevelopmentArtifact +// method. +func (client *ApplicationsClient) DeleteBusinessProcessDevelopmentArtifact(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, body GetOrDeleteBusinessProcessDevelopmentArtifactRequest, options *ApplicationsClientDeleteBusinessProcessDevelopmentArtifactOptions) (ApplicationsClientDeleteBusinessProcessDevelopmentArtifactResponse, error) { + var err error + req, err := client.deleteBusinessProcessDevelopmentArtifactCreateRequest(ctx, resourceGroupName, spaceName, applicationName, body, options) + if err != nil { + return ApplicationsClientDeleteBusinessProcessDevelopmentArtifactResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientDeleteBusinessProcessDevelopmentArtifactResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientDeleteBusinessProcessDevelopmentArtifactResponse{}, err + } + return ApplicationsClientDeleteBusinessProcessDevelopmentArtifactResponse{}, nil +} + +// deleteBusinessProcessDevelopmentArtifactCreateRequest creates the DeleteBusinessProcessDevelopmentArtifact request. +func (client *ApplicationsClient) deleteBusinessProcessDevelopmentArtifactCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, body GetOrDeleteBusinessProcessDevelopmentArtifactRequest, options *ApplicationsClientDeleteBusinessProcessDevelopmentArtifactOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/deleteBusinessProcessDevelopmentArtifact" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// Get - Get a Application +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - options - ApplicationsClientGetOptions contains the optional parameters for the ApplicationsClient.Get method. +func (client *ApplicationsClient) Get(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, options *ApplicationsClientGetOptions) (ApplicationsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, spaceName, applicationName, options) + if err != nil { + return ApplicationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ApplicationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, options *ApplicationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ApplicationsClient) getHandleResponse(resp *http.Response) (ApplicationsClientGetResponse, error) { + result := ApplicationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { + return ApplicationsClientGetResponse{}, err + } + return result, nil +} + +// GetBusinessProcessDevelopmentArtifact - The get business process development artifact action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - body - The content of the action request +// - options - ApplicationsClientGetBusinessProcessDevelopmentArtifactOptions contains the optional parameters for the ApplicationsClient.GetBusinessProcessDevelopmentArtifact +// method. +func (client *ApplicationsClient) GetBusinessProcessDevelopmentArtifact(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, body GetOrDeleteBusinessProcessDevelopmentArtifactRequest, options *ApplicationsClientGetBusinessProcessDevelopmentArtifactOptions) (ApplicationsClientGetBusinessProcessDevelopmentArtifactResponse, error) { + var err error + req, err := client.getBusinessProcessDevelopmentArtifactCreateRequest(ctx, resourceGroupName, spaceName, applicationName, body, options) + if err != nil { + return ApplicationsClientGetBusinessProcessDevelopmentArtifactResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientGetBusinessProcessDevelopmentArtifactResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientGetBusinessProcessDevelopmentArtifactResponse{}, err + } + resp, err := client.getBusinessProcessDevelopmentArtifactHandleResponse(httpResp) + return resp, err +} + +// getBusinessProcessDevelopmentArtifactCreateRequest creates the GetBusinessProcessDevelopmentArtifact request. +func (client *ApplicationsClient) getBusinessProcessDevelopmentArtifactCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, body GetOrDeleteBusinessProcessDevelopmentArtifactRequest, options *ApplicationsClientGetBusinessProcessDevelopmentArtifactOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/getBusinessProcessDevelopmentArtifact" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// getBusinessProcessDevelopmentArtifactHandleResponse handles the GetBusinessProcessDevelopmentArtifact response. +func (client *ApplicationsClient) getBusinessProcessDevelopmentArtifactHandleResponse(resp *http.Response) (ApplicationsClientGetBusinessProcessDevelopmentArtifactResponse, error) { + result := ApplicationsClientGetBusinessProcessDevelopmentArtifactResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SaveOrGetBusinessProcessDevelopmentArtifactResponse); err != nil { + return ApplicationsClientGetBusinessProcessDevelopmentArtifactResponse{}, err + } + return result, nil +} + +// ListBusinessProcessDevelopmentArtifacts - The list business process development artifacts action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - options - ApplicationsClientListBusinessProcessDevelopmentArtifactsOptions contains the optional parameters for the ApplicationsClient.ListBusinessProcessDevelopmentArtifacts +// method. +func (client *ApplicationsClient) ListBusinessProcessDevelopmentArtifacts(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, options *ApplicationsClientListBusinessProcessDevelopmentArtifactsOptions) (ApplicationsClientListBusinessProcessDevelopmentArtifactsResponse, error) { + var err error + req, err := client.listBusinessProcessDevelopmentArtifactsCreateRequest(ctx, resourceGroupName, spaceName, applicationName, options) + if err != nil { + return ApplicationsClientListBusinessProcessDevelopmentArtifactsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientListBusinessProcessDevelopmentArtifactsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientListBusinessProcessDevelopmentArtifactsResponse{}, err + } + resp, err := client.listBusinessProcessDevelopmentArtifactsHandleResponse(httpResp) + return resp, err +} + +// listBusinessProcessDevelopmentArtifactsCreateRequest creates the ListBusinessProcessDevelopmentArtifacts request. +func (client *ApplicationsClient) listBusinessProcessDevelopmentArtifactsCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, options *ApplicationsClientListBusinessProcessDevelopmentArtifactsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/listBusinessProcessDevelopmentArtifacts" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBusinessProcessDevelopmentArtifactsHandleResponse handles the ListBusinessProcessDevelopmentArtifacts response. +func (client *ApplicationsClient) listBusinessProcessDevelopmentArtifactsHandleResponse(resp *http.Response) (ApplicationsClientListBusinessProcessDevelopmentArtifactsResponse, error) { + result := ApplicationsClientListBusinessProcessDevelopmentArtifactsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListBusinessProcessDevelopmentArtifactsResponse); err != nil { + return ApplicationsClientListBusinessProcessDevelopmentArtifactsResponse{}, err + } + return result, nil +} + +// NewListBySpacePager - List Application resources by Space +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - options - ApplicationsClientListBySpaceOptions contains the optional parameters for the ApplicationsClient.NewListBySpacePager +// method. +func (client *ApplicationsClient) NewListBySpacePager(resourceGroupName string, spaceName string, options *ApplicationsClientListBySpaceOptions) *runtime.Pager[ApplicationsClientListBySpaceResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationsClientListBySpaceResponse]{ + More: func(page ApplicationsClientListBySpaceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationsClientListBySpaceResponse) (ApplicationsClientListBySpaceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySpaceCreateRequest(ctx, resourceGroupName, spaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationsClientListBySpaceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientListBySpaceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationsClientListBySpaceResponse{}, runtime.NewResponseError(resp) + } + return client.listBySpaceHandleResponse(resp) + }, + }) +} + +// listBySpaceCreateRequest creates the ListBySpace request. +func (client *ApplicationsClient) listBySpaceCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, options *ApplicationsClientListBySpaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Maxpagesize != nil { + reqQP.Set("maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10)) + } + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Select != nil { + for _, qv := range options.Select { + reqQP.Add("select", qv) + } + } + if options != nil && options.Expand != nil { + for _, qv := range options.Expand { + reqQP.Add("expand", qv) + } + } + if options != nil && options.Orderby != nil { + for _, qv := range options.Orderby { + reqQP.Add("orderby", qv) + } + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySpaceHandleResponse handles the ListBySpace response. +func (client *ApplicationsClient) listBySpaceHandleResponse(resp *http.Response) (ApplicationsClientListBySpaceResponse, error) { + result := ApplicationsClientListBySpaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationListResult); err != nil { + return ApplicationsClientListBySpaceResponse{}, err + } + return result, nil +} + +// Patch - Update a Application +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - properties - The resource properties to be updated. +// - options - ApplicationsClientPatchOptions contains the optional parameters for the ApplicationsClient.Patch method. +func (client *ApplicationsClient) Patch(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, properties ApplicationUpdate, options *ApplicationsClientPatchOptions) (ApplicationsClientPatchResponse, error) { + var err error + req, err := client.patchCreateRequest(ctx, resourceGroupName, spaceName, applicationName, properties, options) + if err != nil { + return ApplicationsClientPatchResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientPatchResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientPatchResponse{}, err + } + resp, err := client.patchHandleResponse(httpResp) + return resp, err +} + +// patchCreateRequest creates the Patch request. +func (client *ApplicationsClient) patchCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, properties ApplicationUpdate, options *ApplicationsClientPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// patchHandleResponse handles the Patch response. +func (client *ApplicationsClient) patchHandleResponse(resp *http.Response) (ApplicationsClientPatchResponse, error) { + result := ApplicationsClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { + return ApplicationsClientPatchResponse{}, err + } + return result, nil +} + +// SaveBusinessProcessDevelopmentArtifact - The save business process development artifact action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - body - The content of the action request +// - options - ApplicationsClientSaveBusinessProcessDevelopmentArtifactOptions contains the optional parameters for the ApplicationsClient.SaveBusinessProcessDevelopmentArtifact +// method. +func (client *ApplicationsClient) SaveBusinessProcessDevelopmentArtifact(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, body SaveOrValidateBusinessProcessDevelopmentArtifactRequest, options *ApplicationsClientSaveBusinessProcessDevelopmentArtifactOptions) (ApplicationsClientSaveBusinessProcessDevelopmentArtifactResponse, error) { + var err error + req, err := client.saveBusinessProcessDevelopmentArtifactCreateRequest(ctx, resourceGroupName, spaceName, applicationName, body, options) + if err != nil { + return ApplicationsClientSaveBusinessProcessDevelopmentArtifactResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientSaveBusinessProcessDevelopmentArtifactResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientSaveBusinessProcessDevelopmentArtifactResponse{}, err + } + resp, err := client.saveBusinessProcessDevelopmentArtifactHandleResponse(httpResp) + return resp, err +} + +// saveBusinessProcessDevelopmentArtifactCreateRequest creates the SaveBusinessProcessDevelopmentArtifact request. +func (client *ApplicationsClient) saveBusinessProcessDevelopmentArtifactCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, body SaveOrValidateBusinessProcessDevelopmentArtifactRequest, options *ApplicationsClientSaveBusinessProcessDevelopmentArtifactOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/saveBusinessProcessDevelopmentArtifact" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// saveBusinessProcessDevelopmentArtifactHandleResponse handles the SaveBusinessProcessDevelopmentArtifact response. +func (client *ApplicationsClient) saveBusinessProcessDevelopmentArtifactHandleResponse(resp *http.Response) (ApplicationsClientSaveBusinessProcessDevelopmentArtifactResponse, error) { + result := ApplicationsClientSaveBusinessProcessDevelopmentArtifactResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SaveOrGetBusinessProcessDevelopmentArtifactResponse); err != nil { + return ApplicationsClientSaveBusinessProcessDevelopmentArtifactResponse{}, err + } + return result, nil +} + +// ValidateBusinessProcessDevelopmentArtifact - The validate business process development artifact action. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - body - The content of the action request +// - options - ApplicationsClientValidateBusinessProcessDevelopmentArtifactOptions contains the optional parameters for the +// ApplicationsClient.ValidateBusinessProcessDevelopmentArtifact method. +func (client *ApplicationsClient) ValidateBusinessProcessDevelopmentArtifact(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, body SaveOrValidateBusinessProcessDevelopmentArtifactRequest, options *ApplicationsClientValidateBusinessProcessDevelopmentArtifactOptions) (ApplicationsClientValidateBusinessProcessDevelopmentArtifactResponse, error) { + var err error + req, err := client.validateBusinessProcessDevelopmentArtifactCreateRequest(ctx, resourceGroupName, spaceName, applicationName, body, options) + if err != nil { + return ApplicationsClientValidateBusinessProcessDevelopmentArtifactResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ApplicationsClientValidateBusinessProcessDevelopmentArtifactResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ApplicationsClientValidateBusinessProcessDevelopmentArtifactResponse{}, err + } + return ApplicationsClientValidateBusinessProcessDevelopmentArtifactResponse{}, nil +} + +// validateBusinessProcessDevelopmentArtifactCreateRequest creates the ValidateBusinessProcessDevelopmentArtifact request. +func (client *ApplicationsClient) validateBusinessProcessDevelopmentArtifactCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, body SaveOrValidateBusinessProcessDevelopmentArtifactRequest, options *ApplicationsClientValidateBusinessProcessDevelopmentArtifactOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/validateBusinessProcessDevelopmentArtifact" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/autorest.md b/sdk/resourcemanager/integrationspaces/armintegrationspaces/autorest.md new file mode 100644 index 000000000000..35f48d21fc94 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azureintegrationspaces/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azureintegrationspaces/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/build.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/build.go new file mode 100644 index 000000000000..e41829288ab8 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/integrationspaces/armintegrationspaces + +package armintegrationspaces diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/businessprocesses_client.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/businessprocesses_client.go new file mode 100644 index 000000000000..6a23dd61d44d --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/businessprocesses_client.go @@ -0,0 +1,427 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// BusinessProcessesClient contains the methods for the BusinessProcesses group. +// Don't use this type directly, use NewBusinessProcessesClient() instead. +type BusinessProcessesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBusinessProcessesClient creates a new instance of BusinessProcessesClient 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 NewBusinessProcessesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BusinessProcessesClient, error) { + cl, err := arm.NewClient(moduleName+".BusinessProcessesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BusinessProcessesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a BusinessProcess +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - businessProcessName - The name of the business process +// - resource - Resource create parameters. +// - options - BusinessProcessesClientCreateOrUpdateOptions contains the optional parameters for the BusinessProcessesClient.CreateOrUpdate +// method. +func (client *BusinessProcessesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, resource BusinessProcess, options *BusinessProcessesClientCreateOrUpdateOptions) (BusinessProcessesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, spaceName, applicationName, businessProcessName, resource, options) + if err != nil { + return BusinessProcessesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BusinessProcessesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return BusinessProcessesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *BusinessProcessesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, resource BusinessProcess, options *BusinessProcessesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + if businessProcessName == "" { + return nil, errors.New("parameter businessProcessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{businessProcessName}", url.PathEscape(businessProcessName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *BusinessProcessesClient) createOrUpdateHandleResponse(resp *http.Response) (BusinessProcessesClientCreateOrUpdateResponse, error) { + result := BusinessProcessesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BusinessProcess); err != nil { + return BusinessProcessesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a BusinessProcess +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - businessProcessName - The name of the business process +// - options - BusinessProcessesClientDeleteOptions contains the optional parameters for the BusinessProcessesClient.Delete +// method. +func (client *BusinessProcessesClient) Delete(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, options *BusinessProcessesClientDeleteOptions) (BusinessProcessesClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, spaceName, applicationName, businessProcessName, options) + if err != nil { + return BusinessProcessesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BusinessProcessesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return BusinessProcessesClientDeleteResponse{}, err + } + return BusinessProcessesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BusinessProcessesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, options *BusinessProcessesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + if businessProcessName == "" { + return nil, errors.New("parameter businessProcessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{businessProcessName}", url.PathEscape(businessProcessName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a BusinessProcess +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - businessProcessName - The name of the business process +// - options - BusinessProcessesClientGetOptions contains the optional parameters for the BusinessProcessesClient.Get method. +func (client *BusinessProcessesClient) Get(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, options *BusinessProcessesClientGetOptions) (BusinessProcessesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, spaceName, applicationName, businessProcessName, options) + if err != nil { + return BusinessProcessesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BusinessProcessesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BusinessProcessesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *BusinessProcessesClient) getCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, options *BusinessProcessesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + if businessProcessName == "" { + return nil, errors.New("parameter businessProcessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{businessProcessName}", url.PathEscape(businessProcessName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BusinessProcessesClient) getHandleResponse(resp *http.Response) (BusinessProcessesClientGetResponse, error) { + result := BusinessProcessesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BusinessProcess); err != nil { + return BusinessProcessesClientGetResponse{}, err + } + return result, nil +} + +// NewListByApplicationPager - List BusinessProcess resources by Application +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - options - BusinessProcessesClientListByApplicationOptions contains the optional parameters for the BusinessProcessesClient.NewListByApplicationPager +// method. +func (client *BusinessProcessesClient) NewListByApplicationPager(resourceGroupName string, spaceName string, applicationName string, options *BusinessProcessesClientListByApplicationOptions) *runtime.Pager[BusinessProcessesClientListByApplicationResponse] { + return runtime.NewPager(runtime.PagingHandler[BusinessProcessesClientListByApplicationResponse]{ + More: func(page BusinessProcessesClientListByApplicationResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BusinessProcessesClientListByApplicationResponse) (BusinessProcessesClientListByApplicationResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByApplicationCreateRequest(ctx, resourceGroupName, spaceName, applicationName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BusinessProcessesClientListByApplicationResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BusinessProcessesClientListByApplicationResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BusinessProcessesClientListByApplicationResponse{}, runtime.NewResponseError(resp) + } + return client.listByApplicationHandleResponse(resp) + }, + }) +} + +// listByApplicationCreateRequest creates the ListByApplication request. +func (client *BusinessProcessesClient) listByApplicationCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, options *BusinessProcessesClientListByApplicationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Maxpagesize != nil { + reqQP.Set("maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10)) + } + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Select != nil { + for _, qv := range options.Select { + reqQP.Add("select", qv) + } + } + if options != nil && options.Expand != nil { + for _, qv := range options.Expand { + reqQP.Add("expand", qv) + } + } + if options != nil && options.Orderby != nil { + for _, qv := range options.Orderby { + reqQP.Add("orderby", qv) + } + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByApplicationHandleResponse handles the ListByApplication response. +func (client *BusinessProcessesClient) listByApplicationHandleResponse(resp *http.Response) (BusinessProcessesClientListByApplicationResponse, error) { + result := BusinessProcessesClientListByApplicationResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BusinessProcessListResult); err != nil { + return BusinessProcessesClientListByApplicationResponse{}, err + } + return result, nil +} + +// Patch - Update a BusinessProcess +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - businessProcessName - The name of the business process +// - properties - The resource properties to be updated. +// - options - BusinessProcessesClientPatchOptions contains the optional parameters for the BusinessProcessesClient.Patch method. +func (client *BusinessProcessesClient) Patch(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, properties BusinessProcessUpdate, options *BusinessProcessesClientPatchOptions) (BusinessProcessesClientPatchResponse, error) { + var err error + req, err := client.patchCreateRequest(ctx, resourceGroupName, spaceName, applicationName, businessProcessName, properties, options) + if err != nil { + return BusinessProcessesClientPatchResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BusinessProcessesClientPatchResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BusinessProcessesClientPatchResponse{}, err + } + resp, err := client.patchHandleResponse(httpResp) + return resp, err +} + +// patchCreateRequest creates the Patch request. +func (client *BusinessProcessesClient) patchCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, properties BusinessProcessUpdate, options *BusinessProcessesClientPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + if businessProcessName == "" { + return nil, errors.New("parameter businessProcessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{businessProcessName}", url.PathEscape(businessProcessName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// patchHandleResponse handles the Patch response. +func (client *BusinessProcessesClient) patchHandleResponse(resp *http.Response) (BusinessProcessesClientPatchResponse, error) { + result := BusinessProcessesClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BusinessProcess); err != nil { + return BusinessProcessesClientPatchResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/businessprocessversions_client.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/businessprocessversions_client.go new file mode 100644 index 000000000000..6740fce77de2 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/businessprocessversions_client.go @@ -0,0 +1,228 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// BusinessProcessVersionsClient contains the methods for the BusinessProcessVersions group. +// Don't use this type directly, use NewBusinessProcessVersionsClient() instead. +type BusinessProcessVersionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBusinessProcessVersionsClient creates a new instance of BusinessProcessVersionsClient 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 NewBusinessProcessVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BusinessProcessVersionsClient, error) { + cl, err := arm.NewClient(moduleName+".BusinessProcessVersionsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BusinessProcessVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a BusinessProcessVersion +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - businessProcessName - The name of the business process +// - businessProcessVersion - The version of the business process +// - options - BusinessProcessVersionsClientGetOptions contains the optional parameters for the BusinessProcessVersionsClient.Get +// method. +func (client *BusinessProcessVersionsClient) Get(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, businessProcessVersion string, options *BusinessProcessVersionsClientGetOptions) (BusinessProcessVersionsClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, spaceName, applicationName, businessProcessName, businessProcessVersion, options) + if err != nil { + return BusinessProcessVersionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BusinessProcessVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BusinessProcessVersionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *BusinessProcessVersionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, businessProcessVersion string, options *BusinessProcessVersionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions/{businessProcessVersion}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + if businessProcessName == "" { + return nil, errors.New("parameter businessProcessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{businessProcessName}", url.PathEscape(businessProcessName)) + if businessProcessVersion == "" { + return nil, errors.New("parameter businessProcessVersion cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{businessProcessVersion}", url.PathEscape(businessProcessVersion)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BusinessProcessVersionsClient) getHandleResponse(resp *http.Response) (BusinessProcessVersionsClientGetResponse, error) { + result := BusinessProcessVersionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BusinessProcessVersion); err != nil { + return BusinessProcessVersionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByBusinessProcessPager - List BusinessProcessVersion resources by BusinessProcess +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - applicationName - The name of the Application +// - businessProcessName - The name of the business process +// - options - BusinessProcessVersionsClientListByBusinessProcessOptions contains the optional parameters for the BusinessProcessVersionsClient.NewListByBusinessProcessPager +// method. +func (client *BusinessProcessVersionsClient) NewListByBusinessProcessPager(resourceGroupName string, spaceName string, applicationName string, businessProcessName string, options *BusinessProcessVersionsClientListByBusinessProcessOptions) *runtime.Pager[BusinessProcessVersionsClientListByBusinessProcessResponse] { + return runtime.NewPager(runtime.PagingHandler[BusinessProcessVersionsClientListByBusinessProcessResponse]{ + More: func(page BusinessProcessVersionsClientListByBusinessProcessResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BusinessProcessVersionsClientListByBusinessProcessResponse) (BusinessProcessVersionsClientListByBusinessProcessResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByBusinessProcessCreateRequest(ctx, resourceGroupName, spaceName, applicationName, businessProcessName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return BusinessProcessVersionsClientListByBusinessProcessResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BusinessProcessVersionsClientListByBusinessProcessResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return BusinessProcessVersionsClientListByBusinessProcessResponse{}, runtime.NewResponseError(resp) + } + return client.listByBusinessProcessHandleResponse(resp) + }, + }) +} + +// listByBusinessProcessCreateRequest creates the ListByBusinessProcess request. +func (client *BusinessProcessVersionsClient) listByBusinessProcessCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, applicationName string, businessProcessName string, options *BusinessProcessVersionsClientListByBusinessProcessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/applications/{applicationName}/businessProcesses/{businessProcessName}/versions" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if applicationName == "" { + return nil, errors.New("parameter applicationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationName}", url.PathEscape(applicationName)) + if businessProcessName == "" { + return nil, errors.New("parameter businessProcessName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{businessProcessName}", url.PathEscape(businessProcessName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Maxpagesize != nil { + reqQP.Set("maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10)) + } + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Select != nil { + for _, qv := range options.Select { + reqQP.Add("select", qv) + } + } + if options != nil && options.Expand != nil { + for _, qv := range options.Expand { + reqQP.Add("expand", qv) + } + } + if options != nil && options.Orderby != nil { + for _, qv := range options.Orderby { + reqQP.Add("orderby", qv) + } + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByBusinessProcessHandleResponse handles the ListByBusinessProcess response. +func (client *BusinessProcessVersionsClient) listByBusinessProcessHandleResponse(resp *http.Response) (BusinessProcessVersionsClientListByBusinessProcessResponse, error) { + result := BusinessProcessVersionsClientListByBusinessProcessResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BusinessProcessVersionListResult); err != nil { + return BusinessProcessVersionsClientListByBusinessProcessResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/ci.yml b/sdk/resourcemanager/integrationspaces/armintegrationspaces/ci.yml new file mode 100644 index 000000000000..c977df248c59 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/ci.yml @@ -0,0 +1,28 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/integrationspaces/armintegrationspaces/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/integrationspaces/armintegrationspaces/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/integrationspaces/armintegrationspaces' diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/client_factory.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/client_factory.go new file mode 100644 index 000000000000..334b3c698c36 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/client_factory.go @@ -0,0 +1,73 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + credential azcore.TokenCredential + options *arm.ClientOptions +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, credential: credential, + options: options.Clone(), + }, nil +} + +func (c *ClientFactory) NewApplicationResourcesClient() *ApplicationResourcesClient { + subClient, _ := NewApplicationResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewApplicationsClient() *ApplicationsClient { + subClient, _ := NewApplicationsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBusinessProcessVersionsClient() *BusinessProcessVersionsClient { + subClient, _ := NewBusinessProcessVersionsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewBusinessProcessesClient() *BusinessProcessesClient { + subClient, _ := NewBusinessProcessesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewInfrastructureResourcesClient() *InfrastructureResourcesClient { + subClient, _ := NewInfrastructureResourcesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewSpacesClient() *SpacesClient { + subClient, _ := NewSpacesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/constants.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/constants.go new file mode 100644 index 000000000000..33f86a15c3cc --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/constants.go @@ -0,0 +1,96 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +const ( + moduleName = "armintegrationspaces" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - The status of the current operation. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/go.mod b/sdk/resourcemanager/integrationspaces/armintegrationspaces/go.mod new file mode 100644 index 000000000000..782d49a40fac --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/go.mod @@ -0,0 +1,13 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/integrationspaces/armintegrationspaces + +go 1.18 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect +) diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/go.sum b/sdk/resourcemanager/integrationspaces/armintegrationspaces/go.sum new file mode 100644 index 000000000000..5c6bee428364 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/go.sum @@ -0,0 +1,15 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/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/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/infrastructureresources_client.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/infrastructureresources_client.go new file mode 100644 index 000000000000..3e34965ba49e --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/infrastructureresources_client.go @@ -0,0 +1,404 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// InfrastructureResourcesClient contains the methods for the InfrastructureResources group. +// Don't use this type directly, use NewInfrastructureResourcesClient() instead. +type InfrastructureResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewInfrastructureResourcesClient creates a new instance of InfrastructureResourcesClient 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 NewInfrastructureResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*InfrastructureResourcesClient, error) { + cl, err := arm.NewClient(moduleName+".InfrastructureResourcesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &InfrastructureResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a InfrastructureResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - infrastructureResourceName - The name of the infrastructure resource in the space. +// - resource - Resource create parameters. +// - options - InfrastructureResourcesClientCreateOrUpdateOptions contains the optional parameters for the InfrastructureResourcesClient.CreateOrUpdate +// method. +func (client *InfrastructureResourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, spaceName string, infrastructureResourceName string, resource InfrastructureResource, options *InfrastructureResourcesClientCreateOrUpdateOptions) (InfrastructureResourcesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, spaceName, infrastructureResourceName, resource, options) + if err != nil { + return InfrastructureResourcesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InfrastructureResourcesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return InfrastructureResourcesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *InfrastructureResourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, infrastructureResourceName string, resource InfrastructureResource, options *InfrastructureResourcesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if infrastructureResourceName == "" { + return nil, errors.New("parameter infrastructureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{infrastructureResourceName}", url.PathEscape(infrastructureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *InfrastructureResourcesClient) createOrUpdateHandleResponse(resp *http.Response) (InfrastructureResourcesClientCreateOrUpdateResponse, error) { + result := InfrastructureResourcesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InfrastructureResource); err != nil { + return InfrastructureResourcesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a InfrastructureResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - infrastructureResourceName - The name of the infrastructure resource in the space. +// - options - InfrastructureResourcesClientDeleteOptions contains the optional parameters for the InfrastructureResourcesClient.Delete +// method. +func (client *InfrastructureResourcesClient) Delete(ctx context.Context, resourceGroupName string, spaceName string, infrastructureResourceName string, options *InfrastructureResourcesClientDeleteOptions) (InfrastructureResourcesClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, spaceName, infrastructureResourceName, options) + if err != nil { + return InfrastructureResourcesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InfrastructureResourcesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return InfrastructureResourcesClientDeleteResponse{}, err + } + return InfrastructureResourcesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *InfrastructureResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, infrastructureResourceName string, options *InfrastructureResourcesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if infrastructureResourceName == "" { + return nil, errors.New("parameter infrastructureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{infrastructureResourceName}", url.PathEscape(infrastructureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a InfrastructureResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - infrastructureResourceName - The name of the infrastructure resource in the space. +// - options - InfrastructureResourcesClientGetOptions contains the optional parameters for the InfrastructureResourcesClient.Get +// method. +func (client *InfrastructureResourcesClient) Get(ctx context.Context, resourceGroupName string, spaceName string, infrastructureResourceName string, options *InfrastructureResourcesClientGetOptions) (InfrastructureResourcesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, spaceName, infrastructureResourceName, options) + if err != nil { + return InfrastructureResourcesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InfrastructureResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InfrastructureResourcesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *InfrastructureResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, infrastructureResourceName string, options *InfrastructureResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if infrastructureResourceName == "" { + return nil, errors.New("parameter infrastructureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{infrastructureResourceName}", url.PathEscape(infrastructureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *InfrastructureResourcesClient) getHandleResponse(resp *http.Response) (InfrastructureResourcesClientGetResponse, error) { + result := InfrastructureResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InfrastructureResource); err != nil { + return InfrastructureResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListBySpacePager - List InfrastructureResource resources by Space +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - options - InfrastructureResourcesClientListBySpaceOptions contains the optional parameters for the InfrastructureResourcesClient.NewListBySpacePager +// method. +func (client *InfrastructureResourcesClient) NewListBySpacePager(resourceGroupName string, spaceName string, options *InfrastructureResourcesClientListBySpaceOptions) *runtime.Pager[InfrastructureResourcesClientListBySpaceResponse] { + return runtime.NewPager(runtime.PagingHandler[InfrastructureResourcesClientListBySpaceResponse]{ + More: func(page InfrastructureResourcesClientListBySpaceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *InfrastructureResourcesClientListBySpaceResponse) (InfrastructureResourcesClientListBySpaceResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySpaceCreateRequest(ctx, resourceGroupName, spaceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return InfrastructureResourcesClientListBySpaceResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InfrastructureResourcesClientListBySpaceResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return InfrastructureResourcesClientListBySpaceResponse{}, runtime.NewResponseError(resp) + } + return client.listBySpaceHandleResponse(resp) + }, + }) +} + +// listBySpaceCreateRequest creates the ListBySpace request. +func (client *InfrastructureResourcesClient) listBySpaceCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, options *InfrastructureResourcesClientListBySpaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Maxpagesize != nil { + reqQP.Set("maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10)) + } + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Select != nil { + for _, qv := range options.Select { + reqQP.Add("select", qv) + } + } + if options != nil && options.Expand != nil { + for _, qv := range options.Expand { + reqQP.Add("expand", qv) + } + } + if options != nil && options.Orderby != nil { + for _, qv := range options.Orderby { + reqQP.Add("orderby", qv) + } + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySpaceHandleResponse handles the ListBySpace response. +func (client *InfrastructureResourcesClient) listBySpaceHandleResponse(resp *http.Response) (InfrastructureResourcesClientListBySpaceResponse, error) { + result := InfrastructureResourcesClientListBySpaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InfrastructureResourceListResult); err != nil { + return InfrastructureResourcesClientListBySpaceResponse{}, err + } + return result, nil +} + +// Patch - Update a InfrastructureResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - infrastructureResourceName - The name of the infrastructure resource in the space. +// - properties - The resource properties to be updated. +// - options - InfrastructureResourcesClientPatchOptions contains the optional parameters for the InfrastructureResourcesClient.Patch +// method. +func (client *InfrastructureResourcesClient) Patch(ctx context.Context, resourceGroupName string, spaceName string, infrastructureResourceName string, properties InfrastructureResourceUpdate, options *InfrastructureResourcesClientPatchOptions) (InfrastructureResourcesClientPatchResponse, error) { + var err error + req, err := client.patchCreateRequest(ctx, resourceGroupName, spaceName, infrastructureResourceName, properties, options) + if err != nil { + return InfrastructureResourcesClientPatchResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return InfrastructureResourcesClientPatchResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return InfrastructureResourcesClientPatchResponse{}, err + } + resp, err := client.patchHandleResponse(httpResp) + return resp, err +} + +// patchCreateRequest creates the Patch request. +func (client *InfrastructureResourcesClient) patchCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, infrastructureResourceName string, properties InfrastructureResourceUpdate, options *InfrastructureResourcesClientPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}/infrastructureResources/{infrastructureResourceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + if infrastructureResourceName == "" { + return nil, errors.New("parameter infrastructureResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{infrastructureResourceName}", url.PathEscape(infrastructureResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// patchHandleResponse handles the Patch response. +func (client *InfrastructureResourcesClient) patchHandleResponse(resp *http.Response) (InfrastructureResourcesClientPatchResponse, error) { + result := InfrastructureResourcesClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.InfrastructureResource); err != nil { + return InfrastructureResourcesClientPatchResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/models.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/models.go new file mode 100644 index 000000000000..d3ca2f42428f --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/models.go @@ -0,0 +1,582 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import "time" + +// Application - An integration application under space. +type Application struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *ApplicationProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ApplicationListResult - The response of a Application list operation. +type ApplicationListResult struct { + // REQUIRED; The Application items on this page + Value []*Application + + // The link to the next page of items + NextLink *string +} + +// ApplicationProperties - The properties of application. +type ApplicationProperties struct { + // REQUIRED; The tracking data stores. + TrackingDataStores map[string]*TrackingDataStore + + // The description of the resource. + Description *string + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// ApplicationResource - A resource under application. +type ApplicationResource struct { + // The resource-specific properties for this resource. + Properties *ApplicationResourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ApplicationResourceListResult - The response of a ApplicationResource list operation. +type ApplicationResourceListResult struct { + // REQUIRED; The ApplicationResource items on this page + Value []*ApplicationResource + + // The link to the next page of items + NextLink *string +} + +// ApplicationResourceProperties - The properties of application resource. +type ApplicationResourceProperties struct { + // REQUIRED; The Arm id of the application resource. + ResourceID *string + + // REQUIRED; The type of the application resource. + ResourceType *string + + // The kind of the application resource. + ResourceKind *string + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// ApplicationResourceUpdate - The type used for update operations of the ApplicationResource. +type ApplicationResourceUpdate struct { + // The updatable properties of the ApplicationResource. + Properties *ApplicationResourceUpdateProperties +} + +// ApplicationResourceUpdateProperties - The updatable properties of the ApplicationResource. +type ApplicationResourceUpdateProperties struct { + // The Arm id of the application resource. + ResourceID *string + + // The kind of the application resource. + ResourceKind *string + + // The type of the application resource. + ResourceType *string +} + +// ApplicationUpdate - The type used for update operations of the Application. +type ApplicationUpdate struct { + // The updatable properties of the Application. + Properties *ApplicationUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// ApplicationUpdateProperties - The updatable properties of the Application. +type ApplicationUpdateProperties struct { + // The description of the resource. + Description *string + + // The tracking data stores. + TrackingDataStores map[string]*TrackingDataStore +} + +// BusinessProcess - A business process under application. +type BusinessProcess struct { + // The resource-specific properties for this resource. + Properties *BusinessProcessProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BusinessProcessDevelopmentArtifactProperties - The properties of business process development artifact. +type BusinessProcessDevelopmentArtifactProperties struct { + // The business process mapping. + BusinessProcessMapping map[string]*BusinessProcessMappingItem + + // The business process stages. + BusinessProcessStages map[string]*BusinessProcessStage + + // The description of the business process. + Description *string + + // The business process identifier. + Identifier *BusinessProcessIdentifier + + // The tracking profile for the business process. + TrackingProfiles map[string]*TrackingProfileDefinition +} + +// BusinessProcessIdentifier - The properties of business process identifier. +type BusinessProcessIdentifier struct { + // The property name of the business process identifier. + PropertyName *string + + // The property type of the business process identifier. + PropertyType *string +} + +// BusinessProcessListResult - The response of a BusinessProcess list operation. +type BusinessProcessListResult struct { + // REQUIRED; The BusinessProcess items on this page + Value []*BusinessProcess + + // The link to the next page of items + NextLink *string +} + +// BusinessProcessMappingItem - The properties of business process mapping. +type BusinessProcessMappingItem struct { + // The logic app resource id. + LogicAppResourceID *string + + // The operation name. + OperationName *string + + // The mapping item operation type of the business process. + OperationType *string + + // The workflow name within the logic app. + WorkflowName *string +} + +// BusinessProcessProperties - The properties of business process. +type BusinessProcessProperties struct { + // The business process mapping. + BusinessProcessMapping map[string]*BusinessProcessMappingItem + + // The business process stages. + BusinessProcessStages map[string]*BusinessProcessStage + + // The description of the business process. + Description *string + + // The business process identifier. + Identifier *BusinessProcessIdentifier + + // The table name of the business process. + TableName *string + + // The tracking data store reference name. + TrackingDataStoreReferenceName *string + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState + + // READ-ONLY; The version of the business process. + Version *string +} + +// BusinessProcessReference - The business process reference. +type BusinessProcessReference struct { + // The business process name. + Name *string + + // The business process version. + Version *string +} + +// BusinessProcessStage - The properties of business process stage. +type BusinessProcessStage struct { + // The description of the business stage. + Description *string + + // The properties within the properties of the business process stage. + Properties map[string]*string + + // The property to keep track of stages before current in the business process stage. + StagesBefore []*string +} + +// BusinessProcessUpdate - The type used for update operations of the BusinessProcess. +type BusinessProcessUpdate struct { + // The updatable properties of the BusinessProcess. + Properties *BusinessProcessUpdateProperties +} + +// BusinessProcessUpdateProperties - The updatable properties of the BusinessProcess. +type BusinessProcessUpdateProperties struct { + // The business process mapping. + BusinessProcessMapping map[string]*BusinessProcessMappingItem + + // The business process stages. + BusinessProcessStages map[string]*BusinessProcessStage + + // The description of the business process. + Description *string + + // The business process identifier. + Identifier *BusinessProcessIdentifier + + // The table name of the business process. + TableName *string + + // The tracking data store reference name. + TrackingDataStoreReferenceName *string +} + +// BusinessProcessVersion - A business process version. +type BusinessProcessVersion struct { + // The resource-specific properties for this resource. + Properties *BusinessProcessProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BusinessProcessVersionListResult - The response of a BusinessProcessVersion list operation. +type BusinessProcessVersionListResult struct { + // REQUIRED; The BusinessProcessVersion items on this page + Value []*BusinessProcessVersion + + // The link to the next page of items + NextLink *string +} + +// FlowTrackingDefinition - The workflow tracking definition. +type FlowTrackingDefinition struct { + // The tracking correlation context. + CorrelationContext *TrackingCorrelationContext + + // The tracking events. + Events map[string]*TrackingEventDefinition +} + +// GetOrDeleteBusinessProcessDevelopmentArtifactRequest - The business process development artifact get or delete request. +type GetOrDeleteBusinessProcessDevelopmentArtifactRequest struct { + // REQUIRED; The name of the business process development artifact. + Name *string +} + +// InfrastructureResource - An infrastructure resource under Space. +type InfrastructureResource struct { + // The resource-specific properties for this resource. + Properties *InfrastructureResourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// InfrastructureResourceListResult - The response of a InfrastructureResource list operation. +type InfrastructureResourceListResult struct { + // REQUIRED; The InfrastructureResource items on this page + Value []*InfrastructureResource + + // The link to the next page of items + NextLink *string +} + +// InfrastructureResourceProperties - The properties of infrastructure resource. +type InfrastructureResourceProperties struct { + // REQUIRED; The id of the infrastructure resource. + ResourceID *string + + // REQUIRED; The type of the infrastructure resource. + ResourceType *string + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// InfrastructureResourceUpdate - The type used for update operations of the InfrastructureResource. +type InfrastructureResourceUpdate struct { + // The updatable properties of the InfrastructureResource. + Properties *InfrastructureResourceUpdateProperties +} + +// InfrastructureResourceUpdateProperties - The updatable properties of the InfrastructureResource. +type InfrastructureResourceUpdateProperties struct { + // The id of the infrastructure resource. + ResourceID *string + + // The type of the infrastructure resource. + ResourceType *string +} + +// ListBusinessProcessDevelopmentArtifactsResponse - The business process development artifact get collection response. +type ListBusinessProcessDevelopmentArtifactsResponse struct { + // REQUIRED; The list of the business process development artifact. + Value []*SaveOrGetBusinessProcessDevelopmentArtifactResponse +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// SaveOrGetBusinessProcessDevelopmentArtifactResponse - The business process development artifact save or get response. +type SaveOrGetBusinessProcessDevelopmentArtifactResponse struct { + // REQUIRED; The name of the business process development artifact. + Name *string + + // The properties of the business process development artifact. + Properties *BusinessProcessDevelopmentArtifactProperties + + // READ-ONLY; The system data of the business process development artifact. + SystemData *SystemData +} + +// SaveOrValidateBusinessProcessDevelopmentArtifactRequest - The business process development artifact save or validate request. +type SaveOrValidateBusinessProcessDevelopmentArtifactRequest struct { + // REQUIRED; The name of the business process development artifact. + Name *string + + // The properties of the business process development artifact. + Properties *BusinessProcessDevelopmentArtifactProperties +} + +// Space - An integration space. +type Space struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *SpaceResourceProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SpaceListResult - The response of a Space list operation. +type SpaceListResult struct { + // REQUIRED; The Space items on this page + Value []*Space + + // The link to the next page of items + NextLink *string +} + +// SpaceResourceProperties - The properties of space. +type SpaceResourceProperties struct { + // The description of the resource. + Description *string + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// SpaceUpdate - The type used for update operations of the Space. +type SpaceUpdate struct { + // The updatable properties of the Space. + Properties *SpaceUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// SpaceUpdateProperties - The updatable properties of the Space. +type SpaceUpdateProperties struct { + // The description of the resource. + Description *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// TrackingCorrelationContext - The tracking correlation context. +type TrackingCorrelationContext struct { + // The operation name for correlation context. + OperationName *string + + // The operation type for correlation context. + OperationType *string + + // The name of the correlation property. + PropertyName *string + + // The template expression for correlation context property value. + Value *string +} + +// TrackingDataStore - The properties of tracking data store. +type TrackingDataStore struct { + // REQUIRED; The data store ingestion URI. + DataStoreIngestionURI *string + + // REQUIRED; The data store resource id. + DataStoreResourceID *string + + // REQUIRED; The data store URI. + DataStoreURI *string + + // REQUIRED; The database name. + DatabaseName *string +} + +// TrackingEventDefinition - The tracking event definition. +type TrackingEventDefinition struct { + // The operation name. + OperationName *string + + // The operation type. + OperationType *string + + // The properties to be collected for event. + Properties map[string]any +} + +// TrackingProfileDefinition - The tracking profile for the business process +type TrackingProfileDefinition struct { + // The business process reference. + BusinessProcess *BusinessProcessReference + + // The tracking definition schema uri. + Schema *string + + // The tracking definitions. + TrackingDefinitions map[string]*FlowTrackingDefinition +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/models_serde.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/models_serde.go new file mode 100644 index 000000000000..dab2a85e4b89 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/models_serde.go @@ -0,0 +1,1643 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Application. +func (a Application) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Application. +func (a *Application) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationListResult. +func (a ApplicationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationListResult. +func (a *ApplicationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationProperties. +func (a ApplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", a.Description) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "trackingDataStores", a.TrackingDataStores) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationProperties. +func (a *ApplicationProperties) 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 "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "trackingDataStores": + err = unpopulate(val, "TrackingDataStores", &a.TrackingDataStores) + 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 ApplicationResource. +func (a ApplicationResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationResource. +func (a *ApplicationResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationResourceListResult. +func (a ApplicationResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationResourceListResult. +func (a *ApplicationResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationResourceProperties. +func (a ApplicationResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "resourceId", a.ResourceID) + populate(objectMap, "resourceKind", a.ResourceKind) + populate(objectMap, "resourceType", a.ResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationResourceProperties. +func (a *ApplicationResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &a.ResourceID) + delete(rawMsg, key) + case "resourceKind": + err = unpopulate(val, "ResourceKind", &a.ResourceKind) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &a.ResourceType) + 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 ApplicationResourceUpdate. +func (a ApplicationResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationResourceUpdate. +func (a *ApplicationResourceUpdate) 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 "properties": + err = unpopulate(val, "Properties", &a.Properties) + 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 ApplicationResourceUpdateProperties. +func (a ApplicationResourceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceId", a.ResourceID) + populate(objectMap, "resourceKind", a.ResourceKind) + populate(objectMap, "resourceType", a.ResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationResourceUpdateProperties. +func (a *ApplicationResourceUpdateProperties) 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 "resourceId": + err = unpopulate(val, "ResourceID", &a.ResourceID) + delete(rawMsg, key) + case "resourceKind": + err = unpopulate(val, "ResourceKind", &a.ResourceKind) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &a.ResourceType) + 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 ApplicationUpdate. +func (a ApplicationUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationUpdate. +func (a *ApplicationUpdate) 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 "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + 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 ApplicationUpdateProperties. +func (a ApplicationUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", a.Description) + populate(objectMap, "trackingDataStores", a.TrackingDataStores) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationUpdateProperties. +func (a *ApplicationUpdateProperties) 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 "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "trackingDataStores": + err = unpopulate(val, "TrackingDataStores", &a.TrackingDataStores) + 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 BusinessProcess. +func (b BusinessProcess) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcess. +func (b *BusinessProcess) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessDevelopmentArtifactProperties. +func (b BusinessProcessDevelopmentArtifactProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "businessProcessMapping", b.BusinessProcessMapping) + populate(objectMap, "businessProcessStages", b.BusinessProcessStages) + populate(objectMap, "description", b.Description) + populate(objectMap, "identifier", b.Identifier) + populate(objectMap, "trackingProfiles", b.TrackingProfiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessDevelopmentArtifactProperties. +func (b *BusinessProcessDevelopmentArtifactProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "businessProcessMapping": + err = unpopulate(val, "BusinessProcessMapping", &b.BusinessProcessMapping) + delete(rawMsg, key) + case "businessProcessStages": + err = unpopulate(val, "BusinessProcessStages", &b.BusinessProcessStages) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &b.Description) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &b.Identifier) + delete(rawMsg, key) + case "trackingProfiles": + err = unpopulate(val, "TrackingProfiles", &b.TrackingProfiles) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessIdentifier. +func (b BusinessProcessIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "propertyName", b.PropertyName) + populate(objectMap, "propertyType", b.PropertyType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessIdentifier. +func (b *BusinessProcessIdentifier) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "propertyName": + err = unpopulate(val, "PropertyName", &b.PropertyName) + delete(rawMsg, key) + case "propertyType": + err = unpopulate(val, "PropertyType", &b.PropertyType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessListResult. +func (b BusinessProcessListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessListResult. +func (b *BusinessProcessListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessMappingItem. +func (b BusinessProcessMappingItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logicAppResourceId", b.LogicAppResourceID) + populate(objectMap, "operationName", b.OperationName) + populate(objectMap, "operationType", b.OperationType) + populate(objectMap, "workflowName", b.WorkflowName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessMappingItem. +func (b *BusinessProcessMappingItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logicAppResourceId": + err = unpopulate(val, "LogicAppResourceID", &b.LogicAppResourceID) + delete(rawMsg, key) + case "operationName": + err = unpopulate(val, "OperationName", &b.OperationName) + delete(rawMsg, key) + case "operationType": + err = unpopulate(val, "OperationType", &b.OperationType) + delete(rawMsg, key) + case "workflowName": + err = unpopulate(val, "WorkflowName", &b.WorkflowName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessProperties. +func (b BusinessProcessProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "businessProcessMapping", b.BusinessProcessMapping) + populate(objectMap, "businessProcessStages", b.BusinessProcessStages) + populate(objectMap, "description", b.Description) + populate(objectMap, "identifier", b.Identifier) + populate(objectMap, "provisioningState", b.ProvisioningState) + populate(objectMap, "tableName", b.TableName) + populate(objectMap, "trackingDataStoreReferenceName", b.TrackingDataStoreReferenceName) + populate(objectMap, "version", b.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessProperties. +func (b *BusinessProcessProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "businessProcessMapping": + err = unpopulate(val, "BusinessProcessMapping", &b.BusinessProcessMapping) + delete(rawMsg, key) + case "businessProcessStages": + err = unpopulate(val, "BusinessProcessStages", &b.BusinessProcessStages) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &b.Description) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &b.Identifier) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &b.TableName) + delete(rawMsg, key) + case "trackingDataStoreReferenceName": + err = unpopulate(val, "TrackingDataStoreReferenceName", &b.TrackingDataStoreReferenceName) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &b.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessReference. +func (b BusinessProcessReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", b.Name) + populate(objectMap, "version", b.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessReference. +func (b *BusinessProcessReference) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &b.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessStage. +func (b BusinessProcessStage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", b.Description) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "stagesBefore", b.StagesBefore) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessStage. +func (b *BusinessProcessStage) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &b.Description) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "stagesBefore": + err = unpopulate(val, "StagesBefore", &b.StagesBefore) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessUpdate. +func (b BusinessProcessUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", b.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessUpdate. +func (b *BusinessProcessUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessUpdateProperties. +func (b BusinessProcessUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "businessProcessMapping", b.BusinessProcessMapping) + populate(objectMap, "businessProcessStages", b.BusinessProcessStages) + populate(objectMap, "description", b.Description) + populate(objectMap, "identifier", b.Identifier) + populate(objectMap, "tableName", b.TableName) + populate(objectMap, "trackingDataStoreReferenceName", b.TrackingDataStoreReferenceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessUpdateProperties. +func (b *BusinessProcessUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "businessProcessMapping": + err = unpopulate(val, "BusinessProcessMapping", &b.BusinessProcessMapping) + delete(rawMsg, key) + case "businessProcessStages": + err = unpopulate(val, "BusinessProcessStages", &b.BusinessProcessStages) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &b.Description) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, "Identifier", &b.Identifier) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &b.TableName) + delete(rawMsg, key) + case "trackingDataStoreReferenceName": + err = unpopulate(val, "TrackingDataStoreReferenceName", &b.TrackingDataStoreReferenceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessVersion. +func (b BusinessProcessVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessVersion. +func (b *BusinessProcessVersion) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BusinessProcessVersionListResult. +func (b BusinessProcessVersionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BusinessProcessVersionListResult. +func (b *BusinessProcessVersionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FlowTrackingDefinition. +func (f FlowTrackingDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationContext", f.CorrelationContext) + populate(objectMap, "events", f.Events) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlowTrackingDefinition. +func (f *FlowTrackingDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "correlationContext": + err = unpopulate(val, "CorrelationContext", &f.CorrelationContext) + delete(rawMsg, key) + case "events": + err = unpopulate(val, "Events", &f.Events) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GetOrDeleteBusinessProcessDevelopmentArtifactRequest. +func (g GetOrDeleteBusinessProcessDevelopmentArtifactRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", g.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GetOrDeleteBusinessProcessDevelopmentArtifactRequest. +func (g *GetOrDeleteBusinessProcessDevelopmentArtifactRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InfrastructureResource. +func (i InfrastructureResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InfrastructureResource. +func (i *InfrastructureResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InfrastructureResourceListResult. +func (i InfrastructureResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InfrastructureResourceListResult. +func (i *InfrastructureResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InfrastructureResourceProperties. +func (i InfrastructureResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", i.ProvisioningState) + populate(objectMap, "resourceId", i.ResourceID) + populate(objectMap, "resourceType", i.ResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InfrastructureResourceProperties. +func (i *InfrastructureResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &i.ResourceID) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &i.ResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InfrastructureResourceUpdate. +func (i InfrastructureResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", i.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InfrastructureResourceUpdate. +func (i *InfrastructureResourceUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InfrastructureResourceUpdateProperties. +func (i InfrastructureResourceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceId", i.ResourceID) + populate(objectMap, "resourceType", i.ResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InfrastructureResourceUpdateProperties. +func (i *InfrastructureResourceUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resourceId": + err = unpopulate(val, "ResourceID", &i.ResourceID) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &i.ResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListBusinessProcessDevelopmentArtifactsResponse. +func (l ListBusinessProcessDevelopmentArtifactsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListBusinessProcessDevelopmentArtifactsResponse. +func (l *ListBusinessProcessDevelopmentArtifactsResponse) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SaveOrGetBusinessProcessDevelopmentArtifactResponse. +func (s SaveOrGetBusinessProcessDevelopmentArtifactResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SaveOrGetBusinessProcessDevelopmentArtifactResponse. +func (s *SaveOrGetBusinessProcessDevelopmentArtifactResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + 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 SaveOrValidateBusinessProcessDevelopmentArtifactRequest. +func (s SaveOrValidateBusinessProcessDevelopmentArtifactRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SaveOrValidateBusinessProcessDevelopmentArtifactRequest. +func (s *SaveOrValidateBusinessProcessDevelopmentArtifactRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Space. +func (s Space) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Space. +func (s *Space) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SpaceListResult. +func (s SpaceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpaceListResult. +func (s *SpaceListResult) 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 "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 SpaceResourceProperties. +func (s SpaceResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", s.Description) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpaceResourceProperties. +func (s *SpaceResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + 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 SpaceUpdate. +func (s SpaceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpaceUpdate. +func (s *SpaceUpdate) 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 "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 SpaceUpdateProperties. +func (s SpaceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", s.Description) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SpaceUpdateProperties. +func (s *SpaceUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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 "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + 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 TrackingCorrelationContext. +func (t TrackingCorrelationContext) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationName", t.OperationName) + populate(objectMap, "operationType", t.OperationType) + populate(objectMap, "propertyName", t.PropertyName) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackingCorrelationContext. +func (t *TrackingCorrelationContext) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationName": + err = unpopulate(val, "OperationName", &t.OperationName) + delete(rawMsg, key) + case "operationType": + err = unpopulate(val, "OperationType", &t.OperationType) + delete(rawMsg, key) + case "propertyName": + err = unpopulate(val, "PropertyName", &t.PropertyName) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackingDataStore. +func (t TrackingDataStore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataStoreIngestionUri", t.DataStoreIngestionURI) + populate(objectMap, "dataStoreResourceId", t.DataStoreResourceID) + populate(objectMap, "dataStoreUri", t.DataStoreURI) + populate(objectMap, "databaseName", t.DatabaseName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackingDataStore. +func (t *TrackingDataStore) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataStoreIngestionUri": + err = unpopulate(val, "DataStoreIngestionURI", &t.DataStoreIngestionURI) + delete(rawMsg, key) + case "dataStoreResourceId": + err = unpopulate(val, "DataStoreResourceID", &t.DataStoreResourceID) + delete(rawMsg, key) + case "dataStoreUri": + err = unpopulate(val, "DataStoreURI", &t.DataStoreURI) + delete(rawMsg, key) + case "databaseName": + err = unpopulate(val, "DatabaseName", &t.DatabaseName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackingEventDefinition. +func (t TrackingEventDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationName", t.OperationName) + populate(objectMap, "operationType", t.OperationType) + populate(objectMap, "properties", t.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackingEventDefinition. +func (t *TrackingEventDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationName": + err = unpopulate(val, "OperationName", &t.OperationName) + delete(rawMsg, key) + case "operationType": + err = unpopulate(val, "OperationType", &t.OperationType) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackingProfileDefinition. +func (t TrackingProfileDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "businessProcess", t.BusinessProcess) + populate(objectMap, "$schema", t.Schema) + populate(objectMap, "trackingDefinitions", t.TrackingDefinitions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackingProfileDefinition. +func (t *TrackingProfileDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "businessProcess": + err = unpopulate(val, "BusinessProcess", &t.BusinessProcess) + delete(rawMsg, key) + case "$schema": + err = unpopulate(val, "Schema", &t.Schema) + delete(rawMsg, key) + case "trackingDefinitions": + err = unpopulate(val, "TrackingDefinitions", &t.TrackingDefinitions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/operations_client.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/operations_client.go new file mode 100644 index 000000000000..bcc49bded3b0 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/operations_client.go @@ -0,0 +1,93 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2023-11-14-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, 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 OperationsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.IntegrationSpaces/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/options.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/options.go new file mode 100644 index 000000000000..482bfc9e0346 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/options.go @@ -0,0 +1,309 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +// ApplicationResourcesClientCreateOrUpdateOptions contains the optional parameters for the ApplicationResourcesClient.CreateOrUpdate +// method. +type ApplicationResourcesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ApplicationResourcesClientDeleteOptions contains the optional parameters for the ApplicationResourcesClient.Delete method. +type ApplicationResourcesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ApplicationResourcesClientGetOptions contains the optional parameters for the ApplicationResourcesClient.Get method. +type ApplicationResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationResourcesClientListByApplicationOptions contains the optional parameters for the ApplicationResourcesClient.NewListByApplicationPager +// method. +type ApplicationResourcesClientListByApplicationOptions struct { + // Expand the indicated resources into the response. + Expand []string + + // Filter the result list using the given expression. + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // Expressions that specify the order of returned results. + Orderby []string + + // Select the specified fields to be included in the response. + Select []string + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// ApplicationResourcesClientPatchOptions contains the optional parameters for the ApplicationResourcesClient.Patch method. +type ApplicationResourcesClientPatchOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientCreateOrUpdateOptions contains the optional parameters for the ApplicationsClient.CreateOrUpdate method. +type ApplicationsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientDeleteBusinessProcessDevelopmentArtifactOptions contains the optional parameters for the ApplicationsClient.DeleteBusinessProcessDevelopmentArtifact +// method. +type ApplicationsClientDeleteBusinessProcessDevelopmentArtifactOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientDeleteOptions contains the optional parameters for the ApplicationsClient.Delete method. +type ApplicationsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientGetBusinessProcessDevelopmentArtifactOptions contains the optional parameters for the ApplicationsClient.GetBusinessProcessDevelopmentArtifact +// method. +type ApplicationsClientGetBusinessProcessDevelopmentArtifactOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientGetOptions contains the optional parameters for the ApplicationsClient.Get method. +type ApplicationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientListBusinessProcessDevelopmentArtifactsOptions contains the optional parameters for the ApplicationsClient.ListBusinessProcessDevelopmentArtifacts +// method. +type ApplicationsClientListBusinessProcessDevelopmentArtifactsOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientListBySpaceOptions contains the optional parameters for the ApplicationsClient.NewListBySpacePager method. +type ApplicationsClientListBySpaceOptions struct { + // Expand the indicated resources into the response. + Expand []string + + // Filter the result list using the given expression. + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // Expressions that specify the order of returned results. + Orderby []string + + // Select the specified fields to be included in the response. + Select []string + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// ApplicationsClientPatchOptions contains the optional parameters for the ApplicationsClient.Patch method. +type ApplicationsClientPatchOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientSaveBusinessProcessDevelopmentArtifactOptions contains the optional parameters for the ApplicationsClient.SaveBusinessProcessDevelopmentArtifact +// method. +type ApplicationsClientSaveBusinessProcessDevelopmentArtifactOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsClientValidateBusinessProcessDevelopmentArtifactOptions contains the optional parameters for the ApplicationsClient.ValidateBusinessProcessDevelopmentArtifact +// method. +type ApplicationsClientValidateBusinessProcessDevelopmentArtifactOptions struct { + // placeholder for future optional parameters +} + +// BusinessProcessVersionsClientGetOptions contains the optional parameters for the BusinessProcessVersionsClient.Get method. +type BusinessProcessVersionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// BusinessProcessVersionsClientListByBusinessProcessOptions contains the optional parameters for the BusinessProcessVersionsClient.NewListByBusinessProcessPager +// method. +type BusinessProcessVersionsClientListByBusinessProcessOptions struct { + // Expand the indicated resources into the response. + Expand []string + + // Filter the result list using the given expression. + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // Expressions that specify the order of returned results. + Orderby []string + + // Select the specified fields to be included in the response. + Select []string + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// BusinessProcessesClientCreateOrUpdateOptions contains the optional parameters for the BusinessProcessesClient.CreateOrUpdate +// method. +type BusinessProcessesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// BusinessProcessesClientDeleteOptions contains the optional parameters for the BusinessProcessesClient.Delete method. +type BusinessProcessesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// BusinessProcessesClientGetOptions contains the optional parameters for the BusinessProcessesClient.Get method. +type BusinessProcessesClientGetOptions struct { + // placeholder for future optional parameters +} + +// BusinessProcessesClientListByApplicationOptions contains the optional parameters for the BusinessProcessesClient.NewListByApplicationPager +// method. +type BusinessProcessesClientListByApplicationOptions struct { + // Expand the indicated resources into the response. + Expand []string + + // Filter the result list using the given expression. + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // Expressions that specify the order of returned results. + Orderby []string + + // Select the specified fields to be included in the response. + Select []string + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// BusinessProcessesClientPatchOptions contains the optional parameters for the BusinessProcessesClient.Patch method. +type BusinessProcessesClientPatchOptions struct { + // placeholder for future optional parameters +} + +// InfrastructureResourcesClientCreateOrUpdateOptions contains the optional parameters for the InfrastructureResourcesClient.CreateOrUpdate +// method. +type InfrastructureResourcesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// InfrastructureResourcesClientDeleteOptions contains the optional parameters for the InfrastructureResourcesClient.Delete +// method. +type InfrastructureResourcesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// InfrastructureResourcesClientGetOptions contains the optional parameters for the InfrastructureResourcesClient.Get method. +type InfrastructureResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// InfrastructureResourcesClientListBySpaceOptions contains the optional parameters for the InfrastructureResourcesClient.NewListBySpacePager +// method. +type InfrastructureResourcesClientListBySpaceOptions struct { + // Expand the indicated resources into the response. + Expand []string + + // Filter the result list using the given expression. + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // Expressions that specify the order of returned results. + Orderby []string + + // Select the specified fields to be included in the response. + Select []string + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// InfrastructureResourcesClientPatchOptions contains the optional parameters for the InfrastructureResourcesClient.Patch +// method. +type InfrastructureResourcesClientPatchOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// SpacesClientCreateOrUpdateOptions contains the optional parameters for the SpacesClient.CreateOrUpdate method. +type SpacesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SpacesClientDeleteOptions contains the optional parameters for the SpacesClient.Delete method. +type SpacesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SpacesClientGetOptions contains the optional parameters for the SpacesClient.Get method. +type SpacesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SpacesClientListByResourceGroupOptions contains the optional parameters for the SpacesClient.NewListByResourceGroupPager +// method. +type SpacesClientListByResourceGroupOptions struct { + // Expand the indicated resources into the response. + Expand []string + + // Filter the result list using the given expression. + Filter *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // Expressions that specify the order of returned results. + Orderby []string + + // Select the specified fields to be included in the response. + Select []string + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// SpacesClientListBySubscriptionOptions contains the optional parameters for the SpacesClient.NewListBySubscriptionPager +// method. +type SpacesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// SpacesClientPatchOptions contains the optional parameters for the SpacesClient.Patch method. +type SpacesClientPatchOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/response_types.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/response_types.go new file mode 100644 index 000000000000..3c08c46012e2 --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/response_types.go @@ -0,0 +1,206 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +// ApplicationResourcesClientCreateOrUpdateResponse contains the response from method ApplicationResourcesClient.CreateOrUpdate. +type ApplicationResourcesClientCreateOrUpdateResponse struct { + // A resource under application. + ApplicationResource +} + +// ApplicationResourcesClientDeleteResponse contains the response from method ApplicationResourcesClient.Delete. +type ApplicationResourcesClientDeleteResponse struct { + // placeholder for future response values +} + +// ApplicationResourcesClientGetResponse contains the response from method ApplicationResourcesClient.Get. +type ApplicationResourcesClientGetResponse struct { + // A resource under application. + ApplicationResource +} + +// ApplicationResourcesClientListByApplicationResponse contains the response from method ApplicationResourcesClient.NewListByApplicationPager. +type ApplicationResourcesClientListByApplicationResponse struct { + // The response of a ApplicationResource list operation. + ApplicationResourceListResult +} + +// ApplicationResourcesClientPatchResponse contains the response from method ApplicationResourcesClient.Patch. +type ApplicationResourcesClientPatchResponse struct { + // A resource under application. + ApplicationResource +} + +// ApplicationsClientCreateOrUpdateResponse contains the response from method ApplicationsClient.CreateOrUpdate. +type ApplicationsClientCreateOrUpdateResponse struct { + // An integration application under space. + Application +} + +// ApplicationsClientDeleteBusinessProcessDevelopmentArtifactResponse contains the response from method ApplicationsClient.DeleteBusinessProcessDevelopmentArtifact. +type ApplicationsClientDeleteBusinessProcessDevelopmentArtifactResponse struct { + // placeholder for future response values +} + +// ApplicationsClientDeleteResponse contains the response from method ApplicationsClient.Delete. +type ApplicationsClientDeleteResponse struct { + // placeholder for future response values +} + +// ApplicationsClientGetBusinessProcessDevelopmentArtifactResponse contains the response from method ApplicationsClient.GetBusinessProcessDevelopmentArtifact. +type ApplicationsClientGetBusinessProcessDevelopmentArtifactResponse struct { + // The business process development artifact save or get response. + SaveOrGetBusinessProcessDevelopmentArtifactResponse +} + +// ApplicationsClientGetResponse contains the response from method ApplicationsClient.Get. +type ApplicationsClientGetResponse struct { + // An integration application under space. + Application +} + +// ApplicationsClientListBusinessProcessDevelopmentArtifactsResponse contains the response from method ApplicationsClient.ListBusinessProcessDevelopmentArtifacts. +type ApplicationsClientListBusinessProcessDevelopmentArtifactsResponse struct { + // The business process development artifact get collection response. + ListBusinessProcessDevelopmentArtifactsResponse +} + +// ApplicationsClientListBySpaceResponse contains the response from method ApplicationsClient.NewListBySpacePager. +type ApplicationsClientListBySpaceResponse struct { + // The response of a Application list operation. + ApplicationListResult +} + +// ApplicationsClientPatchResponse contains the response from method ApplicationsClient.Patch. +type ApplicationsClientPatchResponse struct { + // An integration application under space. + Application +} + +// ApplicationsClientSaveBusinessProcessDevelopmentArtifactResponse contains the response from method ApplicationsClient.SaveBusinessProcessDevelopmentArtifact. +type ApplicationsClientSaveBusinessProcessDevelopmentArtifactResponse struct { + // The business process development artifact save or get response. + SaveOrGetBusinessProcessDevelopmentArtifactResponse +} + +// ApplicationsClientValidateBusinessProcessDevelopmentArtifactResponse contains the response from method ApplicationsClient.ValidateBusinessProcessDevelopmentArtifact. +type ApplicationsClientValidateBusinessProcessDevelopmentArtifactResponse struct { + // placeholder for future response values +} + +// BusinessProcessVersionsClientGetResponse contains the response from method BusinessProcessVersionsClient.Get. +type BusinessProcessVersionsClientGetResponse struct { + // A business process version. + BusinessProcessVersion +} + +// BusinessProcessVersionsClientListByBusinessProcessResponse contains the response from method BusinessProcessVersionsClient.NewListByBusinessProcessPager. +type BusinessProcessVersionsClientListByBusinessProcessResponse struct { + // The response of a BusinessProcessVersion list operation. + BusinessProcessVersionListResult +} + +// BusinessProcessesClientCreateOrUpdateResponse contains the response from method BusinessProcessesClient.CreateOrUpdate. +type BusinessProcessesClientCreateOrUpdateResponse struct { + // A business process under application. + BusinessProcess +} + +// BusinessProcessesClientDeleteResponse contains the response from method BusinessProcessesClient.Delete. +type BusinessProcessesClientDeleteResponse struct { + // placeholder for future response values +} + +// BusinessProcessesClientGetResponse contains the response from method BusinessProcessesClient.Get. +type BusinessProcessesClientGetResponse struct { + // A business process under application. + BusinessProcess +} + +// BusinessProcessesClientListByApplicationResponse contains the response from method BusinessProcessesClient.NewListByApplicationPager. +type BusinessProcessesClientListByApplicationResponse struct { + // The response of a BusinessProcess list operation. + BusinessProcessListResult +} + +// BusinessProcessesClientPatchResponse contains the response from method BusinessProcessesClient.Patch. +type BusinessProcessesClientPatchResponse struct { + // A business process under application. + BusinessProcess +} + +// InfrastructureResourcesClientCreateOrUpdateResponse contains the response from method InfrastructureResourcesClient.CreateOrUpdate. +type InfrastructureResourcesClientCreateOrUpdateResponse struct { + // An infrastructure resource under Space. + InfrastructureResource +} + +// InfrastructureResourcesClientDeleteResponse contains the response from method InfrastructureResourcesClient.Delete. +type InfrastructureResourcesClientDeleteResponse struct { + // placeholder for future response values +} + +// InfrastructureResourcesClientGetResponse contains the response from method InfrastructureResourcesClient.Get. +type InfrastructureResourcesClientGetResponse struct { + // An infrastructure resource under Space. + InfrastructureResource +} + +// InfrastructureResourcesClientListBySpaceResponse contains the response from method InfrastructureResourcesClient.NewListBySpacePager. +type InfrastructureResourcesClientListBySpaceResponse struct { + // The response of a InfrastructureResource list operation. + InfrastructureResourceListResult +} + +// InfrastructureResourcesClientPatchResponse contains the response from method InfrastructureResourcesClient.Patch. +type InfrastructureResourcesClientPatchResponse struct { + // An infrastructure resource under Space. + InfrastructureResource +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} + +// SpacesClientCreateOrUpdateResponse contains the response from method SpacesClient.CreateOrUpdate. +type SpacesClientCreateOrUpdateResponse struct { + // An integration space. + Space +} + +// SpacesClientDeleteResponse contains the response from method SpacesClient.Delete. +type SpacesClientDeleteResponse struct { + // placeholder for future response values +} + +// SpacesClientGetResponse contains the response from method SpacesClient.Get. +type SpacesClientGetResponse struct { + // An integration space. + Space +} + +// SpacesClientListByResourceGroupResponse contains the response from method SpacesClient.NewListByResourceGroupPager. +type SpacesClientListByResourceGroupResponse struct { + // The response of a Space list operation. + SpaceListResult +} + +// SpacesClientListBySubscriptionResponse contains the response from method SpacesClient.NewListBySubscriptionPager. +type SpacesClientListBySubscriptionResponse struct { + // The response of a Space list operation. + SpaceListResult +} + +// SpacesClientPatchResponse contains the response from method SpacesClient.Patch. +type SpacesClientPatchResponse struct { + // An integration space. + Space +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/spaces_client.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/spaces_client.go new file mode 100644 index 000000000000..948bba1c86ca --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/spaces_client.go @@ -0,0 +1,435 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// SpacesClient contains the methods for the Spaces group. +// Don't use this type directly, use NewSpacesClient() instead. +type SpacesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSpacesClient creates a new instance of SpacesClient 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 NewSpacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SpacesClient, error) { + cl, err := arm.NewClient(moduleName+".SpacesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SpacesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a Space +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - resource - Resource create parameters. +// - options - SpacesClientCreateOrUpdateOptions contains the optional parameters for the SpacesClient.CreateOrUpdate method. +func (client *SpacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, spaceName string, resource Space, options *SpacesClientCreateOrUpdateOptions) (SpacesClientCreateOrUpdateResponse, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, spaceName, resource, options) + if err != nil { + return SpacesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpacesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SpacesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SpacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, resource Space, options *SpacesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SpacesClient) createOrUpdateHandleResponse(resp *http.Response) (SpacesClientCreateOrUpdateResponse, error) { + result := SpacesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Space); err != nil { + return SpacesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Space +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - options - SpacesClientDeleteOptions contains the optional parameters for the SpacesClient.Delete method. +func (client *SpacesClient) Delete(ctx context.Context, resourceGroupName string, spaceName string, options *SpacesClientDeleteOptions) (SpacesClientDeleteResponse, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, spaceName, options) + if err != nil { + return SpacesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpacesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SpacesClientDeleteResponse{}, err + } + return SpacesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SpacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, options *SpacesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Space +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - options - SpacesClientGetOptions contains the optional parameters for the SpacesClient.Get method. +func (client *SpacesClient) Get(ctx context.Context, resourceGroupName string, spaceName string, options *SpacesClientGetOptions) (SpacesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, spaceName, options) + if err != nil { + return SpacesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpacesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SpacesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SpacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, options *SpacesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SpacesClient) getHandleResponse(resp *http.Response) (SpacesClientGetResponse, error) { + result := SpacesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Space); err != nil { + return SpacesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Space resources by resource group +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - SpacesClientListByResourceGroupOptions contains the optional parameters for the SpacesClient.NewListByResourceGroupPager +// method. +func (client *SpacesClient) NewListByResourceGroupPager(resourceGroupName string, options *SpacesClientListByResourceGroupOptions) *runtime.Pager[SpacesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[SpacesClientListByResourceGroupResponse]{ + More: func(page SpacesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SpacesClientListByResourceGroupResponse) (SpacesClientListByResourceGroupResponse, 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 SpacesClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpacesClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SpacesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SpacesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SpacesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces" + 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)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Maxpagesize != nil { + reqQP.Set("maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10)) + } + if options != nil && options.Filter != nil { + reqQP.Set("filter", *options.Filter) + } + if options != nil && options.Select != nil { + for _, qv := range options.Select { + reqQP.Add("select", qv) + } + } + if options != nil && options.Expand != nil { + for _, qv := range options.Expand { + reqQP.Add("expand", qv) + } + } + if options != nil && options.Orderby != nil { + for _, qv := range options.Orderby { + reqQP.Add("orderby", qv) + } + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SpacesClient) listByResourceGroupHandleResponse(resp *http.Response) (SpacesClientListByResourceGroupResponse, error) { + result := SpacesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpaceListResult); err != nil { + return SpacesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Space resources by subscription ID +// +// Generated from API version 2023-11-14-preview +// - options - SpacesClientListBySubscriptionOptions contains the optional parameters for the SpacesClient.NewListBySubscriptionPager +// method. +func (client *SpacesClient) NewListBySubscriptionPager(options *SpacesClientListBySubscriptionOptions) *runtime.Pager[SpacesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[SpacesClientListBySubscriptionResponse]{ + More: func(page SpacesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SpacesClientListBySubscriptionResponse) (SpacesClientListBySubscriptionResponse, 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 SpacesClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpacesClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SpacesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *SpacesClient) listBySubscriptionCreateRequest(ctx context.Context, options *SpacesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.IntegrationSpaces/spaces" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *SpacesClient) listBySubscriptionHandleResponse(resp *http.Response) (SpacesClientListBySubscriptionResponse, error) { + result := SpacesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SpaceListResult); err != nil { + return SpacesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Patch - Update a Space +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-14-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - spaceName - The name of the space +// - properties - The resource properties to be updated. +// - options - SpacesClientPatchOptions contains the optional parameters for the SpacesClient.Patch method. +func (client *SpacesClient) Patch(ctx context.Context, resourceGroupName string, spaceName string, properties SpaceUpdate, options *SpacesClientPatchOptions) (SpacesClientPatchResponse, error) { + var err error + req, err := client.patchCreateRequest(ctx, resourceGroupName, spaceName, properties, options) + if err != nil { + return SpacesClientPatchResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SpacesClientPatchResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SpacesClientPatchResponse{}, err + } + resp, err := client.patchHandleResponse(httpResp) + return resp, err +} + +// patchCreateRequest creates the Patch request. +func (client *SpacesClient) patchCreateRequest(ctx context.Context, resourceGroupName string, spaceName string, properties SpaceUpdate, options *SpacesClientPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IntegrationSpaces/spaces/{spaceName}" + 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 spaceName == "" { + return nil, errors.New("parameter spaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{spaceName}", url.PathEscape(spaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-14-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// patchHandleResponse handles the Patch response. +func (client *SpacesClient) patchHandleResponse(resp *http.Response) (SpacesClientPatchResponse, error) { + result := SpacesClientPatchResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Space); err != nil { + return SpacesClientPatchResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/integrationspaces/armintegrationspaces/time_rfc3339.go b/sdk/resourcemanager/integrationspaces/armintegrationspaces/time_rfc3339.go new file mode 100644 index 000000000000..638bcfdecd8f --- /dev/null +++ b/sdk/resourcemanager/integrationspaces/armintegrationspaces/time_rfc3339.go @@ -0,0 +1,86 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armintegrationspaces + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +}