From b2cddab175e50e5e392f16d0b7b2745fafe51fe4 Mon Sep 17 00:00:00 2001 From: Peng Jiahui <46921893+Alancere@users.noreply.github.com> Date: Thu, 4 May 2023 10:26:03 +0800 Subject: [PATCH] [Release] sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/0.1.0 (#20437) * [Release] sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/0.1.0 generation from spec commit: 85fb4ac6f8bfefd179e6c2632976a154b5c9ff04 * client factory * fix * fix * update --- .../armpanngfw/CHANGELOG.md | 7 + .../armpanngfw/LICENSE.txt | 21 + .../paloaltonetworksngfw/armpanngfw/README.md | 85 + .../armpanngfw/autorest.md | 13 + .../paloaltonetworksngfw/armpanngfw/build.go | 7 + ...certificateobjectglobalrulestack_client.go | 284 ++ ...jectglobalrulestack_client_example_test.go | 299 ++ .../certificateobjectlocalrulestack_client.go | 323 ++ ...bjectlocalrulestack_client_example_test.go | 299 ++ .../paloaltonetworksngfw/armpanngfw/ci.yml | 28 + .../armpanngfw/client_factory.go | 109 + .../armpanngfw/constants.go | 488 +++ .../armpanngfw/firewalls_client.go | 647 +++ .../firewalls_client_example_test.go | 1734 ++++++++ .../armpanngfw/firewallstatus_client.go | 172 + .../firewallstatus_client_example_test.go | 170 + .../fqdnlistglobalrulestack_client.go | 284 ++ ...listglobalrulestack_client_example_test.go | 311 ++ .../fqdnlistlocalrulestack_client.go | 323 ++ ...nlistlocalrulestack_client_example_test.go | 311 ++ .../armpanngfw/globalrulestack_client.go | 791 ++++ .../globalrulestack_client_example_test.go | 987 +++++ .../paloaltonetworksngfw/armpanngfw/go.mod | 21 + .../paloaltonetworksngfw/armpanngfw/go.sum | 31 + .../armpanngfw/localrules_client.go | 509 +++ .../localrules_client_example_test.go | 629 +++ .../armpanngfw/localrulestacks_client.go | 1041 +++++ .../localrulestacks_client_example_test.go | 1171 ++++++ .../paloaltonetworksngfw/armpanngfw/models.go | 1924 +++++++++ .../armpanngfw/models_serde.go | 3530 +++++++++++++++++ .../armpanngfw/operations_client.go | 94 + .../operations_client_example_test.go | 85 + .../armpanngfw/postrules_client.go | 441 ++ .../postrules_client_example_test.go | 629 +++ .../prefixlistglobalrulestack_client.go | 284 ++ ...listglobalrulestack_client_example_test.go | 303 ++ .../prefixlistlocalrulestack_client.go | 323 ++ ...xlistlocalrulestack_client_example_test.go | 303 ++ .../armpanngfw/prerules_client.go | 441 ++ .../prerules_client_example_test.go | 629 +++ .../armpanngfw/response_types.go | 450 +++ .../armpanngfw/time_rfc3339.go | 87 + 42 files changed, 20618 insertions(+) create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/CHANGELOG.md create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/LICENSE.txt create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/README.md create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/autorest.md create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/build.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectglobalrulestack_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectglobalrulestack_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectlocalrulestack_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectlocalrulestack_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/ci.yml create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/client_factory.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/constants.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewalls_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewalls_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewallstatus_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewallstatus_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistglobalrulestack_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistglobalrulestack_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistlocalrulestack_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistlocalrulestack_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/globalrulestack_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/globalrulestack_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/go.mod create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/go.sum create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrules_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrules_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrulestacks_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrulestacks_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/models.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/models_serde.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/operations_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/operations_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/postrules_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/postrules_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistglobalrulestack_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistglobalrulestack_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistlocalrulestack_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistlocalrulestack_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prerules_client.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prerules_client_example_test.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/response_types.go create mode 100644 sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/time_rfc3339.go diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/CHANGELOG.md b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/CHANGELOG.md new file mode 100644 index 000000000000..8033ec9495db --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 0.1.0 (2023-04-28) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw` 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/paloaltonetworksngfw/armpanngfw/LICENSE.txt b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/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/paloaltonetworksngfw/armpanngfw/README.md b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/README.md new file mode 100644 index 000000000000..da161be94d23 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/README.md @@ -0,0 +1,85 @@ +# Azure PaloAltoNetworks Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw) + +The `armpanngfw` module provides operations for working with Azure PaloAltoNetworks. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw) + +# 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 PaloAltoNetworks module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure PaloAltoNetworks. 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 PaloAltoNetworks 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 := armpanngfw.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 := armpanngfw.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.NewLocalRulesClient() +``` + +## 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 `PaloAltoNetworks` 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/paloaltonetworksngfw/armpanngfw/autorest.md b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/autorest.md new file mode 100644 index 000000000000..d3112cc93b6d --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/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/paloaltonetworksngfw/armpanngfw/build.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/build.go new file mode 100644 index 000000000000..ce99c5410442 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/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/paloaltonetworksngfw/armpanngfw + +package armpanngfw diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectglobalrulestack_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectglobalrulestack_client.go new file mode 100644 index 000000000000..b40ac8daa3d4 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectglobalrulestack_client.go @@ -0,0 +1,284 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CertificateObjectGlobalRulestackClient contains the methods for the CertificateObjectGlobalRulestack group. +// Don't use this type directly, use NewCertificateObjectGlobalRulestackClient() instead. +type CertificateObjectGlobalRulestackClient struct { + internal *arm.Client +} + +// NewCertificateObjectGlobalRulestackClient creates a new instance of CertificateObjectGlobalRulestackClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCertificateObjectGlobalRulestackClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*CertificateObjectGlobalRulestackClient, error) { + cl, err := arm.NewClient(moduleName+".CertificateObjectGlobalRulestackClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CertificateObjectGlobalRulestackClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a CertificateObjectGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - name - certificate name +// - resource - Resource create parameters. +// - options - CertificateObjectGlobalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the CertificateObjectGlobalRulestackClient.BeginCreateOrUpdate +// method. +func (client *CertificateObjectGlobalRulestackClient) BeginCreateOrUpdate(ctx context.Context, globalRulestackName string, name string, resource CertificateObjectGlobalRulestackResource, options *CertificateObjectGlobalRulestackClientBeginCreateOrUpdateOptions) (*runtime.Poller[CertificateObjectGlobalRulestackClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, globalRulestackName, name, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CertificateObjectGlobalRulestackClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[CertificateObjectGlobalRulestackClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a CertificateObjectGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *CertificateObjectGlobalRulestackClient) createOrUpdate(ctx context.Context, globalRulestackName string, name string, resource CertificateObjectGlobalRulestackResource, options *CertificateObjectGlobalRulestackClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, globalRulestackName, name, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CertificateObjectGlobalRulestackClient) createOrUpdateCreateRequest(ctx context.Context, globalRulestackName string, name string, resource CertificateObjectGlobalRulestackResource, options *CertificateObjectGlobalRulestackClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a CertificateObjectGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - name - certificate name +// - options - CertificateObjectGlobalRulestackClientBeginDeleteOptions contains the optional parameters for the CertificateObjectGlobalRulestackClient.BeginDelete +// method. +func (client *CertificateObjectGlobalRulestackClient) BeginDelete(ctx context.Context, globalRulestackName string, name string, options *CertificateObjectGlobalRulestackClientBeginDeleteOptions) (*runtime.Poller[CertificateObjectGlobalRulestackClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, globalRulestackName, name, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CertificateObjectGlobalRulestackClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[CertificateObjectGlobalRulestackClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a CertificateObjectGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *CertificateObjectGlobalRulestackClient) deleteOperation(ctx context.Context, globalRulestackName string, name string, options *CertificateObjectGlobalRulestackClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, globalRulestackName, name, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CertificateObjectGlobalRulestackClient) deleteCreateRequest(ctx context.Context, globalRulestackName string, name string, options *CertificateObjectGlobalRulestackClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a CertificateObjectGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - name - certificate name +// - options - CertificateObjectGlobalRulestackClientGetOptions contains the optional parameters for the CertificateObjectGlobalRulestackClient.Get +// method. +func (client *CertificateObjectGlobalRulestackClient) Get(ctx context.Context, globalRulestackName string, name string, options *CertificateObjectGlobalRulestackClientGetOptions) (CertificateObjectGlobalRulestackClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, globalRulestackName, name, options) + if err != nil { + return CertificateObjectGlobalRulestackClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificateObjectGlobalRulestackClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificateObjectGlobalRulestackClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CertificateObjectGlobalRulestackClient) getCreateRequest(ctx context.Context, globalRulestackName string, name string, options *CertificateObjectGlobalRulestackClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates/{name}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CertificateObjectGlobalRulestackClient) getHandleResponse(resp *http.Response) (CertificateObjectGlobalRulestackClientGetResponse, error) { + result := CertificateObjectGlobalRulestackClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateObjectGlobalRulestackResource); err != nil { + return CertificateObjectGlobalRulestackClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List CertificateObjectGlobalRulestackResource resources by Tenant +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - CertificateObjectGlobalRulestackClientListOptions contains the optional parameters for the CertificateObjectGlobalRulestackClient.NewListPager +// method. +func (client *CertificateObjectGlobalRulestackClient) NewListPager(globalRulestackName string, options *CertificateObjectGlobalRulestackClientListOptions) *runtime.Pager[CertificateObjectGlobalRulestackClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CertificateObjectGlobalRulestackClientListResponse]{ + More: func(page CertificateObjectGlobalRulestackClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CertificateObjectGlobalRulestackClientListResponse) (CertificateObjectGlobalRulestackClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, globalRulestackName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CertificateObjectGlobalRulestackClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificateObjectGlobalRulestackClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificateObjectGlobalRulestackClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *CertificateObjectGlobalRulestackClient) listCreateRequest(ctx context.Context, globalRulestackName string, options *CertificateObjectGlobalRulestackClientListOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/certificates" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CertificateObjectGlobalRulestackClient) listHandleResponse(resp *http.Response) (CertificateObjectGlobalRulestackClientListResponse, error) { + result := CertificateObjectGlobalRulestackClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateObjectGlobalRulestackResourceListResult); err != nil { + return CertificateObjectGlobalRulestackClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectglobalrulestack_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectglobalrulestack_client_example_test.go new file mode 100644 index 000000000000..7406b642e34e --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectglobalrulestack_client_example_test.go @@ -0,0 +1,299 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectGlobalRulestack_List_MaximumSet_Gen.json +func ExampleCertificateObjectGlobalRulestackClient_NewListPager_certificateObjectGlobalRulestackListMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCertificateObjectGlobalRulestackClient().NewListPager("praval", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.CertificateObjectGlobalRulestackResourceListResult = armpanngfw.CertificateObjectGlobalRulestackResourceListResult{ + // Value: []*armpanngfw.CertificateObjectGlobalRulestackResource{ + // { + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.CertificateObject{ + // Description: to.Ptr("desc"), + // AuditComment: to.Ptr("comment"), + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // CertificateSignerResourceID: to.Ptr(""), + // Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectGlobalRulestack_List_MinimumSet_Gen.json +func ExampleCertificateObjectGlobalRulestackClient_NewListPager_certificateObjectGlobalRulestackListMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCertificateObjectGlobalRulestackClient().NewListPager("praval", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.CertificateObjectGlobalRulestackResourceListResult = armpanngfw.CertificateObjectGlobalRulestackResourceListResult{ + // Value: []*armpanngfw.CertificateObjectGlobalRulestackResource{ + // { + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval/certificates/certificates1"), + // Properties: &armpanngfw.CertificateObject{ + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectGlobalRulestack_Get_MaximumSet_Gen.json +func ExampleCertificateObjectGlobalRulestackClient_Get_certificateObjectGlobalRulestackGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCertificateObjectGlobalRulestackClient().Get(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CertificateObjectGlobalRulestackResource = armpanngfw.CertificateObjectGlobalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.CertificateObject{ + // Description: to.Ptr("description"), + // AuditComment: to.Ptr("comment"), + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // CertificateSignerResourceID: to.Ptr(""), + // Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectGlobalRulestack_Get_MinimumSet_Gen.json +func ExampleCertificateObjectGlobalRulestackClient_Get_certificateObjectGlobalRulestackGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCertificateObjectGlobalRulestackClient().Get(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CertificateObjectGlobalRulestackResource = armpanngfw.CertificateObjectGlobalRulestackResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval/certificates/armid1"), + // Properties: &armpanngfw.CertificateObject{ + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +func ExampleCertificateObjectGlobalRulestackClient_BeginCreateOrUpdate_certificateObjectGlobalRulestackCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCertificateObjectGlobalRulestackClient().BeginCreateOrUpdate(ctx, "praval", "armid1", armpanngfw.CertificateObjectGlobalRulestackResource{ + Properties: &armpanngfw.CertificateObject{ + Description: to.Ptr("description"), + AuditComment: to.Ptr("comment"), + CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + CertificateSignerResourceID: to.Ptr(""), + Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CertificateObjectGlobalRulestackResource = armpanngfw.CertificateObjectGlobalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.CertificateObject{ + // Description: to.Ptr("description"), + // AuditComment: to.Ptr("comment"), + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // CertificateSignerResourceID: to.Ptr(""), + // Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +func ExampleCertificateObjectGlobalRulestackClient_BeginCreateOrUpdate_certificateObjectGlobalRulestackCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCertificateObjectGlobalRulestackClient().BeginCreateOrUpdate(ctx, "praval", "armid1", armpanngfw.CertificateObjectGlobalRulestackResource{ + Properties: &armpanngfw.CertificateObject{ + CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CertificateObjectGlobalRulestackResource = armpanngfw.CertificateObjectGlobalRulestackResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval/certificates/armid1"), + // Properties: &armpanngfw.CertificateObject{ + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectGlobalRulestack_Delete_MaximumSet_Gen.json +func ExampleCertificateObjectGlobalRulestackClient_BeginDelete_certificateObjectGlobalRulestackDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCertificateObjectGlobalRulestackClient().BeginDelete(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectGlobalRulestack_Delete_MinimumSet_Gen.json +func ExampleCertificateObjectGlobalRulestackClient_BeginDelete_certificateObjectGlobalRulestackDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCertificateObjectGlobalRulestackClient().BeginDelete(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectlocalrulestack_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectlocalrulestack_client.go new file mode 100644 index 000000000000..34b9a4b35dbf --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectlocalrulestack_client.go @@ -0,0 +1,323 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CertificateObjectLocalRulestackClient contains the methods for the CertificateObjectLocalRulestack group. +// Don't use this type directly, use NewCertificateObjectLocalRulestackClient() instead. +type CertificateObjectLocalRulestackClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCertificateObjectLocalRulestackClient creates a new instance of CertificateObjectLocalRulestackClient 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 NewCertificateObjectLocalRulestackClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CertificateObjectLocalRulestackClient, error) { + cl, err := arm.NewClient(moduleName+".CertificateObjectLocalRulestackClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CertificateObjectLocalRulestackClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a CertificateObjectLocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - name - certificate name +// - resource - Resource create parameters. +// - options - CertificateObjectLocalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the CertificateObjectLocalRulestackClient.BeginCreateOrUpdate +// method. +func (client *CertificateObjectLocalRulestackClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, localRulestackName string, name string, resource CertificateObjectLocalRulestackResource, options *CertificateObjectLocalRulestackClientBeginCreateOrUpdateOptions) (*runtime.Poller[CertificateObjectLocalRulestackClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, localRulestackName, name, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CertificateObjectLocalRulestackClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[CertificateObjectLocalRulestackClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a CertificateObjectLocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *CertificateObjectLocalRulestackClient) createOrUpdate(ctx context.Context, resourceGroupName string, localRulestackName string, name string, resource CertificateObjectLocalRulestackResource, options *CertificateObjectLocalRulestackClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, localRulestackName, name, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CertificateObjectLocalRulestackClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, name string, resource CertificateObjectLocalRulestackResource, options *CertificateObjectLocalRulestackClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a CertificateObjectLocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - name - certificate name +// - options - CertificateObjectLocalRulestackClientBeginDeleteOptions contains the optional parameters for the CertificateObjectLocalRulestackClient.BeginDelete +// method. +func (client *CertificateObjectLocalRulestackClient) BeginDelete(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *CertificateObjectLocalRulestackClientBeginDeleteOptions) (*runtime.Poller[CertificateObjectLocalRulestackClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, localRulestackName, name, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CertificateObjectLocalRulestackClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[CertificateObjectLocalRulestackClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a CertificateObjectLocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *CertificateObjectLocalRulestackClient) deleteOperation(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *CertificateObjectLocalRulestackClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, localRulestackName, name, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CertificateObjectLocalRulestackClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *CertificateObjectLocalRulestackClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a CertificateObjectLocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - name - certificate name +// - options - CertificateObjectLocalRulestackClientGetOptions contains the optional parameters for the CertificateObjectLocalRulestackClient.Get +// method. +func (client *CertificateObjectLocalRulestackClient) Get(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *CertificateObjectLocalRulestackClientGetOptions) (CertificateObjectLocalRulestackClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, localRulestackName, name, options) + if err != nil { + return CertificateObjectLocalRulestackClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificateObjectLocalRulestackClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificateObjectLocalRulestackClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CertificateObjectLocalRulestackClient) getCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *CertificateObjectLocalRulestackClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates/{name}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CertificateObjectLocalRulestackClient) getHandleResponse(resp *http.Response) (CertificateObjectLocalRulestackClientGetResponse, error) { + result := CertificateObjectLocalRulestackClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateObjectLocalRulestackResource); err != nil { + return CertificateObjectLocalRulestackClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocalRulestacksPager - List CertificateObjectLocalRulestackResource resources by LocalRulestacks +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - CertificateObjectLocalRulestackClientListByLocalRulestacksOptions contains the optional parameters for the CertificateObjectLocalRulestackClient.NewListByLocalRulestacksPager +// method. +func (client *CertificateObjectLocalRulestackClient) NewListByLocalRulestacksPager(resourceGroupName string, localRulestackName string, options *CertificateObjectLocalRulestackClientListByLocalRulestacksOptions) *runtime.Pager[CertificateObjectLocalRulestackClientListByLocalRulestacksResponse] { + return runtime.NewPager(runtime.PagingHandler[CertificateObjectLocalRulestackClientListByLocalRulestacksResponse]{ + More: func(page CertificateObjectLocalRulestackClientListByLocalRulestacksResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CertificateObjectLocalRulestackClientListByLocalRulestacksResponse) (CertificateObjectLocalRulestackClientListByLocalRulestacksResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByLocalRulestacksCreateRequest(ctx, resourceGroupName, localRulestackName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return CertificateObjectLocalRulestackClientListByLocalRulestacksResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CertificateObjectLocalRulestackClientListByLocalRulestacksResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CertificateObjectLocalRulestackClientListByLocalRulestacksResponse{}, runtime.NewResponseError(resp) + } + return client.listByLocalRulestacksHandleResponse(resp) + }, + }) +} + +// listByLocalRulestacksCreateRequest creates the ListByLocalRulestacks request. +func (client *CertificateObjectLocalRulestackClient) listByLocalRulestacksCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *CertificateObjectLocalRulestackClientListByLocalRulestacksOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/certificates" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocalRulestacksHandleResponse handles the ListByLocalRulestacks response. +func (client *CertificateObjectLocalRulestackClient) listByLocalRulestacksHandleResponse(resp *http.Response) (CertificateObjectLocalRulestackClientListByLocalRulestacksResponse, error) { + result := CertificateObjectLocalRulestackClientListByLocalRulestacksResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CertificateObjectLocalRulestackResourceListResult); err != nil { + return CertificateObjectLocalRulestackClientListByLocalRulestacksResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectlocalrulestack_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectlocalrulestack_client_example_test.go new file mode 100644 index 000000000000..b29605d1fed7 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/certificateobjectlocalrulestack_client_example_test.go @@ -0,0 +1,299 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +func ExampleCertificateObjectLocalRulestackClient_NewListByLocalRulestacksPager_certificateObjectLocalRulestackListByLocalRulestacksMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCertificateObjectLocalRulestackClient().NewListByLocalRulestacksPager("rgopenapi", "lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.CertificateObjectLocalRulestackResourceListResult = armpanngfw.CertificateObjectLocalRulestackResourceListResult{ + // Value: []*armpanngfw.CertificateObjectLocalRulestackResource{ + // { + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.CertificateObject{ + // Description: to.Ptr("desc"), + // AuditComment: to.Ptr("comment"), + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // CertificateSignerResourceID: to.Ptr(""), + // Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +func ExampleCertificateObjectLocalRulestackClient_NewListByLocalRulestacksPager_certificateObjectLocalRulestackListByLocalRulestacksMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCertificateObjectLocalRulestackClient().NewListByLocalRulestacksPager("rgopenapi", "lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.CertificateObjectLocalRulestackResourceListResult = armpanngfw.CertificateObjectLocalRulestackResourceListResult{ + // Value: []*armpanngfw.CertificateObjectLocalRulestackResource{ + // { + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval/certificates/certificates1"), + // Properties: &armpanngfw.CertificateObject{ + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectLocalRulestack_Get_MaximumSet_Gen.json +func ExampleCertificateObjectLocalRulestackClient_Get_certificateObjectLocalRulestackGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCertificateObjectLocalRulestackClient().Get(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CertificateObjectLocalRulestackResource = armpanngfw.CertificateObjectLocalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.CertificateObject{ + // Description: to.Ptr("description"), + // AuditComment: to.Ptr("comment"), + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // CertificateSignerResourceID: to.Ptr(""), + // Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectLocalRulestack_Get_MinimumSet_Gen.json +func ExampleCertificateObjectLocalRulestackClient_Get_certificateObjectLocalRulestackGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCertificateObjectLocalRulestackClient().Get(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CertificateObjectLocalRulestackResource = armpanngfw.CertificateObjectLocalRulestackResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval/certificates/armid1"), + // Properties: &armpanngfw.CertificateObject{ + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +func ExampleCertificateObjectLocalRulestackClient_BeginCreateOrUpdate_certificateObjectLocalRulestackCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCertificateObjectLocalRulestackClient().BeginCreateOrUpdate(ctx, "rgopenapi", "lrs1", "armid1", armpanngfw.CertificateObjectLocalRulestackResource{ + Properties: &armpanngfw.CertificateObject{ + Description: to.Ptr("description"), + AuditComment: to.Ptr("comment"), + CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + CertificateSignerResourceID: to.Ptr(""), + Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CertificateObjectLocalRulestackResource = armpanngfw.CertificateObjectLocalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.CertificateObject{ + // Description: to.Ptr("description"), + // AuditComment: to.Ptr("comment"), + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // CertificateSignerResourceID: to.Ptr(""), + // Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +func ExampleCertificateObjectLocalRulestackClient_BeginCreateOrUpdate_certificateObjectLocalRulestackCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCertificateObjectLocalRulestackClient().BeginCreateOrUpdate(ctx, "rgopenapi", "lrs1", "armid1", armpanngfw.CertificateObjectLocalRulestackResource{ + Properties: &armpanngfw.CertificateObject{ + CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CertificateObjectLocalRulestackResource = armpanngfw.CertificateObjectLocalRulestackResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval/certificates/armid1"), + // Properties: &armpanngfw.CertificateObject{ + // CertificateSelfSigned: to.Ptr(armpanngfw.BooleanEnumTRUE), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectLocalRulestack_Delete_MaximumSet_Gen.json +func ExampleCertificateObjectLocalRulestackClient_BeginDelete_certificateObjectLocalRulestackDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCertificateObjectLocalRulestackClient().BeginDelete(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/CertificateObjectLocalRulestack_Delete_MinimumSet_Gen.json +func ExampleCertificateObjectLocalRulestackClient_BeginDelete_certificateObjectLocalRulestackDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewCertificateObjectLocalRulestackClient().BeginDelete(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/ci.yml b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/ci.yml new file mode 100644 index 000000000000..b997139ea5a5 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/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/paloaltonetworksngfw/armpanngfw/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/paloaltonetworksngfw/armpanngfw' diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/client_factory.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/client_factory.go new file mode 100644 index 000000000000..f6fe0e8300d8 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/client_factory.go @@ -0,0 +1,109 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +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) NewGlobalRulestackClient() *GlobalRulestackClient { + subClient, _ := NewGlobalRulestackClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewCertificateObjectGlobalRulestackClient() *CertificateObjectGlobalRulestackClient { + subClient, _ := NewCertificateObjectGlobalRulestackClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFqdnListGlobalRulestackClient() *FqdnListGlobalRulestackClient { + subClient, _ := NewFqdnListGlobalRulestackClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPostRulesClient() *PostRulesClient { + subClient, _ := NewPostRulesClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrefixListGlobalRulestackClient() *PrefixListGlobalRulestackClient { + subClient, _ := NewPrefixListGlobalRulestackClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPreRulesClient() *PreRulesClient { + subClient, _ := NewPreRulesClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFirewallsClient() *FirewallsClient { + subClient, _ := NewFirewallsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLocalRulestacksClient() *LocalRulestacksClient { + subClient, _ := NewLocalRulestacksClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFirewallStatusClient() *FirewallStatusClient { + subClient, _ := NewFirewallStatusClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewCertificateObjectLocalRulestackClient() *CertificateObjectLocalRulestackClient { + subClient, _ := NewCertificateObjectLocalRulestackClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFqdnListLocalRulestackClient() *FqdnListLocalRulestackClient { + subClient, _ := NewFqdnListLocalRulestackClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewLocalRulesClient() *LocalRulesClient { + subClient, _ := NewLocalRulesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewPrefixListLocalRulestackClient() *PrefixListLocalRulestackClient { + subClient, _ := NewPrefixListLocalRulestackClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/constants.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/constants.go new file mode 100644 index 000000000000..69b6941017ed --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/constants.go @@ -0,0 +1,488 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +const ( + moduleName = "armpanngfw" + moduleVersion = "v0.1.0" +) + +type ActionEnum string + +const ( + ActionEnumAllow ActionEnum = "Allow" + ActionEnumDenyResetBoth ActionEnum = "DenyResetBoth" + ActionEnumDenyResetServer ActionEnum = "DenyResetServer" + ActionEnumDenySilent ActionEnum = "DenySilent" +) + +// PossibleActionEnumValues returns the possible values for the ActionEnum const type. +func PossibleActionEnumValues() []ActionEnum { + return []ActionEnum{ + ActionEnumAllow, + ActionEnumDenyResetBoth, + ActionEnumDenyResetServer, + ActionEnumDenySilent, + } +} + +// 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, + } +} + +type AdvSecurityObjectTypeEnum string + +const ( + AdvSecurityObjectTypeEnumFeeds AdvSecurityObjectTypeEnum = "feeds" + AdvSecurityObjectTypeEnumURLCustom AdvSecurityObjectTypeEnum = "urlCustom" +) + +// PossibleAdvSecurityObjectTypeEnumValues returns the possible values for the AdvSecurityObjectTypeEnum const type. +func PossibleAdvSecurityObjectTypeEnumValues() []AdvSecurityObjectTypeEnum { + return []AdvSecurityObjectTypeEnum{ + AdvSecurityObjectTypeEnumFeeds, + AdvSecurityObjectTypeEnumURLCustom, + } +} + +// BillingCycle - Billing cycle +type BillingCycle string + +const ( + BillingCycleMONTHLY BillingCycle = "MONTHLY" + BillingCycleWEEKLY BillingCycle = "WEEKLY" +) + +// PossibleBillingCycleValues returns the possible values for the BillingCycle const type. +func PossibleBillingCycleValues() []BillingCycle { + return []BillingCycle{ + BillingCycleMONTHLY, + BillingCycleWEEKLY, + } +} + +// BooleanEnum - Boolean Enum +type BooleanEnum string + +const ( + BooleanEnumFALSE BooleanEnum = "FALSE" + BooleanEnumTRUE BooleanEnum = "TRUE" +) + +// PossibleBooleanEnumValues returns the possible values for the BooleanEnum const type. +func PossibleBooleanEnumValues() []BooleanEnum { + return []BooleanEnum{ + BooleanEnumFALSE, + BooleanEnumTRUE, + } +} + +// 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, + } +} + +// DNSProxy - DNS Proxy +type DNSProxy string + +const ( + DNSProxyDISABLED DNSProxy = "DISABLED" + DNSProxyENABLED DNSProxy = "ENABLED" +) + +// PossibleDNSProxyValues returns the possible values for the DNSProxy const type. +func PossibleDNSProxyValues() []DNSProxy { + return []DNSProxy{ + DNSProxyDISABLED, + DNSProxyENABLED, + } +} + +type DecryptionRuleTypeEnum string + +const ( + DecryptionRuleTypeEnumNone DecryptionRuleTypeEnum = "None" + DecryptionRuleTypeEnumSSLInboundInspection DecryptionRuleTypeEnum = "SSLInboundInspection" + DecryptionRuleTypeEnumSSLOutboundInspection DecryptionRuleTypeEnum = "SSLOutboundInspection" +) + +// PossibleDecryptionRuleTypeEnumValues returns the possible values for the DecryptionRuleTypeEnum const type. +func PossibleDecryptionRuleTypeEnumValues() []DecryptionRuleTypeEnum { + return []DecryptionRuleTypeEnum{ + DecryptionRuleTypeEnumNone, + DecryptionRuleTypeEnumSSLInboundInspection, + DecryptionRuleTypeEnumSSLOutboundInspection, + } +} + +// DefaultMode - Type for Default Mode for rules creation +type DefaultMode string + +const ( + DefaultModeFIREWALL DefaultMode = "FIREWALL" + DefaultModeIPS DefaultMode = "IPS" + DefaultModeNONE DefaultMode = "NONE" +) + +// PossibleDefaultModeValues returns the possible values for the DefaultMode const type. +func PossibleDefaultModeValues() []DefaultMode { + return []DefaultMode{ + DefaultModeFIREWALL, + DefaultModeIPS, + DefaultModeNONE, + } +} + +// EgressNat - Egress NAT +type EgressNat string + +const ( + EgressNatDISABLED EgressNat = "DISABLED" + EgressNatENABLED EgressNat = "ENABLED" +) + +// PossibleEgressNatValues returns the possible values for the EgressNat const type. +func PossibleEgressNatValues() []EgressNat { + return []EgressNat{ + EgressNatDISABLED, + EgressNatENABLED, + } +} + +// EnabledDNSType - Enabled DNS type values +type EnabledDNSType string + +const ( + EnabledDNSTypeAZURE EnabledDNSType = "AZURE" + EnabledDNSTypeCUSTOM EnabledDNSType = "CUSTOM" +) + +// PossibleEnabledDNSTypeValues returns the possible values for the EnabledDNSType const type. +func PossibleEnabledDNSTypeValues() []EnabledDNSType { + return []EnabledDNSType{ + EnabledDNSTypeAZURE, + EnabledDNSTypeCUSTOM, + } +} + +// HealthStatus - Status Codes for the Firewall +type HealthStatus string + +const ( + HealthStatusGREEN HealthStatus = "GREEN" + HealthStatusINITIALIZING HealthStatus = "INITIALIZING" + HealthStatusRED HealthStatus = "RED" + HealthStatusYELLOW HealthStatus = "YELLOW" +) + +// PossibleHealthStatusValues returns the possible values for the HealthStatus const type. +func PossibleHealthStatusValues() []HealthStatus { + return []HealthStatus{ + HealthStatusGREEN, + HealthStatusINITIALIZING, + HealthStatusRED, + HealthStatusYELLOW, + } +} + +// LogOption - Log options possible +type LogOption string + +const ( + LogOptionINDIVIDUALDESTINATION LogOption = "INDIVIDUAL_DESTINATION" + LogOptionSAMEDESTINATION LogOption = "SAME_DESTINATION" +) + +// PossibleLogOptionValues returns the possible values for the LogOption const type. +func PossibleLogOptionValues() []LogOption { + return []LogOption{ + LogOptionINDIVIDUALDESTINATION, + LogOptionSAMEDESTINATION, + } +} + +// LogType - Possible log types +type LogType string + +const ( + LogTypeAUDIT LogType = "AUDIT" + LogTypeDECRYPTION LogType = "DECRYPTION" + LogTypeDLP LogType = "DLP" + LogTypeTHREAT LogType = "THREAT" + LogTypeTRAFFIC LogType = "TRAFFIC" + LogTypeWILDFIRE LogType = "WILDFIRE" +) + +// PossibleLogTypeValues returns the possible values for the LogType const type. +func PossibleLogTypeValues() []LogType { + return []LogType{ + LogTypeAUDIT, + LogTypeDECRYPTION, + LogTypeDLP, + LogTypeTHREAT, + LogTypeTRAFFIC, + LogTypeWILDFIRE, + } +} + +// ManagedIdentityType - The kind of managed identity assigned to this resource. +type ManagedIdentityType string + +const ( + ManagedIdentityTypeNone ManagedIdentityType = "None" + ManagedIdentityTypeSystemAndUserAssigned ManagedIdentityType = "SystemAssigned,UserAssigned" + ManagedIdentityTypeSystemAssigned ManagedIdentityType = "SystemAssigned" + ManagedIdentityTypeUserAssigned ManagedIdentityType = "UserAssigned" +) + +// PossibleManagedIdentityTypeValues returns the possible values for the ManagedIdentityType const type. +func PossibleManagedIdentityTypeValues() []ManagedIdentityType { + return []ManagedIdentityType{ + ManagedIdentityTypeNone, + ManagedIdentityTypeSystemAndUserAssigned, + ManagedIdentityTypeSystemAssigned, + ManagedIdentityTypeUserAssigned, + } +} + +// MarketplaceSubscriptionStatus - Marketplace Subscription Status +type MarketplaceSubscriptionStatus string + +const ( + MarketplaceSubscriptionStatusFulfillmentRequested MarketplaceSubscriptionStatus = "FulfillmentRequested" + MarketplaceSubscriptionStatusNotStarted MarketplaceSubscriptionStatus = "NotStarted" + MarketplaceSubscriptionStatusPendingFulfillmentStart MarketplaceSubscriptionStatus = "PendingFulfillmentStart" + MarketplaceSubscriptionStatusSubscribed MarketplaceSubscriptionStatus = "Subscribed" + MarketplaceSubscriptionStatusSuspended MarketplaceSubscriptionStatus = "Suspended" + MarketplaceSubscriptionStatusUnsubscribed MarketplaceSubscriptionStatus = "Unsubscribed" +) + +// PossibleMarketplaceSubscriptionStatusValues returns the possible values for the MarketplaceSubscriptionStatus const type. +func PossibleMarketplaceSubscriptionStatusValues() []MarketplaceSubscriptionStatus { + return []MarketplaceSubscriptionStatus{ + MarketplaceSubscriptionStatusFulfillmentRequested, + MarketplaceSubscriptionStatusNotStarted, + MarketplaceSubscriptionStatusPendingFulfillmentStart, + MarketplaceSubscriptionStatusSubscribed, + MarketplaceSubscriptionStatusSuspended, + MarketplaceSubscriptionStatusUnsubscribed, + } +} + +// NetworkType - NetworkType Enum +type NetworkType string + +const ( + NetworkTypeVNET NetworkType = "VNET" + NetworkTypeVWAN NetworkType = "VWAN" +) + +// PossibleNetworkTypeValues returns the possible values for the NetworkType const type. +func PossibleNetworkTypeValues() []NetworkType { + return []NetworkType{ + NetworkTypeVNET, + NetworkTypeVWAN, + } +} + +// 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, + } +} + +// ProtocolType - Protocol Enum +type ProtocolType string + +const ( + ProtocolTypeTCP ProtocolType = "TCP" + ProtocolTypeUDP ProtocolType = "UDP" +) + +// PossibleProtocolTypeValues returns the possible values for the ProtocolType const type. +func PossibleProtocolTypeValues() []ProtocolType { + return []ProtocolType{ + ProtocolTypeTCP, + ProtocolTypeUDP, + } +} + +// ProvisioningState - Provisioning state of the firewall resource. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleted ProvisioningState = "Deleted" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleted, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateNotSpecified, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// ReadOnlyProvisioningState - Provisioning state of the firewall resource. +type ReadOnlyProvisioningState string + +const ( + ReadOnlyProvisioningStateDeleted ReadOnlyProvisioningState = "Deleted" + ReadOnlyProvisioningStateFailed ReadOnlyProvisioningState = "Failed" + ReadOnlyProvisioningStateSucceeded ReadOnlyProvisioningState = "Succeeded" +) + +// PossibleReadOnlyProvisioningStateValues returns the possible values for the ReadOnlyProvisioningState const type. +func PossibleReadOnlyProvisioningStateValues() []ReadOnlyProvisioningState { + return []ReadOnlyProvisioningState{ + ReadOnlyProvisioningStateDeleted, + ReadOnlyProvisioningStateFailed, + ReadOnlyProvisioningStateSucceeded, + } +} + +// ScopeType - Rulestack Type +type ScopeType string + +const ( + ScopeTypeGLOBAL ScopeType = "GLOBAL" + ScopeTypeLOCAL ScopeType = "LOCAL" +) + +// PossibleScopeTypeValues returns the possible values for the ScopeType const type. +func PossibleScopeTypeValues() []ScopeType { + return []ScopeType{ + ScopeTypeGLOBAL, + ScopeTypeLOCAL, + } +} + +type SecurityServicesTypeEnum string + +const ( + SecurityServicesTypeEnumAntiSpyware SecurityServicesTypeEnum = "antiSpyware" + SecurityServicesTypeEnumAntiVirus SecurityServicesTypeEnum = "antiVirus" + SecurityServicesTypeEnumDNSSubscription SecurityServicesTypeEnum = "dnsSubscription" + SecurityServicesTypeEnumFileBlocking SecurityServicesTypeEnum = "fileBlocking" + SecurityServicesTypeEnumIPsVulnerability SecurityServicesTypeEnum = "ipsVulnerability" + SecurityServicesTypeEnumURLFiltering SecurityServicesTypeEnum = "urlFiltering" +) + +// PossibleSecurityServicesTypeEnumValues returns the possible values for the SecurityServicesTypeEnum const type. +func PossibleSecurityServicesTypeEnumValues() []SecurityServicesTypeEnum { + return []SecurityServicesTypeEnum{ + SecurityServicesTypeEnumAntiSpyware, + SecurityServicesTypeEnumAntiVirus, + SecurityServicesTypeEnumDNSSubscription, + SecurityServicesTypeEnumFileBlocking, + SecurityServicesTypeEnumIPsVulnerability, + SecurityServicesTypeEnumURLFiltering, + } +} + +// ServerStatus - Connectivity Status for Panorama Server +type ServerStatus string + +const ( + ServerStatusDOWN ServerStatus = "DOWN" + ServerStatusUP ServerStatus = "UP" +) + +// PossibleServerStatusValues returns the possible values for the ServerStatus const type. +func PossibleServerStatusValues() []ServerStatus { + return []ServerStatus{ + ServerStatusDOWN, + ServerStatusUP, + } +} + +// StateEnum - Enabled or Disabled Enum +type StateEnum string + +const ( + StateEnumDISABLED StateEnum = "DISABLED" + StateEnumENABLED StateEnum = "ENABLED" +) + +// PossibleStateEnumValues returns the possible values for the StateEnum const type. +func PossibleStateEnumValues() []StateEnum { + return []StateEnum{ + StateEnumDISABLED, + StateEnumENABLED, + } +} + +// UsageType - Usage Type +type UsageType string + +const ( + UsageTypeCOMMITTED UsageType = "COMMITTED" + UsageTypePAYG UsageType = "PAYG" +) + +// PossibleUsageTypeValues returns the possible values for the UsageType const type. +func PossibleUsageTypeValues() []UsageType { + return []UsageType{ + UsageTypeCOMMITTED, + UsageTypePAYG, + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewalls_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewalls_client.go new file mode 100644 index 000000000000..5dacb5f2f900 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewalls_client.go @@ -0,0 +1,647 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallsClient contains the methods for the Firewalls group. +// Don't use this type directly, use NewFirewallsClient() instead. +type FirewallsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFirewallsClient creates a new instance of FirewallsClient 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 NewFirewallsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallsClient, error) { + cl, err := arm.NewClient(moduleName+".FirewallsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirewallsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a FirewallResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - firewallName - Firewall resource name +// - resource - Resource create parameters. +// - options - FirewallsClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallsClient.BeginCreateOrUpdate +// method. +func (client *FirewallsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, firewallName string, resource FirewallResource, options *FirewallsClientBeginCreateOrUpdateOptions) (*runtime.Poller[FirewallsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, firewallName, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FirewallsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a FirewallResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *FirewallsClient) createOrUpdate(ctx context.Context, resourceGroupName string, firewallName string, resource FirewallResource, options *FirewallsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, firewallName, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FirewallsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, firewallName string, resource FirewallResource, options *FirewallsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" + 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 firewallName == "" { + return nil, errors.New("parameter firewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallName}", url.PathEscape(firewallName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a FirewallResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - firewallName - Firewall resource name +// - options - FirewallsClientBeginDeleteOptions contains the optional parameters for the FirewallsClient.BeginDelete method. +func (client *FirewallsClient) BeginDelete(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientBeginDeleteOptions) (*runtime.Poller[FirewallsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, firewallName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FirewallsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a FirewallResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *FirewallsClient) deleteOperation(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, firewallName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FirewallsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" + 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 firewallName == "" { + return nil, errors.New("parameter firewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallName}", url.PathEscape(firewallName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a FirewallResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - firewallName - Firewall resource name +// - options - FirewallsClientGetOptions contains the optional parameters for the FirewallsClient.Get method. +func (client *FirewallsClient) Get(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientGetOptions) (FirewallsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, firewallName, options) + if err != nil { + return FirewallsClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FirewallsClient) getCreateRequest(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" + 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 firewallName == "" { + return nil, errors.New("parameter firewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallName}", url.PathEscape(firewallName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FirewallsClient) getHandleResponse(resp *http.Response) (FirewallsClientGetResponse, error) { + result := FirewallsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallResource); err != nil { + return FirewallsClientGetResponse{}, err + } + return result, nil +} + +// GetGlobalRulestack - Get Global Rulestack associated with the Firewall +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - firewallName - Firewall resource name +// - options - FirewallsClientGetGlobalRulestackOptions contains the optional parameters for the FirewallsClient.GetGlobalRulestack +// method. +func (client *FirewallsClient) GetGlobalRulestack(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientGetGlobalRulestackOptions) (FirewallsClientGetGlobalRulestackResponse, error) { + req, err := client.getGlobalRulestackCreateRequest(ctx, resourceGroupName, firewallName, options) + if err != nil { + return FirewallsClientGetGlobalRulestackResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallsClientGetGlobalRulestackResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallsClientGetGlobalRulestackResponse{}, runtime.NewResponseError(resp) + } + return client.getGlobalRulestackHandleResponse(resp) +} + +// getGlobalRulestackCreateRequest creates the GetGlobalRulestack request. +func (client *FirewallsClient) getGlobalRulestackCreateRequest(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientGetGlobalRulestackOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getGlobalRulestack" + 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 firewallName == "" { + return nil, errors.New("parameter firewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallName}", url.PathEscape(firewallName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getGlobalRulestackHandleResponse handles the GetGlobalRulestack response. +func (client *FirewallsClient) getGlobalRulestackHandleResponse(resp *http.Response) (FirewallsClientGetGlobalRulestackResponse, error) { + result := FirewallsClientGetGlobalRulestackResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GlobalRulestackInfo); err != nil { + return FirewallsClientGetGlobalRulestackResponse{}, err + } + return result, nil +} + +// GetLogProfile - Log Profile for Firewall +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - firewallName - Firewall resource name +// - options - FirewallsClientGetLogProfileOptions contains the optional parameters for the FirewallsClient.GetLogProfile method. +func (client *FirewallsClient) GetLogProfile(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientGetLogProfileOptions) (FirewallsClientGetLogProfileResponse, error) { + req, err := client.getLogProfileCreateRequest(ctx, resourceGroupName, firewallName, options) + if err != nil { + return FirewallsClientGetLogProfileResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallsClientGetLogProfileResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallsClientGetLogProfileResponse{}, runtime.NewResponseError(resp) + } + return client.getLogProfileHandleResponse(resp) +} + +// getLogProfileCreateRequest creates the GetLogProfile request. +func (client *FirewallsClient) getLogProfileCreateRequest(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientGetLogProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getLogProfile" + 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 firewallName == "" { + return nil, errors.New("parameter firewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallName}", url.PathEscape(firewallName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getLogProfileHandleResponse handles the GetLogProfile response. +func (client *FirewallsClient) getLogProfileHandleResponse(resp *http.Response) (FirewallsClientGetLogProfileResponse, error) { + result := FirewallsClientGetLogProfileResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LogSettings); err != nil { + return FirewallsClientGetLogProfileResponse{}, err + } + return result, nil +} + +// GetSupportInfo - support info for firewall. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - firewallName - Firewall resource name +// - options - FirewallsClientGetSupportInfoOptions contains the optional parameters for the FirewallsClient.GetSupportInfo +// method. +func (client *FirewallsClient) GetSupportInfo(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientGetSupportInfoOptions) (FirewallsClientGetSupportInfoResponse, error) { + req, err := client.getSupportInfoCreateRequest(ctx, resourceGroupName, firewallName, options) + if err != nil { + return FirewallsClientGetSupportInfoResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallsClientGetSupportInfoResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallsClientGetSupportInfoResponse{}, runtime.NewResponseError(resp) + } + return client.getSupportInfoHandleResponse(resp) +} + +// getSupportInfoCreateRequest creates the GetSupportInfo request. +func (client *FirewallsClient) getSupportInfoCreateRequest(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientGetSupportInfoOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getSupportInfo" + 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 firewallName == "" { + return nil, errors.New("parameter firewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallName}", url.PathEscape(firewallName)) + 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", "2022-08-29-preview") + if options != nil && options.Email != nil { + reqQP.Set("email", *options.Email) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getSupportInfoHandleResponse handles the GetSupportInfo response. +func (client *FirewallsClient) getSupportInfoHandleResponse(resp *http.Response) (FirewallsClientGetSupportInfoResponse, error) { + result := FirewallsClientGetSupportInfoResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SupportInfo); err != nil { + return FirewallsClientGetSupportInfoResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List FirewallResource resources by resource group +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - FirewallsClientListByResourceGroupOptions contains the optional parameters for the FirewallsClient.NewListByResourceGroupPager +// method. +func (client *FirewallsClient) NewListByResourceGroupPager(resourceGroupName string, options *FirewallsClientListByResourceGroupOptions) *runtime.Pager[FirewallsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[FirewallsClientListByResourceGroupResponse]{ + More: func(page FirewallsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FirewallsClientListByResourceGroupResponse) (FirewallsClientListByResourceGroupResponse, 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 FirewallsClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallsClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *FirewallsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *FirewallsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls" + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *FirewallsClient) listByResourceGroupHandleResponse(resp *http.Response) (FirewallsClientListByResourceGroupResponse, error) { + result := FirewallsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallResourceListResult); err != nil { + return FirewallsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List FirewallResource resources by subscription ID +// +// Generated from API version 2022-08-29-preview +// - options - FirewallsClientListBySubscriptionOptions contains the optional parameters for the FirewallsClient.NewListBySubscriptionPager +// method. +func (client *FirewallsClient) NewListBySubscriptionPager(options *FirewallsClientListBySubscriptionOptions) *runtime.Pager[FirewallsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[FirewallsClientListBySubscriptionResponse]{ + More: func(page FirewallsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FirewallsClientListBySubscriptionResponse) (FirewallsClientListBySubscriptionResponse, 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 FirewallsClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *FirewallsClient) listBySubscriptionCreateRequest(ctx context.Context, options *FirewallsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls" + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *FirewallsClient) listBySubscriptionHandleResponse(resp *http.Response) (FirewallsClientListBySubscriptionResponse, error) { + result := FirewallsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallResourceListResult); err != nil { + return FirewallsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// SaveLogProfile - Log Profile for Firewall +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - firewallName - Firewall resource name +// - options - FirewallsClientSaveLogProfileOptions contains the optional parameters for the FirewallsClient.SaveLogProfile +// method. +func (client *FirewallsClient) SaveLogProfile(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientSaveLogProfileOptions) (FirewallsClientSaveLogProfileResponse, error) { + req, err := client.saveLogProfileCreateRequest(ctx, resourceGroupName, firewallName, options) + if err != nil { + return FirewallsClientSaveLogProfileResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallsClientSaveLogProfileResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return FirewallsClientSaveLogProfileResponse{}, runtime.NewResponseError(resp) + } + return FirewallsClientSaveLogProfileResponse{}, nil +} + +// saveLogProfileCreateRequest creates the SaveLogProfile request. +func (client *FirewallsClient) saveLogProfileCreateRequest(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallsClientSaveLogProfileOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/saveLogProfile" + 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 firewallName == "" { + return nil, errors.New("parameter firewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallName}", url.PathEscape(firewallName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.LogSettings != nil { + return req, runtime.MarshalAsJSON(req, *options.LogSettings) + } + return req, nil +} + +// Update - Update a FirewallResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - firewallName - Firewall resource name +// - properties - The resource properties to be updated. +// - options - FirewallsClientUpdateOptions contains the optional parameters for the FirewallsClient.Update method. +func (client *FirewallsClient) Update(ctx context.Context, resourceGroupName string, firewallName string, properties FirewallResourceUpdate, options *FirewallsClientUpdateOptions) (FirewallsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, firewallName, properties, options) + if err != nil { + return FirewallsClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *FirewallsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, firewallName string, properties FirewallResourceUpdate, options *FirewallsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" + 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 firewallName == "" { + return nil, errors.New("parameter firewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallName}", url.PathEscape(firewallName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// updateHandleResponse handles the Update response. +func (client *FirewallsClient) updateHandleResponse(resp *http.Response) (FirewallsClientUpdateResponse, error) { + result := FirewallsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallResource); err != nil { + return FirewallsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewalls_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewalls_client_example_test.go new file mode 100644 index 000000000000..ea7a1961f110 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewalls_client_example_test.go @@ -0,0 +1,1734 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_ListBySubscription_MaximumSet_Gen.json +func ExampleFirewallsClient_NewListBySubscriptionPager_firewallsListBySubscriptionMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFirewallsClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.FirewallResourceListResult = armpanngfw.FirewallResourceListResult{ + // Value: []*armpanngfw.FirewallResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagName": to.Ptr("value"), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // TenantID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Properties: &armpanngfw.FirewallDeploymentProperties{ + // AssociatedRulestack: &armpanngfw.RulestackDetails{ + // Location: to.Ptr("eastus"), + // ResourceID: to.Ptr("aaaaaaaaaa"), + // RulestackID: to.Ptr("aaaaaaaaaaaaaaaa"), + // }, + // DNSSettings: &armpanngfw.DNSSettings{ + // DNSServers: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.111"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + // }}, + // EnableDNSProxy: to.Ptr(armpanngfw.DNSProxyDISABLED), + // EnabledDNSType: to.Ptr(armpanngfw.EnabledDNSTypeCUSTOM), + // }, + // FrontEndSettings: []*armpanngfw.FrontendSetting{ + // { + // Name: to.Ptr("frontendsetting11"), + // BackendConfiguration: &armpanngfw.EndpointConfiguration{ + // Address: &armpanngfw.IPAddress{ + // Address: to.Ptr("20.22.32.136"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp2"), + // }, + // Port: to.Ptr("80"), + // }, + // FrontendConfiguration: &armpanngfw.EndpointConfiguration{ + // Address: &armpanngfw.IPAddress{ + // Address: to.Ptr("20.22.91.251"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp1"), + // }, + // Port: to.Ptr("80"), + // }, + // Protocol: to.Ptr(armpanngfw.ProtocolTypeTCP), + // }}, + // IsPanoramaManaged: to.Ptr(armpanngfw.BooleanEnumTRUE), + // MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + // MarketplaceSubscriptionID: to.Ptr("aa"), + // MarketplaceSubscriptionStatus: to.Ptr(armpanngfw.MarketplaceSubscriptionStatusPendingFulfillmentStart), + // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // PublisherID: to.Ptr("aaaa"), + // }, + // NetworkProfile: &armpanngfw.NetworkProfile{ + // EgressNatIP: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.111"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + // }}, + // EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + // NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + // PublicIPs: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.11"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + // }}, + // VnetConfiguration: &armpanngfw.VnetConfiguration{ + // IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + // Address: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // TrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + // }, + // UnTrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // Vnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.0.0/16"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet"), + // }, + // }, + // VwanConfiguration: &armpanngfw.VwanConfiguration{ + // IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + // Address: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // NetworkVirtualApplianceID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // TrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + // }, + // UnTrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // VHub: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // }, + // }, + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanoramaConfig: &armpanngfw.PanoramaConfig{ + // CgName: to.Ptr("PanoramaCollectorGroup"), + // ConfigString: to.Ptr("bas64EncodedString"), + // DgName: to.Ptr("PanoramaDeviceGroup"), + // HostName: to.Ptr("hostname"), + // PanoramaServer: to.Ptr("10.25.1.1"), + // PanoramaServer2: to.Ptr("10.20.1.1"), + // TplName: to.Ptr("PanoramaTemplateStack"), + // VMAuthKey: to.Ptr("SSH_AUTH_KEY"), + // }, + // PlanData: &armpanngfw.PlanData{ + // BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-13T00:46:05.283Z"); return t}()), + // PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UsageType: to.Ptr(armpanngfw.UsageTypePAYG), + // }, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_ListBySubscription_MinimumSet_Gen.json +func ExampleFirewallsClient_NewListBySubscriptionPager_firewallsListBySubscriptionMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFirewallsClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.FirewallResourceListResult = armpanngfw.FirewallResourceListResult{ + // Value: []*armpanngfw.FirewallResource{ + // { + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/providers/PaloAltoNetworks.Cloudngfw/firewalls/firewall"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.FirewallDeploymentProperties{ + // DNSSettings: &armpanngfw.DNSSettings{ + // }, + // MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // PublisherID: to.Ptr("aaaa"), + // }, + // NetworkProfile: &armpanngfw.NetworkProfile{ + // EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + // NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + // PublicIPs: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.11"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + // }}, + // }, + // PlanData: &armpanngfw.PlanData{ + // BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + // PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_ListByResourceGroup_MaximumSet_Gen.json +func ExampleFirewallsClient_NewListByResourceGroupPager_firewallsListByResourceGroupMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFirewallsClient().NewListByResourceGroupPager("firewall-rg", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.FirewallResourceListResult = armpanngfw.FirewallResourceListResult{ + // Value: []*armpanngfw.FirewallResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagName": to.Ptr("value"), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // TenantID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Properties: &armpanngfw.FirewallDeploymentProperties{ + // AssociatedRulestack: &armpanngfw.RulestackDetails{ + // Location: to.Ptr("eastus"), + // ResourceID: to.Ptr("aaaaaaaaaa"), + // RulestackID: to.Ptr("aaaaaaaaaaaaaaaa"), + // }, + // DNSSettings: &armpanngfw.DNSSettings{ + // DNSServers: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.111"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + // }}, + // EnableDNSProxy: to.Ptr(armpanngfw.DNSProxyDISABLED), + // EnabledDNSType: to.Ptr(armpanngfw.EnabledDNSTypeCUSTOM), + // }, + // FrontEndSettings: []*armpanngfw.FrontendSetting{ + // { + // Name: to.Ptr("frontendsetting11"), + // BackendConfiguration: &armpanngfw.EndpointConfiguration{ + // Address: &armpanngfw.IPAddress{ + // Address: to.Ptr("20.22.32.136"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp2"), + // }, + // Port: to.Ptr("80"), + // }, + // FrontendConfiguration: &armpanngfw.EndpointConfiguration{ + // Address: &armpanngfw.IPAddress{ + // Address: to.Ptr("20.22.91.251"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp1"), + // }, + // Port: to.Ptr("80"), + // }, + // Protocol: to.Ptr(armpanngfw.ProtocolTypeTCP), + // }}, + // IsPanoramaManaged: to.Ptr(armpanngfw.BooleanEnumTRUE), + // MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + // MarketplaceSubscriptionID: to.Ptr("aa"), + // MarketplaceSubscriptionStatus: to.Ptr(armpanngfw.MarketplaceSubscriptionStatusPendingFulfillmentStart), + // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // PublisherID: to.Ptr("aaaa"), + // }, + // NetworkProfile: &armpanngfw.NetworkProfile{ + // EgressNatIP: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.111"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + // }}, + // EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + // NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + // PublicIPs: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.11"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + // }}, + // VnetConfiguration: &armpanngfw.VnetConfiguration{ + // IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + // Address: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // TrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + // }, + // UnTrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // Vnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.0.0/16"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet"), + // }, + // }, + // VwanConfiguration: &armpanngfw.VwanConfiguration{ + // IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + // Address: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // NetworkVirtualApplianceID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // TrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + // }, + // UnTrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // VHub: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // }, + // }, + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanoramaConfig: &armpanngfw.PanoramaConfig{ + // CgName: to.Ptr("PanoramaCollectorGroup"), + // ConfigString: to.Ptr("bas64EncodedString"), + // DgName: to.Ptr("PanoramaDeviceGroup"), + // HostName: to.Ptr("hostname"), + // PanoramaServer: to.Ptr("10.25.1.1"), + // PanoramaServer2: to.Ptr("10.20.1.1"), + // TplName: to.Ptr("PanoramaTemplateStack"), + // VMAuthKey: to.Ptr("SSH_AUTH_KEY"), + // }, + // PlanData: &armpanngfw.PlanData{ + // BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-13T00:46:05.283Z"); return t}()), + // PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UsageType: to.Ptr(armpanngfw.UsageTypePAYG), + // }, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_ListByResourceGroup_MinimumSet_Gen.json +func ExampleFirewallsClient_NewListByResourceGroupPager_firewallsListByResourceGroupMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFirewallsClient().NewListByResourceGroupPager("firewall-rg", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.FirewallResourceListResult = armpanngfw.FirewallResourceListResult{ + // Value: []*armpanngfw.FirewallResource{ + // { + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/firewalls/firewall"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.FirewallDeploymentProperties{ + // DNSSettings: &armpanngfw.DNSSettings{ + // }, + // MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // PublisherID: to.Ptr("aaaa"), + // }, + // NetworkProfile: &armpanngfw.NetworkProfile{ + // EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + // NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + // PublicIPs: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.11"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + // }}, + // }, + // PlanData: &armpanngfw.PlanData{ + // BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + // PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_Get_MaximumSet_Gen.json +func ExampleFirewallsClient_Get_firewallsGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallsClient().Get(ctx, "firewall-rg", "firewall1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FirewallResource = armpanngfw.FirewallResource{ + // Name: to.Ptr("aaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagName": to.Ptr("value"), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // TenantID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Properties: &armpanngfw.FirewallDeploymentProperties{ + // AssociatedRulestack: &armpanngfw.RulestackDetails{ + // Location: to.Ptr("eastus"), + // ResourceID: to.Ptr("aaaaaaaaaa"), + // RulestackID: to.Ptr("aaaaaaaaaaaaaaaa"), + // }, + // DNSSettings: &armpanngfw.DNSSettings{ + // DNSServers: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.111"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + // }}, + // EnableDNSProxy: to.Ptr(armpanngfw.DNSProxyDISABLED), + // EnabledDNSType: to.Ptr(armpanngfw.EnabledDNSTypeCUSTOM), + // }, + // FrontEndSettings: []*armpanngfw.FrontendSetting{ + // { + // Name: to.Ptr("frontendsetting11"), + // BackendConfiguration: &armpanngfw.EndpointConfiguration{ + // Address: &armpanngfw.IPAddress{ + // Address: to.Ptr("20.22.32.136"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp2"), + // }, + // Port: to.Ptr("80"), + // }, + // FrontendConfiguration: &armpanngfw.EndpointConfiguration{ + // Address: &armpanngfw.IPAddress{ + // Address: to.Ptr("20.22.91.251"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp1"), + // }, + // Port: to.Ptr("80"), + // }, + // Protocol: to.Ptr(armpanngfw.ProtocolTypeTCP), + // }}, + // IsPanoramaManaged: to.Ptr(armpanngfw.BooleanEnumTRUE), + // MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + // MarketplaceSubscriptionID: to.Ptr("aa"), + // MarketplaceSubscriptionStatus: to.Ptr(armpanngfw.MarketplaceSubscriptionStatusPendingFulfillmentStart), + // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // PublisherID: to.Ptr("aaaa"), + // }, + // NetworkProfile: &armpanngfw.NetworkProfile{ + // EgressNatIP: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.111"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + // }}, + // EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + // NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + // PublicIPs: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.11"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + // }}, + // VnetConfiguration: &armpanngfw.VnetConfiguration{ + // IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + // Address: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // TrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + // }, + // UnTrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // Vnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.0.0/16"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet"), + // }, + // }, + // VwanConfiguration: &armpanngfw.VwanConfiguration{ + // IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + // Address: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // NetworkVirtualApplianceID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // TrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + // }, + // UnTrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // VHub: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // }, + // }, + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanoramaConfig: &armpanngfw.PanoramaConfig{ + // CgName: to.Ptr("PanoramaCollectorGroup"), + // ConfigString: to.Ptr("bas64EncodedString"), + // DgName: to.Ptr("PanoramaDeviceGroup"), + // HostName: to.Ptr("hostname"), + // PanoramaServer: to.Ptr("10.25.1.1"), + // PanoramaServer2: to.Ptr("10.20.1.1"), + // TplName: to.Ptr("PanoramaTemplateStack"), + // VMAuthKey: to.Ptr("SSH_AUTH_KEY"), + // }, + // PlanData: &armpanngfw.PlanData{ + // BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-13T00:46:05.283Z"); return t}()), + // PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UsageType: to.Ptr(armpanngfw.UsageTypePAYG), + // }, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_Get_MinimumSet_Gen.json +func ExampleFirewallsClient_Get_firewallsGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallsClient().Get(ctx, "firewall-rg", "firewall1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FirewallResource = armpanngfw.FirewallResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/firewalls/firewall1"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.FirewallDeploymentProperties{ + // DNSSettings: &armpanngfw.DNSSettings{ + // }, + // MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // PublisherID: to.Ptr("aaaa"), + // }, + // NetworkProfile: &armpanngfw.NetworkProfile{ + // EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + // NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + // PublicIPs: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.11"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + // }}, + // }, + // PlanData: &armpanngfw.PlanData{ + // BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + // PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_CreateOrUpdate_MaximumSet_Gen.json +func ExampleFirewallsClient_BeginCreateOrUpdate_firewallsCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFirewallsClient().BeginCreateOrUpdate(ctx, "firewall-rg", "firewall1", armpanngfw.FirewallResource{ + Location: to.Ptr("eastus"), + Tags: map[string]*string{ + "tagName": to.Ptr("value"), + }, + Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + "key16": { + ClientID: to.Ptr("aaaa"), + PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + }, + }, + }, + Properties: &armpanngfw.FirewallDeploymentProperties{ + AssociatedRulestack: &armpanngfw.RulestackDetails{ + Location: to.Ptr("eastus"), + ResourceID: to.Ptr("lrs1"), + RulestackID: to.Ptr("PANRSID"), + }, + DNSSettings: &armpanngfw.DNSSettings{ + DNSServers: []*armpanngfw.IPAddress{ + { + Address: to.Ptr("20.22.92.111"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + }}, + EnableDNSProxy: to.Ptr(armpanngfw.DNSProxyDISABLED), + EnabledDNSType: to.Ptr(armpanngfw.EnabledDNSTypeCUSTOM), + }, + FrontEndSettings: []*armpanngfw.FrontendSetting{ + { + Name: to.Ptr("frontendsetting11"), + BackendConfiguration: &armpanngfw.EndpointConfiguration{ + Address: &armpanngfw.IPAddress{ + Address: to.Ptr("20.22.32.136"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp2"), + }, + Port: to.Ptr("80"), + }, + FrontendConfiguration: &armpanngfw.EndpointConfiguration{ + Address: &armpanngfw.IPAddress{ + Address: to.Ptr("20.22.91.251"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp1"), + }, + Port: to.Ptr("80"), + }, + Protocol: to.Ptr(armpanngfw.ProtocolTypeTCP), + }}, + IsPanoramaManaged: to.Ptr(armpanngfw.BooleanEnumTRUE), + MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + MarketplaceSubscriptionStatus: to.Ptr(armpanngfw.MarketplaceSubscriptionStatusPendingFulfillmentStart), + OfferID: to.Ptr("liftr-pan-ame-test"), + PublisherID: to.Ptr("isvtestuklegacy"), + }, + NetworkProfile: &armpanngfw.NetworkProfile{ + EgressNatIP: []*armpanngfw.IPAddress{ + { + Address: to.Ptr("20.22.92.111"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + }}, + EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + PublicIPs: []*armpanngfw.IPAddress{ + { + Address: to.Ptr("20.22.92.11"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + }}, + VnetConfiguration: &armpanngfw.VnetConfiguration{ + IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + Address: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + }, + TrustSubnet: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + }, + UnTrustSubnet: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + }, + Vnet: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.0.0/16"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet"), + }, + }, + VwanConfiguration: &armpanngfw.VwanConfiguration{ + IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + Address: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + }, + NetworkVirtualApplianceID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + TrustSubnet: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + }, + UnTrustSubnet: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + }, + VHub: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + }, + }, + }, + PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + PanoramaConfig: &armpanngfw.PanoramaConfig{ + ConfigString: to.Ptr("bas64EncodedString"), + }, + PlanData: &armpanngfw.PlanData{ + BillingCycle: to.Ptr(armpanngfw.BillingCycleMONTHLY), + PlanID: to.Ptr("liftrpantestplan"), + UsageType: to.Ptr(armpanngfw.UsageTypePAYG), + }, + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FirewallResource = armpanngfw.FirewallResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("firewalls"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/firewalls/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagName": to.Ptr("value"), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // TenantID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Properties: &armpanngfw.FirewallDeploymentProperties{ + // AssociatedRulestack: &armpanngfw.RulestackDetails{ + // Location: to.Ptr("eastus"), + // ResourceID: to.Ptr("aaaaaaaaaa"), + // RulestackID: to.Ptr("aaaaaaaaaaaaaaaa"), + // }, + // DNSSettings: &armpanngfw.DNSSettings{ + // DNSServers: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.111"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + // }}, + // EnableDNSProxy: to.Ptr(armpanngfw.DNSProxyDISABLED), + // EnabledDNSType: to.Ptr(armpanngfw.EnabledDNSTypeCUSTOM), + // }, + // FrontEndSettings: []*armpanngfw.FrontendSetting{ + // { + // Name: to.Ptr("frontendsetting11"), + // BackendConfiguration: &armpanngfw.EndpointConfiguration{ + // Address: &armpanngfw.IPAddress{ + // Address: to.Ptr("20.22.32.136"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp2"), + // }, + // Port: to.Ptr("80"), + // }, + // FrontendConfiguration: &armpanngfw.EndpointConfiguration{ + // Address: &armpanngfw.IPAddress{ + // Address: to.Ptr("20.22.91.251"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp1"), + // }, + // Port: to.Ptr("80"), + // }, + // Protocol: to.Ptr(armpanngfw.ProtocolTypeTCP), + // }}, + // IsPanoramaManaged: to.Ptr(armpanngfw.BooleanEnumTRUE), + // MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + // MarketplaceSubscriptionID: to.Ptr("aa"), + // MarketplaceSubscriptionStatus: to.Ptr(armpanngfw.MarketplaceSubscriptionStatusPendingFulfillmentStart), + // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // PublisherID: to.Ptr("aaaa"), + // }, + // NetworkProfile: &armpanngfw.NetworkProfile{ + // EgressNatIP: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.111"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + // }}, + // EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + // NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + // PublicIPs: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.11"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + // }}, + // VnetConfiguration: &armpanngfw.VnetConfiguration{ + // IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + // Address: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // TrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + // }, + // UnTrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // Vnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.0.0/16"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet"), + // }, + // }, + // VwanConfiguration: &armpanngfw.VwanConfiguration{ + // IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + // Address: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // NetworkVirtualApplianceID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // TrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + // }, + // UnTrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // VHub: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // }, + // }, + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanoramaConfig: &armpanngfw.PanoramaConfig{ + // CgName: to.Ptr("PanoramaCollectorGroup"), + // ConfigString: to.Ptr("bas64EncodedString"), + // DgName: to.Ptr("PanoramaDeviceGroup"), + // HostName: to.Ptr("hostname"), + // PanoramaServer: to.Ptr("10.25.1.1"), + // PanoramaServer2: to.Ptr("10.20.1.1"), + // TplName: to.Ptr("PanoramaTemplateStack"), + // VMAuthKey: to.Ptr("SSH_AUTH_KEY"), + // }, + // PlanData: &armpanngfw.PlanData{ + // BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-13T00:46:05.283Z"); return t}()), + // PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UsageType: to.Ptr(armpanngfw.UsageTypePAYG), + // }, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_CreateOrUpdate_MinimumSet_Gen.json +func ExampleFirewallsClient_BeginCreateOrUpdate_firewallsCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFirewallsClient().BeginCreateOrUpdate(ctx, "firewall-rg", "firewall1", armpanngfw.FirewallResource{ + Location: to.Ptr("eastus"), + Properties: &armpanngfw.FirewallDeploymentProperties{ + DNSSettings: &armpanngfw.DNSSettings{}, + MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + OfferID: to.Ptr("liftr-pan-ame-test"), + PublisherID: to.Ptr("isvtestuklegacy"), + }, + NetworkProfile: &armpanngfw.NetworkProfile{ + EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + PublicIPs: []*armpanngfw.IPAddress{ + { + Address: to.Ptr("20.22.92.11"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + }}, + }, + PlanData: &armpanngfw.PlanData{ + BillingCycle: to.Ptr(armpanngfw.BillingCycleMONTHLY), + PlanID: to.Ptr("liftrpantestplan"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FirewallResource = armpanngfw.FirewallResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/firewalls/firewall1"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.FirewallDeploymentProperties{ + // DNSSettings: &armpanngfw.DNSSettings{ + // }, + // MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // PublisherID: to.Ptr("aaaa"), + // }, + // NetworkProfile: &armpanngfw.NetworkProfile{ + // EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + // NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + // PublicIPs: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.11"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + // }}, + // }, + // PlanData: &armpanngfw.PlanData{ + // BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + // PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_Update_MaximumSet_Gen.json +func ExampleFirewallsClient_Update_firewallsUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallsClient().Update(ctx, "firewall-rg", "firewall1", armpanngfw.FirewallResourceUpdate{ + Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + "key16": { + ClientID: to.Ptr("aaaa"), + PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + }, + }, + }, + Properties: &armpanngfw.FirewallResourceUpdateProperties{ + AssociatedRulestack: &armpanngfw.RulestackDetails{ + Location: to.Ptr("eastus"), + ResourceID: to.Ptr("aaaaaaaaaa"), + RulestackID: to.Ptr("aaaaaaaaaaaaaaaa"), + }, + DNSSettings: &armpanngfw.DNSSettings{ + DNSServers: []*armpanngfw.IPAddress{ + { + Address: to.Ptr("20.22.92.111"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + }}, + EnableDNSProxy: to.Ptr(armpanngfw.DNSProxyDISABLED), + EnabledDNSType: to.Ptr(armpanngfw.EnabledDNSTypeCUSTOM), + }, + FrontEndSettings: []*armpanngfw.FrontendSetting{ + { + Name: to.Ptr("frontendsetting11"), + BackendConfiguration: &armpanngfw.EndpointConfiguration{ + Address: &armpanngfw.IPAddress{ + Address: to.Ptr("20.22.32.136"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp2"), + }, + Port: to.Ptr("80"), + }, + FrontendConfiguration: &armpanngfw.EndpointConfiguration{ + Address: &armpanngfw.IPAddress{ + Address: to.Ptr("20.22.91.251"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp1"), + }, + Port: to.Ptr("80"), + }, + Protocol: to.Ptr(armpanngfw.ProtocolTypeTCP), + }}, + IsPanoramaManaged: to.Ptr(armpanngfw.BooleanEnumTRUE), + MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + MarketplaceSubscriptionStatus: to.Ptr(armpanngfw.MarketplaceSubscriptionStatusPendingFulfillmentStart), + OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + PublisherID: to.Ptr("aaaa"), + }, + NetworkProfile: &armpanngfw.NetworkProfile{ + EgressNatIP: []*armpanngfw.IPAddress{ + { + Address: to.Ptr("20.22.92.111"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + }}, + EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + PublicIPs: []*armpanngfw.IPAddress{ + { + Address: to.Ptr("20.22.92.11"), + ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + }}, + VnetConfiguration: &armpanngfw.VnetConfiguration{ + IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + Address: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + }, + TrustSubnet: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + }, + UnTrustSubnet: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + }, + Vnet: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.0.0/16"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet"), + }, + }, + VwanConfiguration: &armpanngfw.VwanConfiguration{ + IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + Address: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + }, + NetworkVirtualApplianceID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + TrustSubnet: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + }, + UnTrustSubnet: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + }, + VHub: &armpanngfw.IPAddressSpace{ + AddressSpace: to.Ptr("10.1.1.0/24"), + ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + }, + }, + }, + PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + PanoramaConfig: &armpanngfw.PanoramaConfig{ + ConfigString: to.Ptr("bas64EncodedString"), + }, + PlanData: &armpanngfw.PlanData{ + BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + UsageType: to.Ptr(armpanngfw.UsageTypePAYG), + }, + }, + Tags: map[string]*string{ + "tagName": to.Ptr("value"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FirewallResource = armpanngfw.FirewallResource{ + // Name: to.Ptr("aaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagName": to.Ptr("value"), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // TenantID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Properties: &armpanngfw.FirewallDeploymentProperties{ + // AssociatedRulestack: &armpanngfw.RulestackDetails{ + // Location: to.Ptr("eastus"), + // ResourceID: to.Ptr("aaaaaaaaaa"), + // RulestackID: to.Ptr("aaaaaaaaaaaaaaaa"), + // }, + // DNSSettings: &armpanngfw.DNSSettings{ + // DNSServers: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.111"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + // }}, + // EnableDNSProxy: to.Ptr(armpanngfw.DNSProxyDISABLED), + // EnabledDNSType: to.Ptr(armpanngfw.EnabledDNSTypeCUSTOM), + // }, + // FrontEndSettings: []*armpanngfw.FrontendSetting{ + // { + // Name: to.Ptr("frontendsetting11"), + // BackendConfiguration: &armpanngfw.EndpointConfiguration{ + // Address: &armpanngfw.IPAddress{ + // Address: to.Ptr("20.22.32.136"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp2"), + // }, + // Port: to.Ptr("80"), + // }, + // FrontendConfiguration: &armpanngfw.EndpointConfiguration{ + // Address: &armpanngfw.IPAddress{ + // Address: to.Ptr("20.22.91.251"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-frontendSettingIp1"), + // }, + // Port: to.Ptr("80"), + // }, + // Protocol: to.Ptr(armpanngfw.ProtocolTypeTCP), + // }}, + // IsPanoramaManaged: to.Ptr(armpanngfw.BooleanEnumTRUE), + // MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + // MarketplaceSubscriptionID: to.Ptr("aa"), + // MarketplaceSubscriptionStatus: to.Ptr(armpanngfw.MarketplaceSubscriptionStatusPendingFulfillmentStart), + // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // PublisherID: to.Ptr("aaaa"), + // }, + // NetworkProfile: &armpanngfw.NetworkProfile{ + // EgressNatIP: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.111"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-egressNatIp1"), + // }}, + // EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + // NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + // PublicIPs: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.11"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + // }}, + // VnetConfiguration: &armpanngfw.VnetConfiguration{ + // IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + // Address: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // TrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + // }, + // UnTrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // Vnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.0.0/16"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet"), + // }, + // }, + // VwanConfiguration: &armpanngfw.VwanConfiguration{ + // IPOfTrustSubnetForUdr: &armpanngfw.IPAddress{ + // Address: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // NetworkVirtualApplianceID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // TrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-trust-subnet"), + // }, + // UnTrustSubnet: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // VHub: &armpanngfw.IPAddressSpace{ + // AddressSpace: to.Ptr("10.1.1.0/24"), + // ResourceID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/os-liftr-integration/providers/Microsoft.Network/virtualNetworks/os-liftr-integration-vnet/subnets/os-liftr-integration-untrust-subnet"), + // }, + // }, + // }, + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanoramaConfig: &armpanngfw.PanoramaConfig{ + // CgName: to.Ptr("PanoramaCollectorGroup"), + // ConfigString: to.Ptr("bas64EncodedString"), + // DgName: to.Ptr("PanoramaDeviceGroup"), + // HostName: to.Ptr("hostname"), + // PanoramaServer: to.Ptr("10.25.1.1"), + // PanoramaServer2: to.Ptr("10.20.1.1"), + // TplName: to.Ptr("PanoramaTemplateStack"), + // VMAuthKey: to.Ptr("SSH_AUTH_KEY"), + // }, + // PlanData: &armpanngfw.PlanData{ + // BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + // EffectiveDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-13T00:46:05.283Z"); return t}()), + // PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UsageType: to.Ptr(armpanngfw.UsageTypePAYG), + // }, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_Update_MinimumSet_Gen.json +func ExampleFirewallsClient_Update_firewallsUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallsClient().Update(ctx, "firewall-rg", "firewall1", armpanngfw.FirewallResourceUpdate{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FirewallResource = armpanngfw.FirewallResource{ + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.FirewallDeploymentProperties{ + // DNSSettings: &armpanngfw.DNSSettings{ + // }, + // MarketplaceDetails: &armpanngfw.MarketplaceDetails{ + // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // PublisherID: to.Ptr("aaaa"), + // }, + // NetworkProfile: &armpanngfw.NetworkProfile{ + // EnableEgressNat: to.Ptr(armpanngfw.EgressNatENABLED), + // NetworkType: to.Ptr(armpanngfw.NetworkTypeVNET), + // PublicIPs: []*armpanngfw.IPAddress{ + // { + // Address: to.Ptr("20.22.92.11"), + // ResourceID: to.Ptr("/subscriptions/01c7d41f-afaf-464e-8a8b-5c6f9f98cee8/resourceGroups/mj-liftr-integration/providers/Microsoft.Network/publicIPAddresses/mj-liftr-integration-PublicIp1"), + // }}, + // }, + // PlanData: &armpanngfw.PlanData{ + // BillingCycle: to.Ptr(armpanngfw.BillingCycleWEEKLY), + // PlanID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_Delete_MaximumSet_Gen.json +func ExampleFirewallsClient_BeginDelete_firewallsDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFirewallsClient().BeginDelete(ctx, "firewall-rg", "firewall1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_Delete_MinimumSet_Gen.json +func ExampleFirewallsClient_BeginDelete_firewallsDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFirewallsClient().BeginDelete(ctx, "firewall-rg", "firewall1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_getGlobalRulestack_MaximumSet_Gen.json +func ExampleFirewallsClient_GetGlobalRulestack_firewallsGetGlobalRulestackMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallsClient().GetGlobalRulestack(ctx, "firewall-rg", "firewall1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.GlobalRulestackInfo = armpanngfw.GlobalRulestackInfo{ + // AzureID: to.Ptr("aaaaaaaaaa"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_getGlobalRulestack_MinimumSet_Gen.json +func ExampleFirewallsClient_GetGlobalRulestack_firewallsGetGlobalRulestackMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallsClient().GetGlobalRulestack(ctx, "firewall-rg", "firewall1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.GlobalRulestackInfo = armpanngfw.GlobalRulestackInfo{ + // AzureID: to.Ptr("aaaaaaaaaa"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_getLogProfile_MaximumSet_Gen.json +func ExampleFirewallsClient_GetLogProfile_firewallsGetLogProfileMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallsClient().GetLogProfile(ctx, "firewall-rg", "firewall1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LogSettings = armpanngfw.LogSettings{ + // ApplicationInsights: &armpanngfw.ApplicationInsights{ + // ID: to.Ptr("aaaaaaaaaaaaaaaa"), + // Key: to.Ptr("aaaaaaaaaaaaa"), + // }, + // CommonDestination: &armpanngfw.LogDestination{ + // EventHubConfigurations: &armpanngfw.EventHub{ + // Name: to.Ptr("aaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaa"), + // NameSpace: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + // PolicyName: to.Ptr("aaaaaaaaaaaa"), + // SubscriptionID: to.Ptr("aaaaaaaaaa"), + // }, + // MonitorConfigurations: &armpanngfw.MonitorLog{ + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // PrimaryKey: to.Ptr("aaaaaaaaaaaaa"), + // SecondaryKey: to.Ptr("a"), + // SubscriptionID: to.Ptr("aaaaaaaaaaaaa"), + // Workspace: to.Ptr("aaaaaaaaaaa"), + // }, + // StorageConfigurations: &armpanngfw.StorageAccount{ + // AccountName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaa"), + // SubscriptionID: to.Ptr("aaaaaaaaa"), + // }, + // }, + // DecryptLogDestination: &armpanngfw.LogDestination{ + // EventHubConfigurations: &armpanngfw.EventHub{ + // Name: to.Ptr("aaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaa"), + // NameSpace: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + // PolicyName: to.Ptr("aaaaaaaaaaaa"), + // SubscriptionID: to.Ptr("aaaaaaaaaa"), + // }, + // MonitorConfigurations: &armpanngfw.MonitorLog{ + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // PrimaryKey: to.Ptr("aaaaaaaaaaaaa"), + // SecondaryKey: to.Ptr("a"), + // SubscriptionID: to.Ptr("aaaaaaaaaaaaa"), + // Workspace: to.Ptr("aaaaaaaaaaa"), + // }, + // StorageConfigurations: &armpanngfw.StorageAccount{ + // AccountName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaa"), + // SubscriptionID: to.Ptr("aaaaaaaaa"), + // }, + // }, + // LogOption: to.Ptr(armpanngfw.LogOptionSAMEDESTINATION), + // LogType: to.Ptr(armpanngfw.LogTypeTRAFFIC), + // ThreatLogDestination: &armpanngfw.LogDestination{ + // EventHubConfigurations: &armpanngfw.EventHub{ + // Name: to.Ptr("aaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaa"), + // NameSpace: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + // PolicyName: to.Ptr("aaaaaaaaaaaa"), + // SubscriptionID: to.Ptr("aaaaaaaaaa"), + // }, + // MonitorConfigurations: &armpanngfw.MonitorLog{ + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // PrimaryKey: to.Ptr("aaaaaaaaaaaaa"), + // SecondaryKey: to.Ptr("a"), + // SubscriptionID: to.Ptr("aaaaaaaaaaaaa"), + // Workspace: to.Ptr("aaaaaaaaaaa"), + // }, + // StorageConfigurations: &armpanngfw.StorageAccount{ + // AccountName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaa"), + // SubscriptionID: to.Ptr("aaaaaaaaa"), + // }, + // }, + // TrafficLogDestination: &armpanngfw.LogDestination{ + // EventHubConfigurations: &armpanngfw.EventHub{ + // Name: to.Ptr("aaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaa"), + // NameSpace: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + // PolicyName: to.Ptr("aaaaaaaaaaaa"), + // SubscriptionID: to.Ptr("aaaaaaaaaa"), + // }, + // MonitorConfigurations: &armpanngfw.MonitorLog{ + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // PrimaryKey: to.Ptr("aaaaaaaaaaaaa"), + // SecondaryKey: to.Ptr("a"), + // SubscriptionID: to.Ptr("aaaaaaaaaaaaa"), + // Workspace: to.Ptr("aaaaaaaaaaa"), + // }, + // StorageConfigurations: &armpanngfw.StorageAccount{ + // AccountName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaa"), + // SubscriptionID: to.Ptr("aaaaaaaaa"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_getLogProfile_MinimumSet_Gen.json +func ExampleFirewallsClient_GetLogProfile_firewallsGetLogProfileMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallsClient().GetLogProfile(ctx, "firewall-rg", "firewall1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LogSettings = armpanngfw.LogSettings{ + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_getSupportInfo_MaximumSet_Gen.json +func ExampleFirewallsClient_GetSupportInfo_firewallsGetSupportInfoMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallsClient().GetSupportInfo(ctx, "rgopenapi", "firewall1", &armpanngfw.FirewallsClientGetSupportInfoOptions{Email: to.Ptr("user1@domain.com")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SupportInfo = armpanngfw.SupportInfo{ + // AccountID: to.Ptr("3cg5b439-294d-4c25-b0b2-ef649e0g6d38"), + // AccountRegistered: to.Ptr(armpanngfw.BooleanEnumTRUE), + // FreeTrial: to.Ptr(armpanngfw.BooleanEnumTRUE), + // FreeTrialCreditLeft: to.Ptr[int32](10), + // FreeTrialDaysLeft: to.Ptr[int32](1), + // HelpURL: to.Ptr("https://ssopreview.paloaltonetworks.com/home/bookmark/0oa4ao61shG4rd3Ub1d7/2557"), + // ProductSerial: to.Ptr("e22715cb-7e4e-4814-ad4f-ccd1417755d7"), + // ProductSKU: to.Ptr("62f63e3c-bc5a-4d68-a8a1-fcba9f526c90"), + // RegisterURL: to.Ptr("https://ssopreview.paloaltonetworks.com/home/bookmark/0oa4ao61shG4rd3Ub1d7/2557"), + // SupportURL: to.Ptr("https://ssopreview.paloaltonetworks.com/home/bookmark/0oa4ao61shG4rd3Ub1d7/2557"), + // UserDomainSupported: to.Ptr(armpanngfw.BooleanEnumTRUE), + // UserRegistered: to.Ptr(armpanngfw.BooleanEnumTRUE), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_getSupportInfo_MinimumSet_Gen.json +func ExampleFirewallsClient_GetSupportInfo_firewallsGetSupportInfoMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallsClient().GetSupportInfo(ctx, "rgopenapi", "firewall1", &armpanngfw.FirewallsClientGetSupportInfoOptions{Email: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SupportInfo = armpanngfw.SupportInfo{ + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_saveLogProfile_MaximumSet_Gen.json +func ExampleFirewallsClient_SaveLogProfile_firewallsSaveLogProfileMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewFirewallsClient().SaveLogProfile(ctx, "firewall-rg", "firewall1", &armpanngfw.FirewallsClientSaveLogProfileOptions{LogSettings: &armpanngfw.LogSettings{ + ApplicationInsights: &armpanngfw.ApplicationInsights{ + ID: to.Ptr("aaaaaaaaaaaaaaaa"), + Key: to.Ptr("aaaaaaaaaaaaa"), + }, + CommonDestination: &armpanngfw.LogDestination{ + EventHubConfigurations: &armpanngfw.EventHub{ + Name: to.Ptr("aaaaaaaa"), + ID: to.Ptr("aaaaaaaaaa"), + NameSpace: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + PolicyName: to.Ptr("aaaaaaaaaaaa"), + SubscriptionID: to.Ptr("aaaaaaaaaa"), + }, + MonitorConfigurations: &armpanngfw.MonitorLog{ + ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + PrimaryKey: to.Ptr("aaaaaaaaaaaaa"), + SecondaryKey: to.Ptr("a"), + SubscriptionID: to.Ptr("aaaaaaaaaaaaa"), + Workspace: to.Ptr("aaaaaaaaaaa"), + }, + StorageConfigurations: &armpanngfw.StorageAccount{ + AccountName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + ID: to.Ptr("aaaaaaaaaaaaaaa"), + SubscriptionID: to.Ptr("aaaaaaaaa"), + }, + }, + DecryptLogDestination: &armpanngfw.LogDestination{ + EventHubConfigurations: &armpanngfw.EventHub{ + Name: to.Ptr("aaaaaaaa"), + ID: to.Ptr("aaaaaaaaaa"), + NameSpace: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + PolicyName: to.Ptr("aaaaaaaaaaaa"), + SubscriptionID: to.Ptr("aaaaaaaaaa"), + }, + MonitorConfigurations: &armpanngfw.MonitorLog{ + ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + PrimaryKey: to.Ptr("aaaaaaaaaaaaa"), + SecondaryKey: to.Ptr("a"), + SubscriptionID: to.Ptr("aaaaaaaaaaaaa"), + Workspace: to.Ptr("aaaaaaaaaaa"), + }, + StorageConfigurations: &armpanngfw.StorageAccount{ + AccountName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + ID: to.Ptr("aaaaaaaaaaaaaaa"), + SubscriptionID: to.Ptr("aaaaaaaaa"), + }, + }, + LogOption: to.Ptr(armpanngfw.LogOptionSAMEDESTINATION), + LogType: to.Ptr(armpanngfw.LogTypeTRAFFIC), + ThreatLogDestination: &armpanngfw.LogDestination{ + EventHubConfigurations: &armpanngfw.EventHub{ + Name: to.Ptr("aaaaaaaa"), + ID: to.Ptr("aaaaaaaaaa"), + NameSpace: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + PolicyName: to.Ptr("aaaaaaaaaaaa"), + SubscriptionID: to.Ptr("aaaaaaaaaa"), + }, + MonitorConfigurations: &armpanngfw.MonitorLog{ + ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + PrimaryKey: to.Ptr("aaaaaaaaaaaaa"), + SecondaryKey: to.Ptr("a"), + SubscriptionID: to.Ptr("aaaaaaaaaaaaa"), + Workspace: to.Ptr("aaaaaaaaaaa"), + }, + StorageConfigurations: &armpanngfw.StorageAccount{ + AccountName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + ID: to.Ptr("aaaaaaaaaaaaaaa"), + SubscriptionID: to.Ptr("aaaaaaaaa"), + }, + }, + TrafficLogDestination: &armpanngfw.LogDestination{ + EventHubConfigurations: &armpanngfw.EventHub{ + Name: to.Ptr("aaaaaaaa"), + ID: to.Ptr("aaaaaaaaaa"), + NameSpace: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + PolicyName: to.Ptr("aaaaaaaaaaaa"), + SubscriptionID: to.Ptr("aaaaaaaaaa"), + }, + MonitorConfigurations: &armpanngfw.MonitorLog{ + ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + PrimaryKey: to.Ptr("aaaaaaaaaaaaa"), + SecondaryKey: to.Ptr("a"), + SubscriptionID: to.Ptr("aaaaaaaaaaaaa"), + Workspace: to.Ptr("aaaaaaaaaaa"), + }, + StorageConfigurations: &armpanngfw.StorageAccount{ + AccountName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + ID: to.Ptr("aaaaaaaaaaaaaaa"), + SubscriptionID: to.Ptr("aaaaaaaaa"), + }, + }, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Firewalls_saveLogProfile_MinimumSet_Gen.json +func ExampleFirewallsClient_SaveLogProfile_firewallsSaveLogProfileMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewFirewallsClient().SaveLogProfile(ctx, "firewall-rg", "firewall1", &armpanngfw.FirewallsClientSaveLogProfileOptions{LogSettings: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewallstatus_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewallstatus_client.go new file mode 100644 index 000000000000..a0ec2d96d03f --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewallstatus_client.go @@ -0,0 +1,172 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallStatusClient contains the methods for the FirewallStatus group. +// Don't use this type directly, use NewFirewallStatusClient() instead. +type FirewallStatusClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFirewallStatusClient creates a new instance of FirewallStatusClient 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 NewFirewallStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallStatusClient, error) { + cl, err := arm.NewClient(moduleName+".FirewallStatusClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirewallStatusClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a FirewallStatusResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - firewallName - Firewall resource name +// - options - FirewallStatusClientGetOptions contains the optional parameters for the FirewallStatusClient.Get method. +func (client *FirewallStatusClient) Get(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallStatusClientGetOptions) (FirewallStatusClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, firewallName, options) + if err != nil { + return FirewallStatusClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallStatusClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallStatusClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FirewallStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallStatusClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses/default" + 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 firewallName == "" { + return nil, errors.New("parameter firewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallName}", url.PathEscape(firewallName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FirewallStatusClient) getHandleResponse(resp *http.Response) (FirewallStatusClientGetResponse, error) { + result := FirewallStatusClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallStatusResource); err != nil { + return FirewallStatusClientGetResponse{}, err + } + return result, nil +} + +// NewListByFirewallsPager - List FirewallStatusResource resources by Firewalls +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - firewallName - Firewall resource name +// - options - FirewallStatusClientListByFirewallsOptions contains the optional parameters for the FirewallStatusClient.NewListByFirewallsPager +// method. +func (client *FirewallStatusClient) NewListByFirewallsPager(resourceGroupName string, firewallName string, options *FirewallStatusClientListByFirewallsOptions) *runtime.Pager[FirewallStatusClientListByFirewallsResponse] { + return runtime.NewPager(runtime.PagingHandler[FirewallStatusClientListByFirewallsResponse]{ + More: func(page FirewallStatusClientListByFirewallsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FirewallStatusClientListByFirewallsResponse) (FirewallStatusClientListByFirewallsResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByFirewallsCreateRequest(ctx, resourceGroupName, firewallName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FirewallStatusClientListByFirewallsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallStatusClientListByFirewallsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallStatusClientListByFirewallsResponse{}, runtime.NewResponseError(resp) + } + return client.listByFirewallsHandleResponse(resp) + }, + }) +} + +// listByFirewallsCreateRequest creates the ListByFirewalls request. +func (client *FirewallStatusClient) listByFirewallsCreateRequest(ctx context.Context, resourceGroupName string, firewallName string, options *FirewallStatusClientListByFirewallsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/statuses" + 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 firewallName == "" { + return nil, errors.New("parameter firewallName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallName}", url.PathEscape(firewallName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFirewallsHandleResponse handles the ListByFirewalls response. +func (client *FirewallStatusClient) listByFirewallsHandleResponse(resp *http.Response) (FirewallStatusClientListByFirewallsResponse, error) { + result := FirewallStatusClientListByFirewallsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallStatusResourceListResult); err != nil { + return FirewallStatusClientListByFirewallsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewallstatus_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewallstatus_client_example_test.go new file mode 100644 index 000000000000..160373e157f3 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/firewallstatus_client_example_test.go @@ -0,0 +1,170 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FirewallStatus_ListByFirewalls_MaximumSet_Gen.json +func ExampleFirewallStatusClient_NewListByFirewallsPager_firewallStatusListByFirewallsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFirewallStatusClient().NewListByFirewallsPager("rgopenapi", "firewall1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.FirewallStatusResourceListResult = armpanngfw.FirewallStatusResourceListResult{ + // Value: []*armpanngfw.FirewallStatusResource{ + // { + // Name: to.Ptr("default"), + // Type: to.Ptr("aaaaaaa"), + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/firewalls/firewall1/statuses/default"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.FirewallStatusProperty{ + // HealthReason: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // HealthStatus: to.Ptr(armpanngfw.HealthStatusGREEN), + // IsPanoramaManaged: to.Ptr(armpanngfw.BooleanEnumTRUE), + // PanoramaStatus: &armpanngfw.PanoramaStatus{ + // PanoramaServer2Status: to.Ptr(armpanngfw.ServerStatusUP), + // PanoramaServerStatus: to.Ptr(armpanngfw.ServerStatusUP), + // }, + // ProvisioningState: to.Ptr(armpanngfw.ReadOnlyProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FirewallStatus_ListByFirewalls_MinimumSet_Gen.json +func ExampleFirewallStatusClient_NewListByFirewallsPager_firewallStatusListByFirewallsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFirewallStatusClient().NewListByFirewallsPager("rgopenapi", "firewall1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.FirewallStatusResourceListResult = armpanngfw.FirewallStatusResourceListResult{ + // Value: []*armpanngfw.FirewallStatusResource{ + // { + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/firewalls/firewall1/statuses/default"), + // Properties: &armpanngfw.FirewallStatusProperty{ + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FirewallStatus_Get_MaximumSet_Gen.json +func ExampleFirewallStatusClient_Get_firewallStatusGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallStatusClient().Get(ctx, "rgopenapi", "firewall1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FirewallStatusResource = armpanngfw.FirewallStatusResource{ + // Name: to.Ptr("default"), + // Type: to.Ptr("aaaa"), + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/firewalls/firewall1/statuses/default"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.FirewallStatusProperty{ + // HealthReason: to.Ptr("aaaaaaaaaaaa"), + // HealthStatus: to.Ptr(armpanngfw.HealthStatusGREEN), + // IsPanoramaManaged: to.Ptr(armpanngfw.BooleanEnumTRUE), + // PanoramaStatus: &armpanngfw.PanoramaStatus{ + // PanoramaServer2Status: to.Ptr(armpanngfw.ServerStatusUP), + // PanoramaServerStatus: to.Ptr(armpanngfw.ServerStatusUP), + // }, + // ProvisioningState: to.Ptr(armpanngfw.ReadOnlyProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FirewallStatus_Get_MinimumSet_Gen.json +func ExampleFirewallStatusClient_Get_firewallStatusGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallStatusClient().Get(ctx, "rgopenapi", "firewall1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FirewallStatusResource = armpanngfw.FirewallStatusResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/firewalls/firewall1/statuses/default"), + // Properties: &armpanngfw.FirewallStatusProperty{ + // }, + // } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistglobalrulestack_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistglobalrulestack_client.go new file mode 100644 index 000000000000..f9fb5d648650 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistglobalrulestack_client.go @@ -0,0 +1,284 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FqdnListGlobalRulestackClient contains the methods for the FqdnListGlobalRulestack group. +// Don't use this type directly, use NewFqdnListGlobalRulestackClient() instead. +type FqdnListGlobalRulestackClient struct { + internal *arm.Client +} + +// NewFqdnListGlobalRulestackClient creates a new instance of FqdnListGlobalRulestackClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFqdnListGlobalRulestackClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*FqdnListGlobalRulestackClient, error) { + cl, err := arm.NewClient(moduleName+".FqdnListGlobalRulestackClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FqdnListGlobalRulestackClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a FqdnListGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - name - fqdn list name +// - resource - Resource create parameters. +// - options - FqdnListGlobalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the FqdnListGlobalRulestackClient.BeginCreateOrUpdate +// method. +func (client *FqdnListGlobalRulestackClient) BeginCreateOrUpdate(ctx context.Context, globalRulestackName string, name string, resource FqdnListGlobalRulestackResource, options *FqdnListGlobalRulestackClientBeginCreateOrUpdateOptions) (*runtime.Poller[FqdnListGlobalRulestackClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, globalRulestackName, name, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FqdnListGlobalRulestackClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FqdnListGlobalRulestackClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a FqdnListGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *FqdnListGlobalRulestackClient) createOrUpdate(ctx context.Context, globalRulestackName string, name string, resource FqdnListGlobalRulestackResource, options *FqdnListGlobalRulestackClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, globalRulestackName, name, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FqdnListGlobalRulestackClient) createOrUpdateCreateRequest(ctx context.Context, globalRulestackName string, name string, resource FqdnListGlobalRulestackResource, options *FqdnListGlobalRulestackClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a FqdnListGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - name - fqdn list name +// - options - FqdnListGlobalRulestackClientBeginDeleteOptions contains the optional parameters for the FqdnListGlobalRulestackClient.BeginDelete +// method. +func (client *FqdnListGlobalRulestackClient) BeginDelete(ctx context.Context, globalRulestackName string, name string, options *FqdnListGlobalRulestackClientBeginDeleteOptions) (*runtime.Poller[FqdnListGlobalRulestackClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, globalRulestackName, name, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FqdnListGlobalRulestackClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FqdnListGlobalRulestackClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a FqdnListGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *FqdnListGlobalRulestackClient) deleteOperation(ctx context.Context, globalRulestackName string, name string, options *FqdnListGlobalRulestackClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, globalRulestackName, name, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FqdnListGlobalRulestackClient) deleteCreateRequest(ctx context.Context, globalRulestackName string, name string, options *FqdnListGlobalRulestackClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a FqdnListGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - name - fqdn list name +// - options - FqdnListGlobalRulestackClientGetOptions contains the optional parameters for the FqdnListGlobalRulestackClient.Get +// method. +func (client *FqdnListGlobalRulestackClient) Get(ctx context.Context, globalRulestackName string, name string, options *FqdnListGlobalRulestackClientGetOptions) (FqdnListGlobalRulestackClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, globalRulestackName, name, options) + if err != nil { + return FqdnListGlobalRulestackClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FqdnListGlobalRulestackClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FqdnListGlobalRulestackClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FqdnListGlobalRulestackClient) getCreateRequest(ctx context.Context, globalRulestackName string, name string, options *FqdnListGlobalRulestackClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists/{name}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FqdnListGlobalRulestackClient) getHandleResponse(resp *http.Response) (FqdnListGlobalRulestackClientGetResponse, error) { + result := FqdnListGlobalRulestackClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FqdnListGlobalRulestackResource); err != nil { + return FqdnListGlobalRulestackClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List FqdnListGlobalRulestackResource resources by Tenant +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - FqdnListGlobalRulestackClientListOptions contains the optional parameters for the FqdnListGlobalRulestackClient.NewListPager +// method. +func (client *FqdnListGlobalRulestackClient) NewListPager(globalRulestackName string, options *FqdnListGlobalRulestackClientListOptions) *runtime.Pager[FqdnListGlobalRulestackClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FqdnListGlobalRulestackClientListResponse]{ + More: func(page FqdnListGlobalRulestackClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FqdnListGlobalRulestackClientListResponse) (FqdnListGlobalRulestackClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, globalRulestackName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FqdnListGlobalRulestackClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FqdnListGlobalRulestackClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FqdnListGlobalRulestackClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *FqdnListGlobalRulestackClient) listCreateRequest(ctx context.Context, globalRulestackName string, options *FqdnListGlobalRulestackClientListOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/fqdnlists" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FqdnListGlobalRulestackClient) listHandleResponse(resp *http.Response) (FqdnListGlobalRulestackClientListResponse, error) { + result := FqdnListGlobalRulestackClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FqdnListGlobalRulestackResourceListResult); err != nil { + return FqdnListGlobalRulestackClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistglobalrulestack_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistglobalrulestack_client_example_test.go new file mode 100644 index 000000000000..dc9f95dc39a1 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistglobalrulestack_client_example_test.go @@ -0,0 +1,311 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListGlobalRulestack_List_MaximumSet_Gen.json +func ExampleFqdnListGlobalRulestackClient_NewListPager_fqdnListGlobalRulestackListMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFqdnListGlobalRulestackClient().NewListPager("praval", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.FqdnListGlobalRulestackResourceListResult = armpanngfw.FqdnListGlobalRulestackResourceListResult{ + // Value: []*armpanngfw.FqdnListGlobalRulestackResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.FqdnObject{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + // AuditComment: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListGlobalRulestack_List_MinimumSet_Gen.json +func ExampleFqdnListGlobalRulestackClient_NewListPager_fqdnListGlobalRulestackListMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFqdnListGlobalRulestackClient().NewListPager("praval", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.FqdnListGlobalRulestackResourceListResult = armpanngfw.FqdnListGlobalRulestackResourceListResult{ + // Value: []*armpanngfw.FqdnListGlobalRulestackResource{ + // { + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval/fqdnlists/fqdnlists1"), + // Properties: &armpanngfw.FqdnObject{ + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListGlobalRulestack_Get_MaximumSet_Gen.json +func ExampleFqdnListGlobalRulestackClient_Get_fqdnListGlobalRulestackGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFqdnListGlobalRulestackClient().Get(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FqdnListGlobalRulestackResource = armpanngfw.FqdnListGlobalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.FqdnObject{ + // Description: to.Ptr("string"), + // AuditComment: to.Ptr("string"), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListGlobalRulestack_Get_MinimumSet_Gen.json +func ExampleFqdnListGlobalRulestackClient_Get_fqdnListGlobalRulestackGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFqdnListGlobalRulestackClient().Get(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FqdnListGlobalRulestackResource = armpanngfw.FqdnListGlobalRulestackResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval/fqdnlists/armid1"), + // Properties: &armpanngfw.FqdnObject{ + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +func ExampleFqdnListGlobalRulestackClient_BeginCreateOrUpdate_fqdnListGlobalRulestackCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFqdnListGlobalRulestackClient().BeginCreateOrUpdate(ctx, "praval", "armid1", armpanngfw.FqdnListGlobalRulestackResource{ + Properties: &armpanngfw.FqdnObject{ + Description: to.Ptr("string"), + AuditComment: to.Ptr("string"), + Etag: to.Ptr("aaaaaaaaaaaaaaaaaa"), + FqdnList: []*string{ + to.Ptr("string1"), + to.Ptr("string2")}, + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FqdnListGlobalRulestackResource = armpanngfw.FqdnListGlobalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.FqdnObject{ + // Description: to.Ptr("string"), + // AuditComment: to.Ptr("string"), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +func ExampleFqdnListGlobalRulestackClient_BeginCreateOrUpdate_fqdnListGlobalRulestackCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFqdnListGlobalRulestackClient().BeginCreateOrUpdate(ctx, "praval", "armid1", armpanngfw.FqdnListGlobalRulestackResource{ + Properties: &armpanngfw.FqdnObject{ + FqdnList: []*string{ + to.Ptr("string1"), + to.Ptr("string2")}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FqdnListGlobalRulestackResource = armpanngfw.FqdnListGlobalRulestackResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval/fqdnlists/armid1"), + // Properties: &armpanngfw.FqdnObject{ + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListGlobalRulestack_Delete_MaximumSet_Gen.json +func ExampleFqdnListGlobalRulestackClient_BeginDelete_fqdnListGlobalRulestackDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFqdnListGlobalRulestackClient().BeginDelete(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListGlobalRulestack_Delete_MinimumSet_Gen.json +func ExampleFqdnListGlobalRulestackClient_BeginDelete_fqdnListGlobalRulestackDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFqdnListGlobalRulestackClient().BeginDelete(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistlocalrulestack_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistlocalrulestack_client.go new file mode 100644 index 000000000000..bdd9267c4ea0 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistlocalrulestack_client.go @@ -0,0 +1,323 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FqdnListLocalRulestackClient contains the methods for the FqdnListLocalRulestack group. +// Don't use this type directly, use NewFqdnListLocalRulestackClient() instead. +type FqdnListLocalRulestackClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFqdnListLocalRulestackClient creates a new instance of FqdnListLocalRulestackClient 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 NewFqdnListLocalRulestackClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FqdnListLocalRulestackClient, error) { + cl, err := arm.NewClient(moduleName+".FqdnListLocalRulestackClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FqdnListLocalRulestackClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a FqdnListLocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - name - fqdn list name +// - resource - Resource create parameters. +// - options - FqdnListLocalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the FqdnListLocalRulestackClient.BeginCreateOrUpdate +// method. +func (client *FqdnListLocalRulestackClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, localRulestackName string, name string, resource FqdnListLocalRulestackResource, options *FqdnListLocalRulestackClientBeginCreateOrUpdateOptions) (*runtime.Poller[FqdnListLocalRulestackClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, localRulestackName, name, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FqdnListLocalRulestackClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FqdnListLocalRulestackClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a FqdnListLocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *FqdnListLocalRulestackClient) createOrUpdate(ctx context.Context, resourceGroupName string, localRulestackName string, name string, resource FqdnListLocalRulestackResource, options *FqdnListLocalRulestackClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, localRulestackName, name, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FqdnListLocalRulestackClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, name string, resource FqdnListLocalRulestackResource, options *FqdnListLocalRulestackClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a FqdnListLocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - name - fqdn list name +// - options - FqdnListLocalRulestackClientBeginDeleteOptions contains the optional parameters for the FqdnListLocalRulestackClient.BeginDelete +// method. +func (client *FqdnListLocalRulestackClient) BeginDelete(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *FqdnListLocalRulestackClientBeginDeleteOptions) (*runtime.Poller[FqdnListLocalRulestackClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, localRulestackName, name, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FqdnListLocalRulestackClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[FqdnListLocalRulestackClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a FqdnListLocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *FqdnListLocalRulestackClient) deleteOperation(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *FqdnListLocalRulestackClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, localRulestackName, name, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FqdnListLocalRulestackClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *FqdnListLocalRulestackClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a FqdnListLocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - name - fqdn list name +// - options - FqdnListLocalRulestackClientGetOptions contains the optional parameters for the FqdnListLocalRulestackClient.Get +// method. +func (client *FqdnListLocalRulestackClient) Get(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *FqdnListLocalRulestackClientGetOptions) (FqdnListLocalRulestackClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, localRulestackName, name, options) + if err != nil { + return FqdnListLocalRulestackClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FqdnListLocalRulestackClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FqdnListLocalRulestackClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FqdnListLocalRulestackClient) getCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *FqdnListLocalRulestackClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists/{name}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FqdnListLocalRulestackClient) getHandleResponse(resp *http.Response) (FqdnListLocalRulestackClientGetResponse, error) { + result := FqdnListLocalRulestackClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FqdnListLocalRulestackResource); err != nil { + return FqdnListLocalRulestackClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocalRulestacksPager - List FqdnListLocalRulestackResource resources by LocalRulestacks +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - FqdnListLocalRulestackClientListByLocalRulestacksOptions contains the optional parameters for the FqdnListLocalRulestackClient.NewListByLocalRulestacksPager +// method. +func (client *FqdnListLocalRulestackClient) NewListByLocalRulestacksPager(resourceGroupName string, localRulestackName string, options *FqdnListLocalRulestackClientListByLocalRulestacksOptions) *runtime.Pager[FqdnListLocalRulestackClientListByLocalRulestacksResponse] { + return runtime.NewPager(runtime.PagingHandler[FqdnListLocalRulestackClientListByLocalRulestacksResponse]{ + More: func(page FqdnListLocalRulestackClientListByLocalRulestacksResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FqdnListLocalRulestackClientListByLocalRulestacksResponse) (FqdnListLocalRulestackClientListByLocalRulestacksResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByLocalRulestacksCreateRequest(ctx, resourceGroupName, localRulestackName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FqdnListLocalRulestackClientListByLocalRulestacksResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FqdnListLocalRulestackClientListByLocalRulestacksResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FqdnListLocalRulestackClientListByLocalRulestacksResponse{}, runtime.NewResponseError(resp) + } + return client.listByLocalRulestacksHandleResponse(resp) + }, + }) +} + +// listByLocalRulestacksCreateRequest creates the ListByLocalRulestacks request. +func (client *FqdnListLocalRulestackClient) listByLocalRulestacksCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *FqdnListLocalRulestackClientListByLocalRulestacksOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/fqdnlists" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocalRulestacksHandleResponse handles the ListByLocalRulestacks response. +func (client *FqdnListLocalRulestackClient) listByLocalRulestacksHandleResponse(resp *http.Response) (FqdnListLocalRulestackClientListByLocalRulestacksResponse, error) { + result := FqdnListLocalRulestackClientListByLocalRulestacksResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FqdnListLocalRulestackResourceListResult); err != nil { + return FqdnListLocalRulestackClientListByLocalRulestacksResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistlocalrulestack_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistlocalrulestack_client_example_test.go new file mode 100644 index 000000000000..593aa6d5568e --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/fqdnlistlocalrulestack_client_example_test.go @@ -0,0 +1,311 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +func ExampleFqdnListLocalRulestackClient_NewListByLocalRulestacksPager_fqdnListLocalRulestackListByLocalRulestacksMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFqdnListLocalRulestackClient().NewListByLocalRulestacksPager("rgopenapi", "lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.FqdnListLocalRulestackResourceListResult = armpanngfw.FqdnListLocalRulestackResourceListResult{ + // Value: []*armpanngfw.FqdnListLocalRulestackResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.FqdnObject{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + // AuditComment: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +func ExampleFqdnListLocalRulestackClient_NewListByLocalRulestacksPager_fqdnListLocalRulestackListByLocalRulestacksMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFqdnListLocalRulestackClient().NewListByLocalRulestacksPager("rgopenapi", "lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.FqdnListLocalRulestackResourceListResult = armpanngfw.FqdnListLocalRulestackResourceListResult{ + // Value: []*armpanngfw.FqdnListLocalRulestackResource{ + // { + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval/fqdnlists/fqdnlists1"), + // Properties: &armpanngfw.FqdnObject{ + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListLocalRulestack_Get_MaximumSet_Gen.json +func ExampleFqdnListLocalRulestackClient_Get_fqdnListLocalRulestackGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFqdnListLocalRulestackClient().Get(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FqdnListLocalRulestackResource = armpanngfw.FqdnListLocalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.FqdnObject{ + // Description: to.Ptr("string"), + // AuditComment: to.Ptr("string"), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListLocalRulestack_Get_MinimumSet_Gen.json +func ExampleFqdnListLocalRulestackClient_Get_fqdnListLocalRulestackGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFqdnListLocalRulestackClient().Get(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FqdnListLocalRulestackResource = armpanngfw.FqdnListLocalRulestackResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval/fqdnlists/armid1"), + // Properties: &armpanngfw.FqdnObject{ + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +func ExampleFqdnListLocalRulestackClient_BeginCreateOrUpdate_fqdnListLocalRulestackCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFqdnListLocalRulestackClient().BeginCreateOrUpdate(ctx, "rgopenapi", "lrs1", "armid1", armpanngfw.FqdnListLocalRulestackResource{ + Properties: &armpanngfw.FqdnObject{ + Description: to.Ptr("string"), + AuditComment: to.Ptr("string"), + Etag: to.Ptr("aaaaaaaaaaaaaaaaaa"), + FqdnList: []*string{ + to.Ptr("string1"), + to.Ptr("string2")}, + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FqdnListLocalRulestackResource = armpanngfw.FqdnListLocalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.FqdnObject{ + // Description: to.Ptr("string"), + // AuditComment: to.Ptr("string"), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +func ExampleFqdnListLocalRulestackClient_BeginCreateOrUpdate_fqdnListLocalRulestackCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFqdnListLocalRulestackClient().BeginCreateOrUpdate(ctx, "rgopenapi", "lrs1", "armid1", armpanngfw.FqdnListLocalRulestackResource{ + Properties: &armpanngfw.FqdnObject{ + FqdnList: []*string{ + to.Ptr("string1"), + to.Ptr("string2")}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.FqdnListLocalRulestackResource = armpanngfw.FqdnListLocalRulestackResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval/fqdnlists/armid1"), + // Properties: &armpanngfw.FqdnObject{ + // FqdnList: []*string{ + // to.Ptr("string1"), + // to.Ptr("string2")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListLocalRulestack_Delete_MaximumSet_Gen.json +func ExampleFqdnListLocalRulestackClient_BeginDelete_fqdnListLocalRulestackDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFqdnListLocalRulestackClient().BeginDelete(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/FqdnListLocalRulestack_Delete_MinimumSet_Gen.json +func ExampleFqdnListLocalRulestackClient_BeginDelete_fqdnListLocalRulestackDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFqdnListLocalRulestackClient().BeginDelete(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/globalrulestack_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/globalrulestack_client.go new file mode 100644 index 000000000000..37bb85ed24b0 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/globalrulestack_client.go @@ -0,0 +1,791 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +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" +) + +// GlobalRulestackClient contains the methods for the GlobalRulestack group. +// Don't use this type directly, use NewGlobalRulestackClient() instead. +type GlobalRulestackClient struct { + internal *arm.Client +} + +// NewGlobalRulestackClient creates a new instance of GlobalRulestackClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewGlobalRulestackClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GlobalRulestackClient, error) { + cl, err := arm.NewClient(moduleName+".GlobalRulestackClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GlobalRulestackClient{ + internal: cl, + } + return client, nil +} + +// BeginCommit - Commit rulestack configuration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientBeginCommitOptions contains the optional parameters for the GlobalRulestackClient.BeginCommit +// method. +func (client *GlobalRulestackClient) BeginCommit(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientBeginCommitOptions) (*runtime.Poller[GlobalRulestackClientCommitResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.commit(ctx, globalRulestackName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GlobalRulestackClientCommitResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[GlobalRulestackClientCommitResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Commit - Commit rulestack configuration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *GlobalRulestackClient) commit(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientBeginCommitOptions) (*http.Response, error) { + req, err := client.commitCreateRequest(ctx, globalRulestackName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// commitCreateRequest creates the Commit request. +func (client *GlobalRulestackClient) commitCreateRequest(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientBeginCommitOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/commit" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCreateOrUpdate - Create a GlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - resource - Resource create parameters. +// - options - GlobalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the GlobalRulestackClient.BeginCreateOrUpdate +// method. +func (client *GlobalRulestackClient) BeginCreateOrUpdate(ctx context.Context, globalRulestackName string, resource GlobalRulestackResource, options *GlobalRulestackClientBeginCreateOrUpdateOptions) (*runtime.Poller[GlobalRulestackClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, globalRulestackName, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GlobalRulestackClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[GlobalRulestackClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a GlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *GlobalRulestackClient) createOrUpdate(ctx context.Context, globalRulestackName string, resource GlobalRulestackResource, options *GlobalRulestackClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, globalRulestackName, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GlobalRulestackClient) createOrUpdateCreateRequest(ctx context.Context, globalRulestackName string, resource GlobalRulestackResource, options *GlobalRulestackClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a GlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientBeginDeleteOptions contains the optional parameters for the GlobalRulestackClient.BeginDelete +// method. +func (client *GlobalRulestackClient) BeginDelete(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientBeginDeleteOptions) (*runtime.Poller[GlobalRulestackClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, globalRulestackName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GlobalRulestackClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[GlobalRulestackClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a GlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *GlobalRulestackClient) deleteOperation(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, globalRulestackName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GlobalRulestackClient) deleteCreateRequest(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a GlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientGetOptions contains the optional parameters for the GlobalRulestackClient.Get method. +func (client *GlobalRulestackClient) Get(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientGetOptions) (GlobalRulestackClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, globalRulestackName, options) + if err != nil { + return GlobalRulestackClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GlobalRulestackClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GlobalRulestackClient) getCreateRequest(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GlobalRulestackClient) getHandleResponse(resp *http.Response) (GlobalRulestackClientGetResponse, error) { + result := GlobalRulestackClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GlobalRulestackResource); err != nil { + return GlobalRulestackClientGetResponse{}, err + } + return result, nil +} + +// GetChangeLog - Get changelog +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientGetChangeLogOptions contains the optional parameters for the GlobalRulestackClient.GetChangeLog +// method. +func (client *GlobalRulestackClient) GetChangeLog(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientGetChangeLogOptions) (GlobalRulestackClientGetChangeLogResponse, error) { + req, err := client.getChangeLogCreateRequest(ctx, globalRulestackName, options) + if err != nil { + return GlobalRulestackClientGetChangeLogResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientGetChangeLogResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GlobalRulestackClientGetChangeLogResponse{}, runtime.NewResponseError(resp) + } + return client.getChangeLogHandleResponse(resp) +} + +// getChangeLogCreateRequest creates the GetChangeLog request. +func (client *GlobalRulestackClient) getChangeLogCreateRequest(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientGetChangeLogOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/getChangeLog" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getChangeLogHandleResponse handles the GetChangeLog response. +func (client *GlobalRulestackClient) getChangeLogHandleResponse(resp *http.Response) (GlobalRulestackClientGetChangeLogResponse, error) { + result := GlobalRulestackClientGetChangeLogResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Changelog); err != nil { + return GlobalRulestackClientGetChangeLogResponse{}, err + } + return result, nil +} + +// NewListPager - List GlobalRulestackResource resources by Tenant +// +// Generated from API version 2022-08-29-preview +// - options - GlobalRulestackClientListOptions contains the optional parameters for the GlobalRulestackClient.NewListPager +// method. +func (client *GlobalRulestackClient) NewListPager(options *GlobalRulestackClientListOptions) *runtime.Pager[GlobalRulestackClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GlobalRulestackClientListResponse]{ + More: func(page GlobalRulestackClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GlobalRulestackClientListResponse) (GlobalRulestackClientListResponse, 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 GlobalRulestackClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GlobalRulestackClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *GlobalRulestackClient) listCreateRequest(ctx context.Context, options *GlobalRulestackClientListOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks" + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *GlobalRulestackClient) listHandleResponse(resp *http.Response) (GlobalRulestackClientListResponse, error) { + result := GlobalRulestackClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GlobalRulestackResourceListResult); err != nil { + return GlobalRulestackClientListResponse{}, err + } + return result, nil +} + +// ListAdvancedSecurityObjects - Get the list of advanced security objects +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientListAdvancedSecurityObjectsOptions contains the optional parameters for the GlobalRulestackClient.ListAdvancedSecurityObjects +// method. +func (client *GlobalRulestackClient) ListAdvancedSecurityObjects(ctx context.Context, globalRulestackName string, typeParam AdvSecurityObjectTypeEnum, options *GlobalRulestackClientListAdvancedSecurityObjectsOptions) (GlobalRulestackClientListAdvancedSecurityObjectsResponse, error) { + req, err := client.listAdvancedSecurityObjectsCreateRequest(ctx, globalRulestackName, typeParam, options) + if err != nil { + return GlobalRulestackClientListAdvancedSecurityObjectsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientListAdvancedSecurityObjectsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GlobalRulestackClientListAdvancedSecurityObjectsResponse{}, runtime.NewResponseError(resp) + } + return client.listAdvancedSecurityObjectsHandleResponse(resp) +} + +// listAdvancedSecurityObjectsCreateRequest creates the ListAdvancedSecurityObjects request. +func (client *GlobalRulestackClient) listAdvancedSecurityObjectsCreateRequest(ctx context.Context, globalRulestackName string, typeParam AdvSecurityObjectTypeEnum, options *GlobalRulestackClientListAdvancedSecurityObjectsOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAdvancedSecurityObjects" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.Skip != nil { + reqQP.Set("skip", *options.Skip) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("type", string(typeParam)) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAdvancedSecurityObjectsHandleResponse handles the ListAdvancedSecurityObjects response. +func (client *GlobalRulestackClient) listAdvancedSecurityObjectsHandleResponse(resp *http.Response) (GlobalRulestackClientListAdvancedSecurityObjectsResponse, error) { + result := GlobalRulestackClientListAdvancedSecurityObjectsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AdvSecurityObjectListResponse); err != nil { + return GlobalRulestackClientListAdvancedSecurityObjectsResponse{}, err + } + return result, nil +} + +// ListAppIDs - List of AppIds for GlobalRulestack ApiVersion +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientListAppIDsOptions contains the optional parameters for the GlobalRulestackClient.ListAppIDs +// method. +func (client *GlobalRulestackClient) ListAppIDs(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientListAppIDsOptions) (GlobalRulestackClientListAppIDsResponse, error) { + req, err := client.listAppIDsCreateRequest(ctx, globalRulestackName, options) + if err != nil { + return GlobalRulestackClientListAppIDsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientListAppIDsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GlobalRulestackClientListAppIDsResponse{}, runtime.NewResponseError(resp) + } + return client.listAppIDsHandleResponse(resp) +} + +// listAppIDsCreateRequest creates the ListAppIDs request. +func (client *GlobalRulestackClient) listAppIDsCreateRequest(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientListAppIDsOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listAppIds" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.AppIDVersion != nil { + reqQP.Set("appIdVersion", *options.AppIDVersion) + } + if options != nil && options.AppPrefix != nil { + reqQP.Set("appPrefix", *options.AppPrefix) + } + if options != nil && options.Skip != nil { + reqQP.Set("skip", *options.Skip) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAppIDsHandleResponse handles the ListAppIDs response. +func (client *GlobalRulestackClient) listAppIDsHandleResponse(resp *http.Response) (GlobalRulestackClientListAppIDsResponse, error) { + result := GlobalRulestackClientListAppIDsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListAppIDResponse); err != nil { + return GlobalRulestackClientListAppIDsResponse{}, err + } + return result, nil +} + +// ListCountries - List of countries for Rulestack +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientListCountriesOptions contains the optional parameters for the GlobalRulestackClient.ListCountries +// method. +func (client *GlobalRulestackClient) ListCountries(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientListCountriesOptions) (GlobalRulestackClientListCountriesResponse, error) { + req, err := client.listCountriesCreateRequest(ctx, globalRulestackName, options) + if err != nil { + return GlobalRulestackClientListCountriesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientListCountriesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GlobalRulestackClientListCountriesResponse{}, runtime.NewResponseError(resp) + } + return client.listCountriesHandleResponse(resp) +} + +// listCountriesCreateRequest creates the ListCountries request. +func (client *GlobalRulestackClient) listCountriesCreateRequest(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientListCountriesOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listCountries" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.Skip != nil { + reqQP.Set("skip", *options.Skip) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCountriesHandleResponse handles the ListCountries response. +func (client *GlobalRulestackClient) listCountriesHandleResponse(resp *http.Response) (GlobalRulestackClientListCountriesResponse, error) { + result := GlobalRulestackClientListCountriesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CountriesResponse); err != nil { + return GlobalRulestackClientListCountriesResponse{}, err + } + return result, nil +} + +// ListFirewalls - List of Firewalls associated with Rulestack +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientListFirewallsOptions contains the optional parameters for the GlobalRulestackClient.ListFirewalls +// method. +func (client *GlobalRulestackClient) ListFirewalls(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientListFirewallsOptions) (GlobalRulestackClientListFirewallsResponse, error) { + req, err := client.listFirewallsCreateRequest(ctx, globalRulestackName, options) + if err != nil { + return GlobalRulestackClientListFirewallsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientListFirewallsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GlobalRulestackClientListFirewallsResponse{}, runtime.NewResponseError(resp) + } + return client.listFirewallsHandleResponse(resp) +} + +// listFirewallsCreateRequest creates the ListFirewalls request. +func (client *GlobalRulestackClient) listFirewallsCreateRequest(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientListFirewallsOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listFirewalls" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listFirewallsHandleResponse handles the ListFirewalls response. +func (client *GlobalRulestackClient) listFirewallsHandleResponse(resp *http.Response) (GlobalRulestackClientListFirewallsResponse, error) { + result := GlobalRulestackClientListFirewallsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListFirewallsResponse); err != nil { + return GlobalRulestackClientListFirewallsResponse{}, err + } + return result, nil +} + +// ListPredefinedURLCategories - List predefined URL categories for rulestack +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientListPredefinedURLCategoriesOptions contains the optional parameters for the GlobalRulestackClient.ListPredefinedURLCategories +// method. +func (client *GlobalRulestackClient) ListPredefinedURLCategories(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientListPredefinedURLCategoriesOptions) (GlobalRulestackClientListPredefinedURLCategoriesResponse, error) { + req, err := client.listPredefinedURLCategoriesCreateRequest(ctx, globalRulestackName, options) + if err != nil { + return GlobalRulestackClientListPredefinedURLCategoriesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientListPredefinedURLCategoriesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GlobalRulestackClientListPredefinedURLCategoriesResponse{}, runtime.NewResponseError(resp) + } + return client.listPredefinedURLCategoriesHandleResponse(resp) +} + +// listPredefinedURLCategoriesCreateRequest creates the ListPredefinedURLCategories request. +func (client *GlobalRulestackClient) listPredefinedURLCategoriesCreateRequest(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientListPredefinedURLCategoriesOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listPredefinedUrlCategories" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.Skip != nil { + reqQP.Set("skip", *options.Skip) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listPredefinedURLCategoriesHandleResponse handles the ListPredefinedURLCategories response. +func (client *GlobalRulestackClient) listPredefinedURLCategoriesHandleResponse(resp *http.Response) (GlobalRulestackClientListPredefinedURLCategoriesResponse, error) { + result := GlobalRulestackClientListPredefinedURLCategoriesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PredefinedURLCategoriesResponse); err != nil { + return GlobalRulestackClientListPredefinedURLCategoriesResponse{}, err + } + return result, nil +} + +// ListSecurityServices - List the security services for rulestack +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientListSecurityServicesOptions contains the optional parameters for the GlobalRulestackClient.ListSecurityServices +// method. +func (client *GlobalRulestackClient) ListSecurityServices(ctx context.Context, globalRulestackName string, typeParam SecurityServicesTypeEnum, options *GlobalRulestackClientListSecurityServicesOptions) (GlobalRulestackClientListSecurityServicesResponse, error) { + req, err := client.listSecurityServicesCreateRequest(ctx, globalRulestackName, typeParam, options) + if err != nil { + return GlobalRulestackClientListSecurityServicesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientListSecurityServicesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GlobalRulestackClientListSecurityServicesResponse{}, runtime.NewResponseError(resp) + } + return client.listSecurityServicesHandleResponse(resp) +} + +// listSecurityServicesCreateRequest creates the ListSecurityServices request. +func (client *GlobalRulestackClient) listSecurityServicesCreateRequest(ctx context.Context, globalRulestackName string, typeParam SecurityServicesTypeEnum, options *GlobalRulestackClientListSecurityServicesOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/listSecurityServices" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.Skip != nil { + reqQP.Set("skip", *options.Skip) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("type", string(typeParam)) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSecurityServicesHandleResponse handles the ListSecurityServices response. +func (client *GlobalRulestackClient) listSecurityServicesHandleResponse(resp *http.Response) (GlobalRulestackClientListSecurityServicesResponse, error) { + result := GlobalRulestackClientListSecurityServicesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityServicesResponse); err != nil { + return GlobalRulestackClientListSecurityServicesResponse{}, err + } + return result, nil +} + +// Revert - Revert rulestack configuration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - GlobalRulestackClientRevertOptions contains the optional parameters for the GlobalRulestackClient.Revert method. +func (client *GlobalRulestackClient) Revert(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientRevertOptions) (GlobalRulestackClientRevertResponse, error) { + req, err := client.revertCreateRequest(ctx, globalRulestackName, options) + if err != nil { + return GlobalRulestackClientRevertResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientRevertResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return GlobalRulestackClientRevertResponse{}, runtime.NewResponseError(resp) + } + return GlobalRulestackClientRevertResponse{}, nil +} + +// revertCreateRequest creates the Revert request. +func (client *GlobalRulestackClient) revertCreateRequest(ctx context.Context, globalRulestackName string, options *GlobalRulestackClientRevertOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/revert" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Update a GlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - properties - The resource properties to be updated. +// - options - GlobalRulestackClientUpdateOptions contains the optional parameters for the GlobalRulestackClient.Update method. +func (client *GlobalRulestackClient) Update(ctx context.Context, globalRulestackName string, properties GlobalRulestackResourceUpdate, options *GlobalRulestackClientUpdateOptions) (GlobalRulestackClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, globalRulestackName, properties, options) + if err != nil { + return GlobalRulestackClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GlobalRulestackClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GlobalRulestackClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *GlobalRulestackClient) updateCreateRequest(ctx context.Context, globalRulestackName string, properties GlobalRulestackResourceUpdate, options *GlobalRulestackClientUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// updateHandleResponse handles the Update response. +func (client *GlobalRulestackClient) updateHandleResponse(resp *http.Response) (GlobalRulestackClientUpdateResponse, error) { + result := GlobalRulestackClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GlobalRulestackResource); err != nil { + return GlobalRulestackClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/globalrulestack_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/globalrulestack_client_example_test.go new file mode 100644 index 000000000000..b7cbad9ced12 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/globalrulestack_client_example_test.go @@ -0,0 +1,987 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_List_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_NewListPager_globalRulestackListMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewGlobalRulestackClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.GlobalRulestackResourceListResult = armpanngfw.GlobalRulestackResourceListResult{ + // Value: []*armpanngfw.GlobalRulestackResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // TenantID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + // AssociatedSubscriptions: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, + // DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + // MinAppIDVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanLocation: to.Ptr("eastus"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // Scope: to.Ptr(armpanngfw.ScopeTypeLOCAL), + // SecurityServices: &armpanngfw.SecurityServices{ + // AntiSpywareProfile: to.Ptr("aaaaaaaaaa"), + // AntiVirusProfile: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), + // DNSSubscription: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // FileBlockingProfile: to.Ptr("aaaaa"), + // OutboundTrustCertificate: to.Ptr("aaaaaa"), + // OutboundUnTrustCertificate: to.Ptr("aaaaaaaa"), + // URLFilteringProfile: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // VulnerabilityProfile: to.Ptr("aaaaaaaaaa"), + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_List_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_NewListPager_globalRulestackListMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewGlobalRulestackClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.GlobalRulestackResourceListResult = armpanngfw.GlobalRulestackResourceListResult{ + // Value: []*armpanngfw.GlobalRulestackResource{ + // { + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/grs1"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_Get_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_Get_globalRulestackGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().Get(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.GlobalRulestackResource = armpanngfw.GlobalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("globalRulestacks"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // TenantID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // Description: to.Ptr("global rulestacks"), + // AssociatedSubscriptions: []*string{ + // to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27")}, + // DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + // MinAppIDVersion: to.Ptr("8.5.3"), + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanLocation: to.Ptr("eastus"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // Scope: to.Ptr(armpanngfw.ScopeTypeGLOBAL), + // SecurityServices: &armpanngfw.SecurityServices{ + // AntiSpywareProfile: to.Ptr("default"), + // AntiVirusProfile: to.Ptr("default"), + // DNSSubscription: to.Ptr("default"), + // FileBlockingProfile: to.Ptr("default"), + // OutboundTrustCertificate: to.Ptr("default"), + // OutboundUnTrustCertificate: to.Ptr("default"), + // URLFilteringProfile: to.Ptr("default"), + // VulnerabilityProfile: to.Ptr("default"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_Get_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_Get_globalRulestackGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().Get(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.GlobalRulestackResource = armpanngfw.GlobalRulestackResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_BeginCreateOrUpdate_globalRulestackCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGlobalRulestackClient().BeginCreateOrUpdate(ctx, "praval", armpanngfw.GlobalRulestackResource{ + Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + "key16": { + ClientID: to.Ptr("aaaa"), + PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + }, + }, + }, + Location: to.Ptr("eastus"), + Properties: &armpanngfw.RulestackProperties{ + Description: to.Ptr("global rulestacks"), + AssociatedSubscriptions: []*string{ + to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27")}, + DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + MinAppIDVersion: to.Ptr("8.5.3"), + PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + PanLocation: to.Ptr("eastus"), + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + Scope: to.Ptr(armpanngfw.ScopeTypeGLOBAL), + SecurityServices: &armpanngfw.SecurityServices{ + AntiSpywareProfile: to.Ptr("default"), + AntiVirusProfile: to.Ptr("default"), + DNSSubscription: to.Ptr("default"), + FileBlockingProfile: to.Ptr("default"), + OutboundTrustCertificate: to.Ptr("default"), + OutboundUnTrustCertificate: to.Ptr("default"), + URLFilteringProfile: to.Ptr("default"), + VulnerabilityProfile: to.Ptr("default"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.GlobalRulestackResource = armpanngfw.GlobalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("globalRulestacks"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // TenantID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // Description: to.Ptr("global rulestacks"), + // AssociatedSubscriptions: []*string{ + // to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27")}, + // DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + // MinAppIDVersion: to.Ptr("8.5.3"), + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanLocation: to.Ptr("eastus"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // Scope: to.Ptr(armpanngfw.ScopeTypeGLOBAL), + // SecurityServices: &armpanngfw.SecurityServices{ + // AntiSpywareProfile: to.Ptr("default"), + // AntiVirusProfile: to.Ptr("default"), + // DNSSubscription: to.Ptr("default"), + // FileBlockingProfile: to.Ptr("default"), + // OutboundTrustCertificate: to.Ptr("default"), + // OutboundUnTrustCertificate: to.Ptr("default"), + // URLFilteringProfile: to.Ptr("default"), + // VulnerabilityProfile: to.Ptr("default"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_BeginCreateOrUpdate_globalRulestackCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGlobalRulestackClient().BeginCreateOrUpdate(ctx, "praval", armpanngfw.GlobalRulestackResource{ + Location: to.Ptr("eastus"), + Properties: &armpanngfw.RulestackProperties{}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.GlobalRulestackResource = armpanngfw.GlobalRulestackResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_Update_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_Update_globalRulestackUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().Update(ctx, "praval", armpanngfw.GlobalRulestackResourceUpdate{ + Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + "key16": { + ClientID: to.Ptr("aaaa"), + PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + }, + }, + }, + Location: to.Ptr("eastus"), + Properties: &armpanngfw.GlobalRulestackResourceUpdateProperties{ + Description: to.Ptr("global rulestacks"), + AssociatedSubscriptions: []*string{ + to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27")}, + DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + MinAppIDVersion: to.Ptr("8.5.3"), + PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + PanLocation: to.Ptr("eastus"), + Scope: to.Ptr(armpanngfw.ScopeTypeGLOBAL), + SecurityServices: &armpanngfw.SecurityServices{ + AntiSpywareProfile: to.Ptr("default"), + AntiVirusProfile: to.Ptr("default"), + DNSSubscription: to.Ptr("default"), + FileBlockingProfile: to.Ptr("default"), + OutboundTrustCertificate: to.Ptr("default"), + OutboundUnTrustCertificate: to.Ptr("default"), + URLFilteringProfile: to.Ptr("default"), + VulnerabilityProfile: to.Ptr("default"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.GlobalRulestackResource = armpanngfw.GlobalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("globalRulestacks"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // TenantID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // Description: to.Ptr("global rulestacks"), + // AssociatedSubscriptions: []*string{ + // to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27")}, + // DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + // MinAppIDVersion: to.Ptr("8.5.3"), + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanLocation: to.Ptr("eastus"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // Scope: to.Ptr(armpanngfw.ScopeTypeGLOBAL), + // SecurityServices: &armpanngfw.SecurityServices{ + // AntiSpywareProfile: to.Ptr("default"), + // AntiVirusProfile: to.Ptr("default"), + // DNSSubscription: to.Ptr("default"), + // FileBlockingProfile: to.Ptr("default"), + // OutboundTrustCertificate: to.Ptr("default"), + // OutboundUnTrustCertificate: to.Ptr("default"), + // URLFilteringProfile: to.Ptr("default"), + // VulnerabilityProfile: to.Ptr("default"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_Update_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_Update_globalRulestackUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().Update(ctx, "praval", armpanngfw.GlobalRulestackResourceUpdate{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.GlobalRulestackResource = armpanngfw.GlobalRulestackResource{ + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_Delete_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_BeginDelete_globalRulestackDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGlobalRulestackClient().BeginDelete(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_Delete_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_BeginDelete_globalRulestackDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGlobalRulestackClient().BeginDelete(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_commit_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_BeginCommit_globalRulestackCommitMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGlobalRulestackClient().BeginCommit(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_commit_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_BeginCommit_globalRulestackCommitMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewGlobalRulestackClient().BeginCommit(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_getChangeLog_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_GetChangeLog_globalRulestackGetChangeLogMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().GetChangeLog(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Changelog = armpanngfw.Changelog{ + // Changes: []*string{ + // to.Ptr("aaaa")}, + // LastCommitted: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_getChangeLog_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_GetChangeLog_globalRulestackGetChangeLogMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().GetChangeLog(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Changelog = armpanngfw.Changelog{ + // Changes: []*string{ + // to.Ptr("aaaa")}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listAdvancedSecurityObjects_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_ListAdvancedSecurityObjects_globalRulestackListAdvancedSecurityObjectsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListAdvancedSecurityObjects(ctx, "praval", armpanngfw.AdvSecurityObjectTypeEnum("globalRulestacks"), &armpanngfw.GlobalRulestackClientListAdvancedSecurityObjectsOptions{Skip: to.Ptr("a6a321"), + Top: to.Ptr[int32](20), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AdvSecurityObjectListResponse = armpanngfw.AdvSecurityObjectListResponse{ + // Value: &armpanngfw.AdvSecurityObjectModel{ + // Type: to.Ptr("globalRulestacks"), + // Entry: []*armpanngfw.NameDescriptionObject{ + // { + // Name: to.Ptr("aaaaaaaaaa"), + // Description: to.Ptr("aaaaaaaaaaaa"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listAdvancedSecurityObjects_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_ListAdvancedSecurityObjects_globalRulestackListAdvancedSecurityObjectsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListAdvancedSecurityObjects(ctx, "praval", armpanngfw.AdvSecurityObjectTypeEnum("globalRulestacks"), &armpanngfw.GlobalRulestackClientListAdvancedSecurityObjectsOptions{Skip: nil, + Top: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AdvSecurityObjectListResponse = armpanngfw.AdvSecurityObjectListResponse{ + // Value: &armpanngfw.AdvSecurityObjectModel{ + // Entry: []*armpanngfw.NameDescriptionObject{ + // { + // Name: to.Ptr("aaaaaaaaaa"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listAppIds_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_ListAppIDs_globalRulestackListAppIdsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListAppIDs(ctx, "praval", &armpanngfw.GlobalRulestackClientListAppIDsOptions{AppIDVersion: to.Ptr("8543"), + AppPrefix: to.Ptr("pref"), + Skip: to.Ptr("a6a321"), + Top: to.Ptr[int32](20), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ListAppIDResponse = armpanngfw.ListAppIDResponse{ + // Value: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa")}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listAppIds_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_ListAppIDs_globalRulestackListAppIdsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListAppIDs(ctx, "praval", &armpanngfw.GlobalRulestackClientListAppIDsOptions{AppIDVersion: nil, + AppPrefix: nil, + Skip: nil, + Top: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ListAppIDResponse = armpanngfw.ListAppIDResponse{ + // Value: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa")}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listCountries_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_ListCountries_globalRulestackListCountriesMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListCountries(ctx, "praval", &armpanngfw.GlobalRulestackClientListCountriesOptions{Skip: to.Ptr("a6a321"), + Top: to.Ptr[int32](20), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CountriesResponse = armpanngfw.CountriesResponse{ + // Value: []*armpanngfw.Country{ + // { + // Description: to.Ptr("aaaaa"), + // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listCountries_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_ListCountries_globalRulestackListCountriesMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListCountries(ctx, "praval", &armpanngfw.GlobalRulestackClientListCountriesOptions{Skip: nil, + Top: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CountriesResponse = armpanngfw.CountriesResponse{ + // Value: []*armpanngfw.Country{ + // { + // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listFirewalls_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_ListFirewalls_globalRulestackListFirewallsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListFirewalls(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ListFirewallsResponse = armpanngfw.ListFirewallsResponse{ + // Value: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listFirewalls_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_ListFirewalls_globalRulestackListFirewallsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListFirewalls(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ListFirewallsResponse = armpanngfw.ListFirewallsResponse{ + // Value: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listPredefinedUrlCategories_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_ListPredefinedURLCategories_globalRulestackListPredefinedUrlCategoriesMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListPredefinedURLCategories(ctx, "praval", &armpanngfw.GlobalRulestackClientListPredefinedURLCategoriesOptions{Skip: to.Ptr("a6a321"), + Top: to.Ptr[int32](20), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PredefinedURLCategoriesResponse = armpanngfw.PredefinedURLCategoriesResponse{ + // Value: []*armpanngfw.PredefinedURLCategory{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // Action: to.Ptr("aaaaaaa"), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listPredefinedUrlCategories_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_ListPredefinedURLCategories_globalRulestackListPredefinedUrlCategoriesMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListPredefinedURLCategories(ctx, "praval", &armpanngfw.GlobalRulestackClientListPredefinedURLCategoriesOptions{Skip: nil, + Top: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PredefinedURLCategoriesResponse = armpanngfw.PredefinedURLCategoriesResponse{ + // Value: []*armpanngfw.PredefinedURLCategory{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // Action: to.Ptr("aaaaaaa"), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listSecurityServices_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_ListSecurityServices_globalRulestackListSecurityServicesMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListSecurityServices(ctx, "praval", armpanngfw.SecurityServicesTypeEnum("globalRulestacks"), &armpanngfw.GlobalRulestackClientListSecurityServicesOptions{Skip: to.Ptr("a6a321"), + Top: to.Ptr[int32](20), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SecurityServicesResponse = armpanngfw.SecurityServicesResponse{ + // Value: &armpanngfw.SecurityServicesTypeList{ + // Type: to.Ptr("globalRulestacks"), + // Entry: []*armpanngfw.NameDescriptionObject{ + // { + // Name: to.Ptr("aaaaaaaaaa"), + // Description: to.Ptr("aaaaaaaaaaaa"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_listSecurityServices_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_ListSecurityServices_globalRulestackListSecurityServicesMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGlobalRulestackClient().ListSecurityServices(ctx, "praval", armpanngfw.SecurityServicesTypeEnum("globalRulestacks"), &armpanngfw.GlobalRulestackClientListSecurityServicesOptions{Skip: nil, + Top: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SecurityServicesResponse = armpanngfw.SecurityServicesResponse{ + // Value: &armpanngfw.SecurityServicesTypeList{ + // Entry: []*armpanngfw.NameDescriptionObject{ + // { + // Name: to.Ptr("aaaaaaaaaa"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_revert_MaximumSet_Gen.json +func ExampleGlobalRulestackClient_Revert_globalRulestackRevertMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewGlobalRulestackClient().Revert(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/GlobalRulestack_revert_MinimumSet_Gen.json +func ExampleGlobalRulestackClient_Revert_globalRulestackRevertMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewGlobalRulestackClient().Revert(ctx, "praval", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/go.mod b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/go.mod new file mode 100644 index 000000000000..f6f7fce5bdff --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect + golang.org/x/crypto v0.6.0 // indirect + golang.org/x/net v0.7.0 // indirect + golang.org/x/sys v0.5.0 // indirect + golang.org/x/text v0.7.0 // indirect +) diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/go.sum b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/go.sum new file mode 100644 index 000000000000..8ba445a8c4da --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/go.sum @@ -0,0 +1,31 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= +github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= +github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= +github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= +golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= +golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrules_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrules_client.go new file mode 100644 index 000000000000..e8f6b6dd7edd --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrules_client.go @@ -0,0 +1,509 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LocalRulesClient contains the methods for the LocalRules group. +// Don't use this type directly, use NewLocalRulesClient() instead. +type LocalRulesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLocalRulesClient creates a new instance of LocalRulesClient 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 NewLocalRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocalRulesClient, error) { + cl, err := arm.NewClient(moduleName+".LocalRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LocalRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a LocalRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - priority - Local Rule priority +// - resource - Resource create parameters. +// - options - LocalRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the LocalRulesClient.BeginCreateOrUpdate +// method. +func (client *LocalRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, resource LocalRulesResource, options *LocalRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[LocalRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, localRulestackName, priority, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LocalRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LocalRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a LocalRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *LocalRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, resource LocalRulesResource, options *LocalRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, localRulestackName, priority, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *LocalRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, resource LocalRulesResource, options *LocalRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a LocalRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - priority - Local Rule priority +// - options - LocalRulesClientBeginDeleteOptions contains the optional parameters for the LocalRulesClient.BeginDelete method. +func (client *LocalRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientBeginDeleteOptions) (*runtime.Poller[LocalRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, localRulestackName, priority, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LocalRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LocalRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a LocalRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *LocalRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, localRulestackName, priority, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LocalRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a LocalRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - priority - Local Rule priority +// - options - LocalRulesClientGetOptions contains the optional parameters for the LocalRulesClient.Get method. +func (client *LocalRulesClient) Get(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientGetOptions) (LocalRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, localRulestackName, priority, options) + if err != nil { + return LocalRulesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LocalRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LocalRulesClient) getHandleResponse(resp *http.Response) (LocalRulesClientGetResponse, error) { + result := LocalRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalRulesResource); err != nil { + return LocalRulesClientGetResponse{}, err + } + return result, nil +} + +// GetCounters - Get counters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - priority - Local Rule priority +// - options - LocalRulesClientGetCountersOptions contains the optional parameters for the LocalRulesClient.GetCounters method. +func (client *LocalRulesClient) GetCounters(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientGetCountersOptions) (LocalRulesClientGetCountersResponse, error) { + req, err := client.getCountersCreateRequest(ctx, resourceGroupName, localRulestackName, priority, options) + if err != nil { + return LocalRulesClientGetCountersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulesClientGetCountersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulesClientGetCountersResponse{}, runtime.NewResponseError(resp) + } + return client.getCountersHandleResponse(resp) +} + +// getCountersCreateRequest creates the GetCounters request. +func (client *LocalRulesClient) getCountersCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientGetCountersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/getCounters" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + if options != nil && options.FirewallName != nil { + reqQP.Set("firewallName", *options.FirewallName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCountersHandleResponse handles the GetCounters response. +func (client *LocalRulesClient) getCountersHandleResponse(resp *http.Response) (LocalRulesClientGetCountersResponse, error) { + result := LocalRulesClientGetCountersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RuleCounter); err != nil { + return LocalRulesClientGetCountersResponse{}, err + } + return result, nil +} + +// NewListByLocalRulestacksPager - List LocalRulesResource resources by LocalRulestacks +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulesClientListByLocalRulestacksOptions contains the optional parameters for the LocalRulesClient.NewListByLocalRulestacksPager +// method. +func (client *LocalRulesClient) NewListByLocalRulestacksPager(resourceGroupName string, localRulestackName string, options *LocalRulesClientListByLocalRulestacksOptions) *runtime.Pager[LocalRulesClientListByLocalRulestacksResponse] { + return runtime.NewPager(runtime.PagingHandler[LocalRulesClientListByLocalRulestacksResponse]{ + More: func(page LocalRulesClientListByLocalRulestacksResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LocalRulesClientListByLocalRulestacksResponse) (LocalRulesClientListByLocalRulestacksResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByLocalRulestacksCreateRequest(ctx, resourceGroupName, localRulestackName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return LocalRulesClientListByLocalRulestacksResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulesClientListByLocalRulestacksResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulesClientListByLocalRulestacksResponse{}, runtime.NewResponseError(resp) + } + return client.listByLocalRulestacksHandleResponse(resp) + }, + }) +} + +// listByLocalRulestacksCreateRequest creates the ListByLocalRulestacks request. +func (client *LocalRulesClient) listByLocalRulestacksCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulesClientListByLocalRulestacksOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocalRulestacksHandleResponse handles the ListByLocalRulestacks response. +func (client *LocalRulesClient) listByLocalRulestacksHandleResponse(resp *http.Response) (LocalRulesClientListByLocalRulestacksResponse, error) { + result := LocalRulesClientListByLocalRulestacksResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalRulesResourceListResult); err != nil { + return LocalRulesClientListByLocalRulestacksResponse{}, err + } + return result, nil +} + +// RefreshCounters - Refresh counters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - priority - Local Rule priority +// - options - LocalRulesClientRefreshCountersOptions contains the optional parameters for the LocalRulesClient.RefreshCounters +// method. +func (client *LocalRulesClient) RefreshCounters(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientRefreshCountersOptions) (LocalRulesClientRefreshCountersResponse, error) { + req, err := client.refreshCountersCreateRequest(ctx, resourceGroupName, localRulestackName, priority, options) + if err != nil { + return LocalRulesClientRefreshCountersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulesClientRefreshCountersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return LocalRulesClientRefreshCountersResponse{}, runtime.NewResponseError(resp) + } + return LocalRulesClientRefreshCountersResponse{}, nil +} + +// refreshCountersCreateRequest creates the RefreshCounters request. +func (client *LocalRulesClient) refreshCountersCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientRefreshCountersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/refreshCounters" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + if options != nil && options.FirewallName != nil { + reqQP.Set("firewallName", *options.FirewallName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ResetCounters - Reset counters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - priority - Local Rule priority +// - options - LocalRulesClientResetCountersOptions contains the optional parameters for the LocalRulesClient.ResetCounters +// method. +func (client *LocalRulesClient) ResetCounters(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientResetCountersOptions) (LocalRulesClientResetCountersResponse, error) { + req, err := client.resetCountersCreateRequest(ctx, resourceGroupName, localRulestackName, priority, options) + if err != nil { + return LocalRulesClientResetCountersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulesClientResetCountersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulesClientResetCountersResponse{}, runtime.NewResponseError(resp) + } + return client.resetCountersHandleResponse(resp) +} + +// resetCountersCreateRequest creates the ResetCounters request. +func (client *LocalRulesClient) resetCountersCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, priority string, options *LocalRulesClientResetCountersOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/localRules/{priority}/resetCounters" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + if options != nil && options.FirewallName != nil { + reqQP.Set("firewallName", *options.FirewallName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// resetCountersHandleResponse handles the ResetCounters response. +func (client *LocalRulesClient) resetCountersHandleResponse(resp *http.Response) (LocalRulesClientResetCountersResponse, error) { + result := LocalRulesClientResetCountersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RuleCounterReset); err != nil { + return LocalRulesClientResetCountersResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrules_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrules_client_example_test.go new file mode 100644 index 000000000000..a27d8a63a149 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrules_client_example_test.go @@ -0,0 +1,629 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_ListByLocalRulestacks_MaximumSet_Gen.json +func ExampleLocalRulesClient_NewListByLocalRulestacksPager_localRulesListByLocalRulestacksMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLocalRulesClient().NewListByLocalRulestacksPager("firewall-rg", "lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.LocalRulesResourceListResult = armpanngfw.LocalRulesResourceListResult{ + // Value: []*armpanngfw.LocalRulesResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), + // Type: to.Ptr("a"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.RuleEntry{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + // Applications: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // AuditComment: to.Ptr("aaa"), + // Category: &armpanngfw.Category{ + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // URLCustom: []*string{ + // to.Ptr("aaaaa")}, + // }, + // DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + // Destination: &armpanngfw.DestinationAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaaaaaaaaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // FqdnLists: []*string{ + // to.Ptr("aaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // }, + // EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // InboundInspectionCertificate: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + // NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + // Priority: to.Ptr[int32](24), + // ProtocolPortList: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + // Source: &armpanngfw.SourceAddr{ + // Cidrs: []*string{ + // to.Ptr("aaa")}, + // Countries: []*string{ + // to.Ptr("aaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, + // }, + // Tags: []*armpanngfw.TagInfo{ + // { + // Key: to.Ptr("keyName"), + // Value: to.Ptr("value"), + // }}, + // Protocol: to.Ptr("aaaa"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_ListByLocalRulestacks_MinimumSet_Gen.json +func ExampleLocalRulesClient_NewListByLocalRulestacksPager_localRulesListByLocalRulestacksMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLocalRulesClient().NewListByLocalRulestacksPager("firewall-rg", "lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.LocalRulesResourceListResult = armpanngfw.LocalRulesResourceListResult{ + // Value: []*armpanngfw.LocalRulesResource{ + // { + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/lrs1/localrules/1"), + // Properties: &armpanngfw.RuleEntry{ + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_Get_MaximumSet_Gen.json +func ExampleLocalRulesClient_Get_localRulesGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulesClient().Get(ctx, "firewall-rg", "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocalRulesResource = armpanngfw.LocalRulesResource{ + // Name: to.Ptr("aaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.RuleEntry{ + // Description: to.Ptr("aaaaaaa"), + // ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + // Applications: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // AuditComment: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + // Category: &armpanngfw.Category{ + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, + // URLCustom: []*string{ + // to.Ptr("aa")}, + // }, + // DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + // Destination: &armpanngfw.DestinationAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaa")}, + // FqdnLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaa")}, + // }, + // EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // InboundInspectionCertificate: to.Ptr("aaaaaaaaaaaaaaaa"), + // NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + // NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + // Priority: to.Ptr[int32](13), + // ProtocolPortList: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // RuleName: to.Ptr("aaaaaa"), + // RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + // Source: &armpanngfw.SourceAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, + // }, + // Tags: []*armpanngfw.TagInfo{ + // { + // Key: to.Ptr("keyName"), + // Value: to.Ptr("value"), + // }}, + // Protocol: to.Ptr("aaaaaaaaaaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_Get_MinimumSet_Gen.json +func ExampleLocalRulesClient_Get_localRulesGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulesClient().Get(ctx, "firewall-rg", "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocalRulesResource = armpanngfw.LocalRulesResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/grs1/localrules/1"), + // Properties: &armpanngfw.RuleEntry{ + // RuleName: to.Ptr("aaaaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_CreateOrUpdate_MaximumSet_Gen.json +func ExampleLocalRulesClient_BeginCreateOrUpdate_localRulesCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLocalRulesClient().BeginCreateOrUpdate(ctx, "firewall-rg", "lrs1", "1", armpanngfw.LocalRulesResource{ + Properties: &armpanngfw.RuleEntry{ + Description: to.Ptr("description of local rule"), + ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + Applications: []*string{ + to.Ptr("app1")}, + AuditComment: to.Ptr("example comment"), + Category: &armpanngfw.Category{ + Feeds: []*string{ + to.Ptr("feed")}, + URLCustom: []*string{ + to.Ptr("https://microsoft.com")}, + }, + DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + Destination: &armpanngfw.DestinationAddr{ + Cidrs: []*string{ + to.Ptr("1.0.0.1/10")}, + Countries: []*string{ + to.Ptr("India")}, + Feeds: []*string{ + to.Ptr("feed")}, + FqdnLists: []*string{ + to.Ptr("FQDN1")}, + PrefixLists: []*string{ + to.Ptr("PL1")}, + }, + EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + Etag: to.Ptr("c18e6eef-ba3e-49ee-8a85-2b36c863a9d0"), + InboundInspectionCertificate: to.Ptr("cert1"), + NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + ProtocolPortList: []*string{ + to.Ptr("80")}, + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + RuleName: to.Ptr("localRule1"), + RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + Source: &armpanngfw.SourceAddr{ + Cidrs: []*string{ + to.Ptr("1.0.0.1/10")}, + Countries: []*string{ + to.Ptr("India")}, + Feeds: []*string{ + to.Ptr("feed")}, + PrefixLists: []*string{ + to.Ptr("PL1")}, + }, + Tags: []*armpanngfw.TagInfo{ + { + Key: to.Ptr("keyName"), + Value: to.Ptr("value"), + }}, + Protocol: to.Ptr("HTTP"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocalRulesResource = armpanngfw.LocalRulesResource{ + // Name: to.Ptr("aaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.RuleEntry{ + // Description: to.Ptr("aaaaaaa"), + // ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + // Applications: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // AuditComment: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + // Category: &armpanngfw.Category{ + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaa")}, + // URLCustom: []*string{ + // to.Ptr("aa")}, + // }, + // DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + // Destination: &armpanngfw.DestinationAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaa")}, + // FqdnLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaa")}, + // }, + // EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // InboundInspectionCertificate: to.Ptr("aaaaaaaaaaaaaaaa"), + // NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + // NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + // Priority: to.Ptr[int32](13), + // ProtocolPortList: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // RuleName: to.Ptr("aaaaaa"), + // RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + // Source: &armpanngfw.SourceAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, + // }, + // Tags: []*armpanngfw.TagInfo{ + // { + // Key: to.Ptr("keyName"), + // Value: to.Ptr("value"), + // }}, + // Protocol: to.Ptr("aaaaaaaaaaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_CreateOrUpdate_MinimumSet_Gen.json +func ExampleLocalRulesClient_BeginCreateOrUpdate_localRulesCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLocalRulesClient().BeginCreateOrUpdate(ctx, "firewall-rg", "lrs1", "1", armpanngfw.LocalRulesResource{ + Properties: &armpanngfw.RuleEntry{ + RuleName: to.Ptr("localRule1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocalRulesResource = armpanngfw.LocalRulesResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/grs1/localrules/1"), + // Properties: &armpanngfw.RuleEntry{ + // RuleName: to.Ptr("aaaaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_Delete_MaximumSet_Gen.json +func ExampleLocalRulesClient_BeginDelete_localRulesDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLocalRulesClient().BeginDelete(ctx, "firewall-rg", "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_Delete_MinimumSet_Gen.json +func ExampleLocalRulesClient_BeginDelete_localRulesDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLocalRulesClient().BeginDelete(ctx, "firewall-rg", "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_getCounters_MaximumSet_Gen.json +func ExampleLocalRulesClient_GetCounters_localRulesGetCountersMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulesClient().GetCounters(ctx, "firewall-rg", "lrs1", "1", &armpanngfw.LocalRulesClientGetCountersOptions{FirewallName: to.Ptr("firewall1")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounter = armpanngfw.RuleCounter{ + // AppSeen: &armpanngfw.AppSeenData{ + // AppSeenList: []*armpanngfw.AppSeenInfo{ + // { + // Category: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // Risk: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // StandardPorts: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // SubCategory: to.Ptr("aaaaaaaaaaaaaaaaa"), + // Tag: to.Ptr("aaaaaaaaaa"), + // Technology: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // Title: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // }}, + // Count: to.Ptr[int32](13), + // }, + // FirewallName: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // HitCount: to.Ptr[int32](20), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // Priority: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // RequestTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // RuleListName: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // RuleName: to.Ptr("aaaa"), + // RuleStackName: to.Ptr("aaaaaaaaaaaaaaaaa"), + // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_getCounters_MinimumSet_Gen.json +func ExampleLocalRulesClient_GetCounters_localRulesGetCountersMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulesClient().GetCounters(ctx, "firewall-rg", "lrs1", "1", &armpanngfw.LocalRulesClientGetCountersOptions{FirewallName: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounter = armpanngfw.RuleCounter{ + // Priority: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // RuleName: to.Ptr("aaaa"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_refreshCounters_MaximumSet_Gen.json +func ExampleLocalRulesClient_RefreshCounters_localRulesRefreshCountersMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewLocalRulesClient().RefreshCounters(ctx, "firewall-rg", "lrs1", "1", &armpanngfw.LocalRulesClientRefreshCountersOptions{FirewallName: to.Ptr("firewall1")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_refreshCounters_MinimumSet_Gen.json +func ExampleLocalRulesClient_RefreshCounters_localRulesRefreshCountersMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewLocalRulesClient().RefreshCounters(ctx, "firewall-rg", "lrs1", "1", &armpanngfw.LocalRulesClientRefreshCountersOptions{FirewallName: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_resetCounters_MaximumSet_Gen.json +func ExampleLocalRulesClient_ResetCounters_localRulesResetCountersMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulesClient().ResetCounters(ctx, "firewall-rg", "lrs1", "1", &armpanngfw.LocalRulesClientResetCountersOptions{FirewallName: to.Ptr("firewall1")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounterReset = armpanngfw.RuleCounterReset{ + // FirewallName: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // Priority: to.Ptr("aaaaaaa"), + // RuleListName: to.Ptr("aaaaa"), + // RuleName: to.Ptr("aaaaa"), + // RuleStackName: to.Ptr("aa"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRules_resetCounters_MinimumSet_Gen.json +func ExampleLocalRulesClient_ResetCounters_localRulesResetCountersMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulesClient().ResetCounters(ctx, "firewall-rg", "lrs1", "1", &armpanngfw.LocalRulesClientResetCountersOptions{FirewallName: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounterReset = armpanngfw.RuleCounterReset{ + // } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrulestacks_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrulestacks_client.go new file mode 100644 index 000000000000..61d9b4d69c4e --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrulestacks_client.go @@ -0,0 +1,1041 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +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" +) + +// LocalRulestacksClient contains the methods for the LocalRulestacks group. +// Don't use this type directly, use NewLocalRulestacksClient() instead. +type LocalRulestacksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewLocalRulestacksClient creates a new instance of LocalRulestacksClient 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 NewLocalRulestacksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocalRulestacksClient, error) { + cl, err := arm.NewClient(moduleName+".LocalRulestacksClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &LocalRulestacksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCommit - Commit rulestack configuration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientBeginCommitOptions contains the optional parameters for the LocalRulestacksClient.BeginCommit +// method. +func (client *LocalRulestacksClient) BeginCommit(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientBeginCommitOptions) (*runtime.Poller[LocalRulestacksClientCommitResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.commit(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LocalRulestacksClientCommitResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[LocalRulestacksClientCommitResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Commit - Commit rulestack configuration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *LocalRulestacksClient) commit(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientBeginCommitOptions) (*http.Response, error) { + req, err := client.commitCreateRequest(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// commitCreateRequest creates the Commit request. +func (client *LocalRulestacksClient) commitCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientBeginCommitOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/commit" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginCreateOrUpdate - Create a LocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - resource - Resource create parameters. +// - options - LocalRulestacksClientBeginCreateOrUpdateOptions contains the optional parameters for the LocalRulestacksClient.BeginCreateOrUpdate +// method. +func (client *LocalRulestacksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, localRulestackName string, resource LocalRulestackResource, options *LocalRulestacksClientBeginCreateOrUpdateOptions) (*runtime.Poller[LocalRulestacksClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, localRulestackName, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LocalRulestacksClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LocalRulestacksClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a LocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *LocalRulestacksClient) createOrUpdate(ctx context.Context, resourceGroupName string, localRulestackName string, resource LocalRulestackResource, options *LocalRulestacksClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, localRulestackName, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *LocalRulestacksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, resource LocalRulestackResource, options *LocalRulestacksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a LocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientBeginDeleteOptions contains the optional parameters for the LocalRulestacksClient.BeginDelete +// method. +func (client *LocalRulestacksClient) BeginDelete(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientBeginDeleteOptions) (*runtime.Poller[LocalRulestacksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LocalRulestacksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[LocalRulestacksClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a LocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *LocalRulestacksClient) deleteOperation(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *LocalRulestacksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a LocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientGetOptions contains the optional parameters for the LocalRulestacksClient.Get method. +func (client *LocalRulestacksClient) Get(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientGetOptions) (LocalRulestacksClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return LocalRulestacksClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *LocalRulestacksClient) getCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *LocalRulestacksClient) getHandleResponse(resp *http.Response) (LocalRulestacksClientGetResponse, error) { + result := LocalRulestacksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalRulestackResource); err != nil { + return LocalRulestacksClientGetResponse{}, err + } + return result, nil +} + +// GetChangeLog - Get changelog +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientGetChangeLogOptions contains the optional parameters for the LocalRulestacksClient.GetChangeLog +// method. +func (client *LocalRulestacksClient) GetChangeLog(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientGetChangeLogOptions) (LocalRulestacksClientGetChangeLogResponse, error) { + req, err := client.getChangeLogCreateRequest(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return LocalRulestacksClientGetChangeLogResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientGetChangeLogResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientGetChangeLogResponse{}, runtime.NewResponseError(resp) + } + return client.getChangeLogHandleResponse(resp) +} + +// getChangeLogCreateRequest creates the GetChangeLog request. +func (client *LocalRulestacksClient) getChangeLogCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientGetChangeLogOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getChangeLog" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getChangeLogHandleResponse handles the GetChangeLog response. +func (client *LocalRulestacksClient) getChangeLogHandleResponse(resp *http.Response) (LocalRulestacksClientGetChangeLogResponse, error) { + result := LocalRulestacksClientGetChangeLogResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Changelog); err != nil { + return LocalRulestacksClientGetChangeLogResponse{}, err + } + return result, nil +} + +// GetSupportInfo - support info for rulestack. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientGetSupportInfoOptions contains the optional parameters for the LocalRulestacksClient.GetSupportInfo +// method. +func (client *LocalRulestacksClient) GetSupportInfo(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientGetSupportInfoOptions) (LocalRulestacksClientGetSupportInfoResponse, error) { + req, err := client.getSupportInfoCreateRequest(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return LocalRulestacksClientGetSupportInfoResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientGetSupportInfoResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientGetSupportInfoResponse{}, runtime.NewResponseError(resp) + } + return client.getSupportInfoHandleResponse(resp) +} + +// getSupportInfoCreateRequest creates the GetSupportInfo request. +func (client *LocalRulestacksClient) getSupportInfoCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientGetSupportInfoOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/getSupportInfo" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.Email != nil { + reqQP.Set("email", *options.Email) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getSupportInfoHandleResponse handles the GetSupportInfo response. +func (client *LocalRulestacksClient) getSupportInfoHandleResponse(resp *http.Response) (LocalRulestacksClientGetSupportInfoResponse, error) { + result := LocalRulestacksClientGetSupportInfoResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SupportInfo); err != nil { + return LocalRulestacksClientGetSupportInfoResponse{}, err + } + return result, nil +} + +// ListAdvancedSecurityObjects - Get the list of advanced security objects +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientListAdvancedSecurityObjectsOptions contains the optional parameters for the LocalRulestacksClient.ListAdvancedSecurityObjects +// method. +func (client *LocalRulestacksClient) ListAdvancedSecurityObjects(ctx context.Context, resourceGroupName string, localRulestackName string, typeParam AdvSecurityObjectTypeEnum, options *LocalRulestacksClientListAdvancedSecurityObjectsOptions) (LocalRulestacksClientListAdvancedSecurityObjectsResponse, error) { + req, err := client.listAdvancedSecurityObjectsCreateRequest(ctx, resourceGroupName, localRulestackName, typeParam, options) + if err != nil { + return LocalRulestacksClientListAdvancedSecurityObjectsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientListAdvancedSecurityObjectsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientListAdvancedSecurityObjectsResponse{}, runtime.NewResponseError(resp) + } + return client.listAdvancedSecurityObjectsHandleResponse(resp) +} + +// listAdvancedSecurityObjectsCreateRequest creates the ListAdvancedSecurityObjects request. +func (client *LocalRulestacksClient) listAdvancedSecurityObjectsCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, typeParam AdvSecurityObjectTypeEnum, options *LocalRulestacksClientListAdvancedSecurityObjectsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAdvancedSecurityObjects" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.Skip != nil { + reqQP.Set("skip", *options.Skip) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("type", string(typeParam)) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAdvancedSecurityObjectsHandleResponse handles the ListAdvancedSecurityObjects response. +func (client *LocalRulestacksClient) listAdvancedSecurityObjectsHandleResponse(resp *http.Response) (LocalRulestacksClientListAdvancedSecurityObjectsResponse, error) { + result := LocalRulestacksClientListAdvancedSecurityObjectsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AdvSecurityObjectListResponse); err != nil { + return LocalRulestacksClientListAdvancedSecurityObjectsResponse{}, err + } + return result, nil +} + +// ListAppIDs - List of AppIds for LocalRulestack ApiVersion +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientListAppIDsOptions contains the optional parameters for the LocalRulestacksClient.ListAppIDs +// method. +func (client *LocalRulestacksClient) ListAppIDs(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientListAppIDsOptions) (LocalRulestacksClientListAppIDsResponse, error) { + req, err := client.listAppIDsCreateRequest(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return LocalRulestacksClientListAppIDsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientListAppIDsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientListAppIDsResponse{}, runtime.NewResponseError(resp) + } + return client.listAppIDsHandleResponse(resp) +} + +// listAppIDsCreateRequest creates the ListAppIDs request. +func (client *LocalRulestacksClient) listAppIDsCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientListAppIDsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listAppIds" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.AppIDVersion != nil { + reqQP.Set("appIdVersion", *options.AppIDVersion) + } + if options != nil && options.AppPrefix != nil { + reqQP.Set("appPrefix", *options.AppPrefix) + } + if options != nil && options.Skip != nil { + reqQP.Set("skip", *options.Skip) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAppIDsHandleResponse handles the ListAppIDs response. +func (client *LocalRulestacksClient) listAppIDsHandleResponse(resp *http.Response) (LocalRulestacksClientListAppIDsResponse, error) { + result := LocalRulestacksClientListAppIDsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListAppIDResponse); err != nil { + return LocalRulestacksClientListAppIDsResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List LocalRulestackResource resources by resource group +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - LocalRulestacksClientListByResourceGroupOptions contains the optional parameters for the LocalRulestacksClient.NewListByResourceGroupPager +// method. +func (client *LocalRulestacksClient) NewListByResourceGroupPager(resourceGroupName string, options *LocalRulestacksClientListByResourceGroupOptions) *runtime.Pager[LocalRulestacksClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[LocalRulestacksClientListByResourceGroupResponse]{ + More: func(page LocalRulestacksClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LocalRulestacksClientListByResourceGroupResponse) (LocalRulestacksClientListByResourceGroupResponse, 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 LocalRulestacksClientListByResourceGroupResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *LocalRulestacksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *LocalRulestacksClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *LocalRulestacksClient) listByResourceGroupHandleResponse(resp *http.Response) (LocalRulestacksClientListByResourceGroupResponse, error) { + result := LocalRulestacksClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalRulestackResourceListResult); err != nil { + return LocalRulestacksClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List LocalRulestackResource resources by subscription ID +// +// Generated from API version 2022-08-29-preview +// - options - LocalRulestacksClientListBySubscriptionOptions contains the optional parameters for the LocalRulestacksClient.NewListBySubscriptionPager +// method. +func (client *LocalRulestacksClient) NewListBySubscriptionPager(options *LocalRulestacksClientListBySubscriptionOptions) *runtime.Pager[LocalRulestacksClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[LocalRulestacksClientListBySubscriptionResponse]{ + More: func(page LocalRulestacksClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *LocalRulestacksClientListBySubscriptionResponse) (LocalRulestacksClientListBySubscriptionResponse, 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 LocalRulestacksClientListBySubscriptionResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *LocalRulestacksClient) listBySubscriptionCreateRequest(ctx context.Context, options *LocalRulestacksClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks" + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *LocalRulestacksClient) listBySubscriptionHandleResponse(resp *http.Response) (LocalRulestacksClientListBySubscriptionResponse, error) { + result := LocalRulestacksClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalRulestackResourceListResult); err != nil { + return LocalRulestacksClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// ListCountries - List of countries for Rulestack +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientListCountriesOptions contains the optional parameters for the LocalRulestacksClient.ListCountries +// method. +func (client *LocalRulestacksClient) ListCountries(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientListCountriesOptions) (LocalRulestacksClientListCountriesResponse, error) { + req, err := client.listCountriesCreateRequest(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return LocalRulestacksClientListCountriesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientListCountriesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientListCountriesResponse{}, runtime.NewResponseError(resp) + } + return client.listCountriesHandleResponse(resp) +} + +// listCountriesCreateRequest creates the ListCountries request. +func (client *LocalRulestacksClient) listCountriesCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientListCountriesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listCountries" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.Skip != nil { + reqQP.Set("skip", *options.Skip) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listCountriesHandleResponse handles the ListCountries response. +func (client *LocalRulestacksClient) listCountriesHandleResponse(resp *http.Response) (LocalRulestacksClientListCountriesResponse, error) { + result := LocalRulestacksClientListCountriesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CountriesResponse); err != nil { + return LocalRulestacksClientListCountriesResponse{}, err + } + return result, nil +} + +// ListFirewalls - List of Firewalls associated with Rulestack +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientListFirewallsOptions contains the optional parameters for the LocalRulestacksClient.ListFirewalls +// method. +func (client *LocalRulestacksClient) ListFirewalls(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientListFirewallsOptions) (LocalRulestacksClientListFirewallsResponse, error) { + req, err := client.listFirewallsCreateRequest(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return LocalRulestacksClientListFirewallsResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientListFirewallsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientListFirewallsResponse{}, runtime.NewResponseError(resp) + } + return client.listFirewallsHandleResponse(resp) +} + +// listFirewallsCreateRequest creates the ListFirewalls request. +func (client *LocalRulestacksClient) listFirewallsCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientListFirewallsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listFirewalls" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listFirewallsHandleResponse handles the ListFirewalls response. +func (client *LocalRulestacksClient) listFirewallsHandleResponse(resp *http.Response) (LocalRulestacksClientListFirewallsResponse, error) { + result := LocalRulestacksClientListFirewallsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ListFirewallsResponse); err != nil { + return LocalRulestacksClientListFirewallsResponse{}, err + } + return result, nil +} + +// ListPredefinedURLCategories - List predefined URL categories for rulestack +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientListPredefinedURLCategoriesOptions contains the optional parameters for the LocalRulestacksClient.ListPredefinedURLCategories +// method. +func (client *LocalRulestacksClient) ListPredefinedURLCategories(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientListPredefinedURLCategoriesOptions) (LocalRulestacksClientListPredefinedURLCategoriesResponse, error) { + req, err := client.listPredefinedURLCategoriesCreateRequest(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return LocalRulestacksClientListPredefinedURLCategoriesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientListPredefinedURLCategoriesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientListPredefinedURLCategoriesResponse{}, runtime.NewResponseError(resp) + } + return client.listPredefinedURLCategoriesHandleResponse(resp) +} + +// listPredefinedURLCategoriesCreateRequest creates the ListPredefinedURLCategories request. +func (client *LocalRulestacksClient) listPredefinedURLCategoriesCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientListPredefinedURLCategoriesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listPredefinedUrlCategories" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.Skip != nil { + reqQP.Set("skip", *options.Skip) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listPredefinedURLCategoriesHandleResponse handles the ListPredefinedURLCategories response. +func (client *LocalRulestacksClient) listPredefinedURLCategoriesHandleResponse(resp *http.Response) (LocalRulestacksClientListPredefinedURLCategoriesResponse, error) { + result := LocalRulestacksClientListPredefinedURLCategoriesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PredefinedURLCategoriesResponse); err != nil { + return LocalRulestacksClientListPredefinedURLCategoriesResponse{}, err + } + return result, nil +} + +// ListSecurityServices - List the security services for rulestack +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientListSecurityServicesOptions contains the optional parameters for the LocalRulestacksClient.ListSecurityServices +// method. +func (client *LocalRulestacksClient) ListSecurityServices(ctx context.Context, resourceGroupName string, localRulestackName string, typeParam SecurityServicesTypeEnum, options *LocalRulestacksClientListSecurityServicesOptions) (LocalRulestacksClientListSecurityServicesResponse, error) { + req, err := client.listSecurityServicesCreateRequest(ctx, resourceGroupName, localRulestackName, typeParam, options) + if err != nil { + return LocalRulestacksClientListSecurityServicesResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientListSecurityServicesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientListSecurityServicesResponse{}, runtime.NewResponseError(resp) + } + return client.listSecurityServicesHandleResponse(resp) +} + +// listSecurityServicesCreateRequest creates the ListSecurityServices request. +func (client *LocalRulestacksClient) listSecurityServicesCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, typeParam SecurityServicesTypeEnum, options *LocalRulestacksClientListSecurityServicesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/listSecurityServices" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + if options != nil && options.Skip != nil { + reqQP.Set("skip", *options.Skip) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + reqQP.Set("type", string(typeParam)) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listSecurityServicesHandleResponse handles the ListSecurityServices response. +func (client *LocalRulestacksClient) listSecurityServicesHandleResponse(resp *http.Response) (LocalRulestacksClientListSecurityServicesResponse, error) { + result := LocalRulestacksClientListSecurityServicesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityServicesResponse); err != nil { + return LocalRulestacksClientListSecurityServicesResponse{}, err + } + return result, nil +} + +// Revert - Revert rulestack configuration +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - LocalRulestacksClientRevertOptions contains the optional parameters for the LocalRulestacksClient.Revert method. +func (client *LocalRulestacksClient) Revert(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientRevertOptions) (LocalRulestacksClientRevertResponse, error) { + req, err := client.revertCreateRequest(ctx, resourceGroupName, localRulestackName, options) + if err != nil { + return LocalRulestacksClientRevertResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientRevertResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return LocalRulestacksClientRevertResponse{}, runtime.NewResponseError(resp) + } + return LocalRulestacksClientRevertResponse{}, nil +} + +// revertCreateRequest creates the Revert request. +func (client *LocalRulestacksClient) revertCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *LocalRulestacksClientRevertOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/revert" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Update - Update a LocalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - properties - The resource properties to be updated. +// - options - LocalRulestacksClientUpdateOptions contains the optional parameters for the LocalRulestacksClient.Update method. +func (client *LocalRulestacksClient) Update(ctx context.Context, resourceGroupName string, localRulestackName string, properties LocalRulestackResourceUpdate, options *LocalRulestacksClientUpdateOptions) (LocalRulestacksClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, localRulestackName, properties, options) + if err != nil { + return LocalRulestacksClientUpdateResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return LocalRulestacksClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LocalRulestacksClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *LocalRulestacksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, properties LocalRulestackResourceUpdate, options *LocalRulestacksClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, properties) +} + +// updateHandleResponse handles the Update response. +func (client *LocalRulestacksClient) updateHandleResponse(resp *http.Response) (LocalRulestacksClientUpdateResponse, error) { + result := LocalRulestacksClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.LocalRulestackResource); err != nil { + return LocalRulestacksClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrulestacks_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrulestacks_client_example_test.go new file mode 100644 index 000000000000..abb88a6d7f04 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/localrulestacks_client_example_test.go @@ -0,0 +1,1171 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_ListBySubscription_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_NewListBySubscriptionPager_localRulestacksListBySubscriptionMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLocalRulestacksClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.LocalRulestackResourceListResult = armpanngfw.LocalRulestackResourceListResult{ + // Value: []*armpanngfw.LocalRulestackResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagName": to.Ptr("value"), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // TenantID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Properties: &armpanngfw.RulestackProperties{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + // AssociatedSubscriptions: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, + // DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + // MinAppIDVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanLocation: to.Ptr("eastus"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // Scope: to.Ptr(armpanngfw.ScopeTypeLOCAL), + // SecurityServices: &armpanngfw.SecurityServices{ + // AntiSpywareProfile: to.Ptr("aaaaaaaaaa"), + // AntiVirusProfile: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), + // DNSSubscription: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // FileBlockingProfile: to.Ptr("aaaaa"), + // OutboundTrustCertificate: to.Ptr("aaaaaa"), + // OutboundUnTrustCertificate: to.Ptr("aaaaaaaa"), + // URLFilteringProfile: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // VulnerabilityProfile: to.Ptr("aaaaaaaaaa"), + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_ListBySubscription_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_NewListBySubscriptionPager_localRulestacksListBySubscriptionMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLocalRulestacksClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.LocalRulestackResourceListResult = armpanngfw.LocalRulestackResourceListResult{ + // Value: []*armpanngfw.LocalRulestackResource{ + // { + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/lrs1"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_ListByResourceGroup_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_NewListByResourceGroupPager_localRulestacksListByResourceGroupMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLocalRulestacksClient().NewListByResourceGroupPager("rgopenapi", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.LocalRulestackResourceListResult = armpanngfw.LocalRulestackResourceListResult{ + // Value: []*armpanngfw.LocalRulestackResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagName": to.Ptr("value"), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // TenantID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Properties: &armpanngfw.RulestackProperties{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + // AssociatedSubscriptions: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, + // DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + // MinAppIDVersion: to.Ptr("aaaaaaaaaaaaaaaaaaaaa"), + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanLocation: to.Ptr("eastus"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // Scope: to.Ptr(armpanngfw.ScopeTypeLOCAL), + // SecurityServices: &armpanngfw.SecurityServices{ + // AntiSpywareProfile: to.Ptr("aaaaaaaaaa"), + // AntiVirusProfile: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), + // DNSSubscription: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // FileBlockingProfile: to.Ptr("aaaaa"), + // OutboundTrustCertificate: to.Ptr("aaaaaa"), + // OutboundUnTrustCertificate: to.Ptr("aaaaaaaa"), + // URLFilteringProfile: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // VulnerabilityProfile: to.Ptr("aaaaaaaaaa"), + // }, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_ListByResourceGroup_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_NewListByResourceGroupPager_localRulestacksListByResourceGroupMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewLocalRulestacksClient().NewListByResourceGroupPager("rgopenapi", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.LocalRulestackResourceListResult = armpanngfw.LocalRulestackResourceListResult{ + // Value: []*armpanngfw.LocalRulestackResource{ + // { + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/lrs1"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_Get_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_Get_localRulestacksGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().Get(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocalRulestackResource = armpanngfw.LocalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("localRulestacks"), + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/localrulestacks/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagName": to.Ptr("value"), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // TenantID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Properties: &armpanngfw.RulestackProperties{ + // Description: to.Ptr("local rulestacks"), + // AssociatedSubscriptions: []*string{ + // to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27")}, + // DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + // MinAppIDVersion: to.Ptr("8.5.3"), + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanLocation: to.Ptr("eastus"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // Scope: to.Ptr(armpanngfw.ScopeTypeLOCAL), + // SecurityServices: &armpanngfw.SecurityServices{ + // AntiSpywareProfile: to.Ptr("default"), + // AntiVirusProfile: to.Ptr("default"), + // DNSSubscription: to.Ptr("default"), + // FileBlockingProfile: to.Ptr("default"), + // OutboundTrustCertificate: to.Ptr("default"), + // OutboundUnTrustCertificate: to.Ptr("default"), + // URLFilteringProfile: to.Ptr("default"), + // VulnerabilityProfile: to.Ptr("default"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_Get_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_Get_localRulestacksGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().Get(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocalRulestackResource = armpanngfw.LocalRulestackResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_CreateOrUpdate_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_BeginCreateOrUpdate_localRulestacksCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLocalRulestacksClient().BeginCreateOrUpdate(ctx, "rgopenapi", "lrs1", armpanngfw.LocalRulestackResource{ + Location: to.Ptr("eastus"), + Tags: map[string]*string{ + "tagName": to.Ptr("value"), + }, + Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + "key16": { + ClientID: to.Ptr("aaaa"), + PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + }, + }, + }, + Properties: &armpanngfw.RulestackProperties{ + Description: to.Ptr("local rulestacks"), + AssociatedSubscriptions: []*string{ + to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27")}, + DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + MinAppIDVersion: to.Ptr("8.5.3"), + PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + PanLocation: to.Ptr("eastus"), + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + Scope: to.Ptr(armpanngfw.ScopeTypeLOCAL), + SecurityServices: &armpanngfw.SecurityServices{ + AntiSpywareProfile: to.Ptr("default"), + AntiVirusProfile: to.Ptr("default"), + DNSSubscription: to.Ptr("default"), + FileBlockingProfile: to.Ptr("default"), + OutboundTrustCertificate: to.Ptr("default"), + OutboundUnTrustCertificate: to.Ptr("default"), + URLFilteringProfile: to.Ptr("default"), + VulnerabilityProfile: to.Ptr("default"), + }, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocalRulestackResource = armpanngfw.LocalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("localRulestacks"), + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/localrulestacks/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagName": to.Ptr("value"), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // TenantID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Properties: &armpanngfw.RulestackProperties{ + // Description: to.Ptr("local rulestacks"), + // AssociatedSubscriptions: []*string{ + // to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27")}, + // DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + // MinAppIDVersion: to.Ptr("8.5.3"), + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanLocation: to.Ptr("eastus"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // Scope: to.Ptr(armpanngfw.ScopeTypeLOCAL), + // SecurityServices: &armpanngfw.SecurityServices{ + // AntiSpywareProfile: to.Ptr("default"), + // AntiVirusProfile: to.Ptr("default"), + // DNSSubscription: to.Ptr("default"), + // FileBlockingProfile: to.Ptr("default"), + // OutboundTrustCertificate: to.Ptr("default"), + // OutboundUnTrustCertificate: to.Ptr("default"), + // URLFilteringProfile: to.Ptr("default"), + // VulnerabilityProfile: to.Ptr("default"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_CreateOrUpdate_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_BeginCreateOrUpdate_localRulestacksCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLocalRulestacksClient().BeginCreateOrUpdate(ctx, "rgopenapi", "lrs1", armpanngfw.LocalRulestackResource{ + Location: to.Ptr("eastus"), + Properties: &armpanngfw.RulestackProperties{}, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocalRulestackResource = armpanngfw.LocalRulestackResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval"), + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_Update_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_Update_localRulestacksUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().Update(ctx, "rgopenapi", "lrs1", armpanngfw.LocalRulestackResourceUpdate{ + Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + "key16": { + ClientID: to.Ptr("aaaa"), + PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + }, + }, + }, + Properties: &armpanngfw.LocalRulestackResourceUpdateProperties{ + Description: to.Ptr("local rulestacks"), + AssociatedSubscriptions: []*string{ + to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27")}, + DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + MinAppIDVersion: to.Ptr("8.5.3"), + PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + PanLocation: to.Ptr("eastus"), + Scope: to.Ptr(armpanngfw.ScopeTypeLOCAL), + SecurityServices: &armpanngfw.SecurityServices{ + AntiSpywareProfile: to.Ptr("default"), + AntiVirusProfile: to.Ptr("default"), + DNSSubscription: to.Ptr("default"), + FileBlockingProfile: to.Ptr("default"), + OutboundTrustCertificate: to.Ptr("default"), + OutboundUnTrustCertificate: to.Ptr("default"), + URLFilteringProfile: to.Ptr("default"), + VulnerabilityProfile: to.Ptr("default"), + }, + }, + Tags: map[string]*string{ + "tagName": to.Ptr("value"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocalRulestackResource = armpanngfw.LocalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("localRulestacks"), + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourceGroups/firewall-rg/providers/PaloAltoNetworks.Cloudngfw/localrulestacks/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagName": to.Ptr("value"), + // }, + // Identity: &armpanngfw.AzureResourceManagerManagedIdentityProperties{ + // Type: to.Ptr(armpanngfw.ManagedIdentityTypeNone), + // PrincipalID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // TenantID: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // UserAssignedIdentities: map[string]*armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // "key16": &armpanngfw.AzureResourceManagerUserAssignedIdentity{ + // ClientID: to.Ptr("aaaa"), + // PrincipalID: to.Ptr("aaaaaaaaaaaaaaa"), + // }, + // }, + // }, + // Properties: &armpanngfw.RulestackProperties{ + // Description: to.Ptr("local rulestacks"), + // AssociatedSubscriptions: []*string{ + // to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27")}, + // DefaultMode: to.Ptr(armpanngfw.DefaultModeIPS), + // MinAppIDVersion: to.Ptr("8.5.3"), + // PanEtag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c12"), + // PanLocation: to.Ptr("eastus"), + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // Scope: to.Ptr(armpanngfw.ScopeTypeLOCAL), + // SecurityServices: &armpanngfw.SecurityServices{ + // AntiSpywareProfile: to.Ptr("default"), + // AntiVirusProfile: to.Ptr("default"), + // DNSSubscription: to.Ptr("default"), + // FileBlockingProfile: to.Ptr("default"), + // OutboundTrustCertificate: to.Ptr("default"), + // OutboundUnTrustCertificate: to.Ptr("default"), + // URLFilteringProfile: to.Ptr("default"), + // VulnerabilityProfile: to.Ptr("default"), + // }, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_Update_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_Update_localRulestacksUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().Update(ctx, "rgopenapi", "lrs1", armpanngfw.LocalRulestackResourceUpdate{}, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.LocalRulestackResource = armpanngfw.LocalRulestackResource{ + // Location: to.Ptr("eastus"), + // Properties: &armpanngfw.RulestackProperties{ + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_Delete_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_BeginDelete_localRulestacksDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLocalRulestacksClient().BeginDelete(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_Delete_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_BeginDelete_localRulestacksDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLocalRulestacksClient().BeginDelete(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_commit_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_BeginCommit_localRulestacksCommitMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLocalRulestacksClient().BeginCommit(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_commit_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_BeginCommit_localRulestacksCommitMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewLocalRulestacksClient().BeginCommit(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_getChangeLog_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_GetChangeLog_localRulestacksGetChangeLogMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().GetChangeLog(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Changelog = armpanngfw.Changelog{ + // Changes: []*string{ + // to.Ptr("aaaa")}, + // LastCommitted: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_getChangeLog_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_GetChangeLog_localRulestacksGetChangeLogMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().GetChangeLog(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.Changelog = armpanngfw.Changelog{ + // Changes: []*string{ + // to.Ptr("aaaa")}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_getSupportInfo_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_GetSupportInfo_localRulestacksGetSupportInfoMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().GetSupportInfo(ctx, "rgopenapi", "lrs1", &armpanngfw.LocalRulestacksClientGetSupportInfoOptions{Email: to.Ptr("user1@domain.com")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SupportInfo = armpanngfw.SupportInfo{ + // AccountID: to.Ptr("3cg5b439-294d-4c25-b0b2-ef649e0g6d38"), + // AccountRegistered: to.Ptr(armpanngfw.BooleanEnumTRUE), + // FreeTrial: to.Ptr(armpanngfw.BooleanEnumTRUE), + // FreeTrialCreditLeft: to.Ptr[int32](10), + // FreeTrialDaysLeft: to.Ptr[int32](1), + // HelpURL: to.Ptr("https://ssopreview.paloaltonetworks.com/home/bookmark/0oa4ao61shG4rd3Ub1d7/2557"), + // ProductSerial: to.Ptr("e22715cb-7e4e-4814-ad4f-ccd1417755d7"), + // ProductSKU: to.Ptr("62f63e3c-bc5a-4d68-a8a1-fcba9f526c90"), + // RegisterURL: to.Ptr("https://ssopreview.paloaltonetworks.com/home/bookmark/0oa4ao61shG4rd3Ub1d7/2557"), + // SupportURL: to.Ptr("https://ssopreview.paloaltonetworks.com/home/bookmark/0oa4ao61shG4rd3Ub1d7/2557"), + // UserDomainSupported: to.Ptr(armpanngfw.BooleanEnumTRUE), + // UserRegistered: to.Ptr(armpanngfw.BooleanEnumTRUE), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_getSupportInfo_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_GetSupportInfo_localRulestacksGetSupportInfoMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().GetSupportInfo(ctx, "rgopenapi", "lrs1", &armpanngfw.LocalRulestacksClientGetSupportInfoOptions{Email: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SupportInfo = armpanngfw.SupportInfo{ + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listAdvancedSecurityObjects_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_ListAdvancedSecurityObjects_localRulestacksListAdvancedSecurityObjectsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListAdvancedSecurityObjects(ctx, "rgopenapi", "lrs1", armpanngfw.AdvSecurityObjectTypeEnum("localRulestacks"), &armpanngfw.LocalRulestacksClientListAdvancedSecurityObjectsOptions{Skip: to.Ptr("a6a321"), + Top: to.Ptr[int32](20), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AdvSecurityObjectListResponse = armpanngfw.AdvSecurityObjectListResponse{ + // Value: &armpanngfw.AdvSecurityObjectModel{ + // Type: to.Ptr("localRulestacks"), + // Entry: []*armpanngfw.NameDescriptionObject{ + // { + // Name: to.Ptr("aaaaaaaaaa"), + // Description: to.Ptr("aaaaaaaaaaaa"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listAdvancedSecurityObjects_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_ListAdvancedSecurityObjects_localRulestacksListAdvancedSecurityObjectsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListAdvancedSecurityObjects(ctx, "rgopenapi", "lrs1", armpanngfw.AdvSecurityObjectTypeEnum("localRulestacks"), &armpanngfw.LocalRulestacksClientListAdvancedSecurityObjectsOptions{Skip: nil, + Top: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.AdvSecurityObjectListResponse = armpanngfw.AdvSecurityObjectListResponse{ + // Value: &armpanngfw.AdvSecurityObjectModel{ + // Entry: []*armpanngfw.NameDescriptionObject{ + // { + // Name: to.Ptr("aaaaaaaaaa"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listAppIds_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_ListAppIDs_localRulestacksListAppIdsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListAppIDs(ctx, "rgopenapi", "lrs1", &armpanngfw.LocalRulestacksClientListAppIDsOptions{AppIDVersion: to.Ptr("8543"), + AppPrefix: to.Ptr("pref"), + Skip: to.Ptr("a6a321"), + Top: to.Ptr[int32](20), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ListAppIDResponse = armpanngfw.ListAppIDResponse{ + // Value: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa")}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listAppIds_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_ListAppIDs_localRulestacksListAppIdsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListAppIDs(ctx, "rgopenapi", "lrs1", &armpanngfw.LocalRulestacksClientListAppIDsOptions{AppIDVersion: nil, + AppPrefix: nil, + Skip: nil, + Top: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ListAppIDResponse = armpanngfw.ListAppIDResponse{ + // Value: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa")}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listCountries_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_ListCountries_localRulestacksListCountriesMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListCountries(ctx, "rgopenapi", "lrs1", &armpanngfw.LocalRulestacksClientListCountriesOptions{Skip: to.Ptr("a6a321"), + Top: to.Ptr[int32](20), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CountriesResponse = armpanngfw.CountriesResponse{ + // Value: []*armpanngfw.Country{ + // { + // Description: to.Ptr("aaaaa"), + // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listCountries_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_ListCountries_localRulestacksListCountriesMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListCountries(ctx, "rgopenapi", "lrs1", &armpanngfw.LocalRulestacksClientListCountriesOptions{Skip: nil, + Top: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.CountriesResponse = armpanngfw.CountriesResponse{ + // Value: []*armpanngfw.Country{ + // { + // Code: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listFirewalls_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_ListFirewalls_localRulestacksListFirewallsMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListFirewalls(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ListFirewallsResponse = armpanngfw.ListFirewallsResponse{ + // Value: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listFirewalls_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_ListFirewalls_localRulestacksListFirewallsMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListFirewalls(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.ListFirewallsResponse = armpanngfw.ListFirewallsResponse{ + // Value: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa")}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listPredefinedUrlCategories_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_ListPredefinedURLCategories_localRulestacksListPredefinedUrlCategoriesMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListPredefinedURLCategories(ctx, "rgopenapi", "lrs1", &armpanngfw.LocalRulestacksClientListPredefinedURLCategoriesOptions{Skip: to.Ptr("a6a321"), + Top: to.Ptr[int32](20), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PredefinedURLCategoriesResponse = armpanngfw.PredefinedURLCategoriesResponse{ + // Value: []*armpanngfw.PredefinedURLCategory{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // Action: to.Ptr("aaaaaaa"), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listPredefinedUrlCategories_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_ListPredefinedURLCategories_localRulestacksListPredefinedUrlCategoriesMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListPredefinedURLCategories(ctx, "rgopenapi", "lrs1", &armpanngfw.LocalRulestacksClientListPredefinedURLCategoriesOptions{Skip: nil, + Top: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PredefinedURLCategoriesResponse = armpanngfw.PredefinedURLCategoriesResponse{ + // Value: []*armpanngfw.PredefinedURLCategory{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // Action: to.Ptr("aaaaaaa"), + // }}, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listSecurityServices_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_ListSecurityServices_localRulestacksListSecurityServicesMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListSecurityServices(ctx, "rgopenapi", "lrs1", armpanngfw.SecurityServicesTypeEnum("localRulestacks"), &armpanngfw.LocalRulestacksClientListSecurityServicesOptions{Skip: to.Ptr("a6a321"), + Top: to.Ptr[int32](20), + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SecurityServicesResponse = armpanngfw.SecurityServicesResponse{ + // Value: &armpanngfw.SecurityServicesTypeList{ + // Type: to.Ptr("localRulestacks"), + // Entry: []*armpanngfw.NameDescriptionObject{ + // { + // Name: to.Ptr("aaaaaaaaaa"), + // Description: to.Ptr("aaaaaaaaaaaa"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_listSecurityServices_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_ListSecurityServices_localRulestacksListSecurityServicesMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewLocalRulestacksClient().ListSecurityServices(ctx, "rgopenapi", "lrs1", armpanngfw.SecurityServicesTypeEnum("localRulestacks"), &armpanngfw.LocalRulestacksClientListSecurityServicesOptions{Skip: nil, + Top: nil, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.SecurityServicesResponse = armpanngfw.SecurityServicesResponse{ + // Value: &armpanngfw.SecurityServicesTypeList{ + // Entry: []*armpanngfw.NameDescriptionObject{ + // { + // Name: to.Ptr("aaaaaaaaaa"), + // }}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_revert_MaximumSet_Gen.json +func ExampleLocalRulestacksClient_Revert_localRulestacksRevertMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewLocalRulestacksClient().Revert(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/LocalRulestacks_revert_MinimumSet_Gen.json +func ExampleLocalRulestacksClient_Revert_localRulestacksRevertMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewLocalRulestacksClient().Revert(ctx, "rgopenapi", "lrs1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/models.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/models.go new file mode 100644 index 000000000000..d786e70d9847 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/models.go @@ -0,0 +1,1924 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import "time" + +// AdvSecurityObjectListResponse - advanced security object +type AdvSecurityObjectListResponse struct { + // REQUIRED; response value + Value *AdvSecurityObjectModel + + // next link + NextLink *string +} + +// AdvSecurityObjectModel - List of custom and predefined url category +type AdvSecurityObjectModel struct { + // REQUIRED; URL entry + Entry []*NameDescriptionObject + + // type of object + Type *string +} + +// AppSeenData - Data Type for App Seen +type AppSeenData struct { + // REQUIRED; array of appSeen + AppSeenList []*AppSeenInfo + + // REQUIRED; number of rows + Count *int32 +} + +// AppSeenInfo - Definition for App Seen +type AppSeenInfo struct { + // REQUIRED; category + Category *string + + // REQUIRED; risk + Risk *string + + // REQUIRED; standardPorts + StandardPorts *string + + // REQUIRED; subCategory + SubCategory *string + + // REQUIRED; tag + Tag *string + + // REQUIRED; technology + Technology *string + + // REQUIRED; title + Title *string +} + +// ApplicationInsights - Application Insights key +type ApplicationInsights struct { + // Resource id for Application Insights + ID *string + + // Application Insights key + Key *string +} + +// AzureResourceManagerManagedIdentityProperties - The properties of the managed service identities assigned to this resource. +type AzureResourceManagerManagedIdentityProperties struct { + // REQUIRED; The type of managed identity assigned to this resource. + Type *ManagedIdentityType + + // The identities assigned to this resource by the user. + UserAssignedIdentities map[string]*AzureResourceManagerUserAssignedIdentity + + // READ-ONLY; The active directory identifier of this principal. + PrincipalID *string + + // READ-ONLY; The Active Directory tenant id of the principal. + TenantID *string +} + +// AzureResourceManagerUserAssignedIdentity - A managed identity assigned by the user. +type AzureResourceManagerUserAssignedIdentity struct { + // The active directory client identifier for this principal. + ClientID *string + + // The active directory identifier for this principal. + PrincipalID *string +} + +// Category - URL/EDL to match +type Category struct { + // REQUIRED; feed list + Feeds []*string + + // REQUIRED; custom URL + URLCustom []*string +} + +// CertificateObject - certificate used for inbound and outbound decryption +type CertificateObject struct { + // REQUIRED; use certificate self signed + CertificateSelfSigned *BooleanEnum + + // comment for this object + AuditComment *string + + // Resource Id of certificate signer, to be populated only when certificateSelfSigned is false + CertificateSignerResourceID *string + + // user description for this object + Description *string + + // read only string representing last create or update + Etag *string + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// CertificateObjectGlobalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the CertificateObjectGlobalRulestackClient.BeginCreateOrUpdate +// method. +type CertificateObjectGlobalRulestackClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CertificateObjectGlobalRulestackClientBeginDeleteOptions contains the optional parameters for the CertificateObjectGlobalRulestackClient.BeginDelete +// method. +type CertificateObjectGlobalRulestackClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CertificateObjectGlobalRulestackClientGetOptions contains the optional parameters for the CertificateObjectGlobalRulestackClient.Get +// method. +type CertificateObjectGlobalRulestackClientGetOptions struct { + // placeholder for future optional parameters +} + +// CertificateObjectGlobalRulestackClientListOptions contains the optional parameters for the CertificateObjectGlobalRulestackClient.NewListPager +// method. +type CertificateObjectGlobalRulestackClientListOptions struct { + // placeholder for future optional parameters +} + +// CertificateObjectGlobalRulestackResource - GlobalRulestack Certificate Object +type CertificateObjectGlobalRulestackResource struct { + // REQUIRED; The resource-specific properties for this resource. + Properties *CertificateObject + + // 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 +} + +// CertificateObjectGlobalRulestackResourceListResult - The response of a CertificateObjectGlobalRulestackResource list operation. +type CertificateObjectGlobalRulestackResourceListResult struct { + // REQUIRED; The items on this page + Value []*CertificateObjectGlobalRulestackResource + + // The link to the next page of items + NextLink *string +} + +// CertificateObjectLocalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the CertificateObjectLocalRulestackClient.BeginCreateOrUpdate +// method. +type CertificateObjectLocalRulestackClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CertificateObjectLocalRulestackClientBeginDeleteOptions contains the optional parameters for the CertificateObjectLocalRulestackClient.BeginDelete +// method. +type CertificateObjectLocalRulestackClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CertificateObjectLocalRulestackClientGetOptions contains the optional parameters for the CertificateObjectLocalRulestackClient.Get +// method. +type CertificateObjectLocalRulestackClientGetOptions struct { + // placeholder for future optional parameters +} + +// CertificateObjectLocalRulestackClientListByLocalRulestacksOptions contains the optional parameters for the CertificateObjectLocalRulestackClient.NewListByLocalRulestacksPager +// method. +type CertificateObjectLocalRulestackClientListByLocalRulestacksOptions struct { + // placeholder for future optional parameters +} + +// CertificateObjectLocalRulestackResource - LocalRulestack Certificate Object +type CertificateObjectLocalRulestackResource struct { + // REQUIRED; The resource-specific properties for this resource. + Properties *CertificateObject + + // 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 +} + +// CertificateObjectLocalRulestackResourceListResult - The response of a CertificateObjectLocalRulestackResource list operation. +type CertificateObjectLocalRulestackResourceListResult struct { + // REQUIRED; The items on this page + Value []*CertificateObjectLocalRulestackResource + + // The link to the next page of items + NextLink *string +} + +// Changelog list +type Changelog struct { + // REQUIRED; list of changes + Changes []*string + + // lastCommitted timestamp + LastCommitted *time.Time + + // lastModified timestamp + LastModified *time.Time +} + +// CountriesResponse - Countries Response Object +type CountriesResponse struct { + // REQUIRED; List of countries + Value []*Country + + // next link + NextLink *string +} + +// Country Description +type Country struct { + // REQUIRED; country code + Code *string + + // code description + Description *string +} + +// DNSSettings - DNS Proxy settings for Firewall +type DNSSettings struct { + // List of IPs associated with the Firewall + DNSServers []*IPAddress + + // Enable DNS proxy, disabled by default + EnableDNSProxy *DNSProxy + + // Enabled DNS proxy type, disabled by default + EnabledDNSType *EnabledDNSType +} + +// DestinationAddr - destination address +type DestinationAddr struct { + // special value 'any' + Cidrs []*string + + // list of countries + Countries []*string + + // list of feeds + Feeds []*string + + // fqdn list + FqdnLists []*string + + // prefix list + PrefixLists []*string +} + +// EndpointConfiguration - Endpoint Configuration for frontend and backend +type EndpointConfiguration struct { + // REQUIRED; Address Space + Address *IPAddress + + // REQUIRED; port ID + Port *string +} + +// EventHub configurations +type EventHub struct { + // Resource ID of EventHub + ID *string + + // EventHub name + Name *string + + // EventHub namespace + NameSpace *string + + // EventHub policy name + PolicyName *string + + // Subscription Id + SubscriptionID *string +} + +// FirewallDeploymentProperties - Properties specific to the Firewall resource deployment. +type FirewallDeploymentProperties struct { + // REQUIRED; DNS settings for Firewall + DNSSettings *DNSSettings + + // REQUIRED; Marketplace details + MarketplaceDetails *MarketplaceDetails + + // REQUIRED; Network settings + NetworkProfile *NetworkProfile + + // REQUIRED; Billing plan information. + PlanData *PlanData + + // Associated Rulestack + AssociatedRulestack *RulestackDetails + + // Frontend settings for Firewall + FrontEndSettings []*FrontendSetting + + // Panorama Managed: Default is False. Default will be CloudSec managed + IsPanoramaManaged *BooleanEnum + + // panEtag info + PanEtag *string + + // Panorama Configuration + PanoramaConfig *PanoramaConfig + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// FirewallResource - PaloAltoNetworks Firewall +type FirewallResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; The resource-specific properties for this resource. + Properties *FirewallDeploymentProperties + + // The managed service identities assigned to this resource. + Identity *AzureResourceManagerManagedIdentityProperties + + // 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 +} + +// FirewallResourceListResult - The response of a FirewallResource list operation. +type FirewallResourceListResult struct { + // REQUIRED; The items on this page + Value []*FirewallResource + + // The link to the next page of items + NextLink *string +} + +// FirewallResourceUpdate - The type used for update operations of the FirewallResource. +type FirewallResourceUpdate struct { + // The managed service identities assigned to this resource. + Identity *AzureResourceManagerManagedIdentityProperties + + // The updatable properties of the FirewallResource. + Properties *FirewallResourceUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// FirewallResourceUpdateProperties - The updatable properties of the FirewallResource. +type FirewallResourceUpdateProperties struct { + // Associated Rulestack + AssociatedRulestack *RulestackDetails + + // DNS settings for Firewall + DNSSettings *DNSSettings + + // Frontend settings for Firewall + FrontEndSettings []*FrontendSetting + + // Panorama Managed: Default is False. Default will be CloudSec managed + IsPanoramaManaged *BooleanEnum + + // Marketplace details + MarketplaceDetails *MarketplaceDetails + + // Network settings + NetworkProfile *NetworkProfile + + // panEtag info + PanEtag *string + + // Panorama Configuration + PanoramaConfig *PanoramaConfig + + // Billing plan information. + PlanData *PlanData +} + +// FirewallStatusClientGetOptions contains the optional parameters for the FirewallStatusClient.Get method. +type FirewallStatusClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallStatusClientListByFirewallsOptions contains the optional parameters for the FirewallStatusClient.NewListByFirewallsPager +// method. +type FirewallStatusClientListByFirewallsOptions struct { + // placeholder for future optional parameters +} + +// FirewallStatusProperty - Firewall Status +type FirewallStatusProperty struct { + // READ-ONLY; Detail description of current health of the Firewall + HealthReason *string + + // READ-ONLY; Current status of the Firewall + HealthStatus *HealthStatus + + // READ-ONLY; Panorama Managed: Default is False. Default will be CloudSec managed + IsPanoramaManaged *BooleanEnum + + // READ-ONLY; Panorama Status + PanoramaStatus *PanoramaStatus + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ReadOnlyProvisioningState +} + +// FirewallStatusResource - Firewall Status +type FirewallStatusResource struct { + // REQUIRED; The resource-specific properties for this resource. + Properties *FirewallStatusProperty + + // 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 +} + +// FirewallStatusResourceListResult - The response of a FirewallStatusResource list operation. +type FirewallStatusResourceListResult struct { + // REQUIRED; The items on this page + Value []*FirewallStatusResource + + // The link to the next page of items + NextLink *string +} + +// FirewallsClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallsClient.BeginCreateOrUpdate +// method. +type FirewallsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallsClientBeginDeleteOptions contains the optional parameters for the FirewallsClient.BeginDelete method. +type FirewallsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallsClientGetGlobalRulestackOptions contains the optional parameters for the FirewallsClient.GetGlobalRulestack method. +type FirewallsClientGetGlobalRulestackOptions struct { + // placeholder for future optional parameters +} + +// FirewallsClientGetLogProfileOptions contains the optional parameters for the FirewallsClient.GetLogProfile method. +type FirewallsClientGetLogProfileOptions struct { + // placeholder for future optional parameters +} + +// FirewallsClientGetOptions contains the optional parameters for the FirewallsClient.Get method. +type FirewallsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallsClientGetSupportInfoOptions contains the optional parameters for the FirewallsClient.GetSupportInfo method. +type FirewallsClientGetSupportInfoOptions struct { + // email address on behalf of which this API called + Email *string +} + +// FirewallsClientListByResourceGroupOptions contains the optional parameters for the FirewallsClient.NewListByResourceGroupPager +// method. +type FirewallsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// FirewallsClientListBySubscriptionOptions contains the optional parameters for the FirewallsClient.NewListBySubscriptionPager +// method. +type FirewallsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// FirewallsClientSaveLogProfileOptions contains the optional parameters for the FirewallsClient.SaveLogProfile method. +type FirewallsClientSaveLogProfileOptions struct { + LogSettings *LogSettings +} + +// FirewallsClientUpdateOptions contains the optional parameters for the FirewallsClient.Update method. +type FirewallsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// FqdnListGlobalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the FqdnListGlobalRulestackClient.BeginCreateOrUpdate +// method. +type FqdnListGlobalRulestackClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FqdnListGlobalRulestackClientBeginDeleteOptions contains the optional parameters for the FqdnListGlobalRulestackClient.BeginDelete +// method. +type FqdnListGlobalRulestackClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FqdnListGlobalRulestackClientGetOptions contains the optional parameters for the FqdnListGlobalRulestackClient.Get method. +type FqdnListGlobalRulestackClientGetOptions struct { + // placeholder for future optional parameters +} + +// FqdnListGlobalRulestackClientListOptions contains the optional parameters for the FqdnListGlobalRulestackClient.NewListPager +// method. +type FqdnListGlobalRulestackClientListOptions struct { + // placeholder for future optional parameters +} + +// FqdnListGlobalRulestackResource - GlobalRulestack fqdnList +type FqdnListGlobalRulestackResource struct { + // REQUIRED; The resource-specific properties for this resource. + Properties *FqdnObject + + // 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 +} + +// FqdnListGlobalRulestackResourceListResult - The response of a FqdnListGlobalRulestackResource list operation. +type FqdnListGlobalRulestackResourceListResult struct { + // REQUIRED; The items on this page + Value []*FqdnListGlobalRulestackResource + + // The link to the next page of items + NextLink *string +} + +// FqdnListLocalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the FqdnListLocalRulestackClient.BeginCreateOrUpdate +// method. +type FqdnListLocalRulestackClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FqdnListLocalRulestackClientBeginDeleteOptions contains the optional parameters for the FqdnListLocalRulestackClient.BeginDelete +// method. +type FqdnListLocalRulestackClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FqdnListLocalRulestackClientGetOptions contains the optional parameters for the FqdnListLocalRulestackClient.Get method. +type FqdnListLocalRulestackClientGetOptions struct { + // placeholder for future optional parameters +} + +// FqdnListLocalRulestackClientListByLocalRulestacksOptions contains the optional parameters for the FqdnListLocalRulestackClient.NewListByLocalRulestacksPager +// method. +type FqdnListLocalRulestackClientListByLocalRulestacksOptions struct { + // placeholder for future optional parameters +} + +// FqdnListLocalRulestackResource - LocalRulestack fqdnList +type FqdnListLocalRulestackResource struct { + // REQUIRED; The resource-specific properties for this resource. + Properties *FqdnObject + + // 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 +} + +// FqdnListLocalRulestackResourceListResult - The response of a FqdnListLocalRulestackResource list operation. +type FqdnListLocalRulestackResourceListResult struct { + // REQUIRED; The items on this page + Value []*FqdnListLocalRulestackResource + + // The link to the next page of items + NextLink *string +} + +// FqdnObject - fqdn object +type FqdnObject struct { + // REQUIRED; fqdn list + FqdnList []*string + + // comment for this object + AuditComment *string + + // fqdn object description + Description *string + + // etag info + Etag *string + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// FrontendSetting - Frontend setting for Firewall +type FrontendSetting struct { + // REQUIRED; Backend configurations + BackendConfiguration *EndpointConfiguration + + // REQUIRED; Frontend configurations + FrontendConfiguration *EndpointConfiguration + + // REQUIRED; Settings name + Name *string + + // REQUIRED; Protocol Type + Protocol *ProtocolType +} + +// GlobalRulestackClientBeginCommitOptions contains the optional parameters for the GlobalRulestackClient.BeginCommit method. +type GlobalRulestackClientBeginCommitOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GlobalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the GlobalRulestackClient.BeginCreateOrUpdate +// method. +type GlobalRulestackClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GlobalRulestackClientBeginDeleteOptions contains the optional parameters for the GlobalRulestackClient.BeginDelete method. +type GlobalRulestackClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GlobalRulestackClientGetChangeLogOptions contains the optional parameters for the GlobalRulestackClient.GetChangeLog method. +type GlobalRulestackClientGetChangeLogOptions struct { + // placeholder for future optional parameters +} + +// GlobalRulestackClientGetOptions contains the optional parameters for the GlobalRulestackClient.Get method. +type GlobalRulestackClientGetOptions struct { + // placeholder for future optional parameters +} + +// GlobalRulestackClientListAdvancedSecurityObjectsOptions contains the optional parameters for the GlobalRulestackClient.ListAdvancedSecurityObjects +// method. +type GlobalRulestackClientListAdvancedSecurityObjectsOptions struct { + Skip *string + Top *int32 +} + +// GlobalRulestackClientListAppIDsOptions contains the optional parameters for the GlobalRulestackClient.ListAppIDs method. +type GlobalRulestackClientListAppIDsOptions struct { + AppIDVersion *string + AppPrefix *string + Skip *string + Top *int32 +} + +// GlobalRulestackClientListCountriesOptions contains the optional parameters for the GlobalRulestackClient.ListCountries +// method. +type GlobalRulestackClientListCountriesOptions struct { + Skip *string + Top *int32 +} + +// GlobalRulestackClientListFirewallsOptions contains the optional parameters for the GlobalRulestackClient.ListFirewalls +// method. +type GlobalRulestackClientListFirewallsOptions struct { + // placeholder for future optional parameters +} + +// GlobalRulestackClientListOptions contains the optional parameters for the GlobalRulestackClient.NewListPager method. +type GlobalRulestackClientListOptions struct { + // placeholder for future optional parameters +} + +// GlobalRulestackClientListPredefinedURLCategoriesOptions contains the optional parameters for the GlobalRulestackClient.ListPredefinedURLCategories +// method. +type GlobalRulestackClientListPredefinedURLCategoriesOptions struct { + Skip *string + Top *int32 +} + +// GlobalRulestackClientListSecurityServicesOptions contains the optional parameters for the GlobalRulestackClient.ListSecurityServices +// method. +type GlobalRulestackClientListSecurityServicesOptions struct { + Skip *string + Top *int32 +} + +// GlobalRulestackClientRevertOptions contains the optional parameters for the GlobalRulestackClient.Revert method. +type GlobalRulestackClientRevertOptions struct { + // placeholder for future optional parameters +} + +// GlobalRulestackClientUpdateOptions contains the optional parameters for the GlobalRulestackClient.Update method. +type GlobalRulestackClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// GlobalRulestackInfo - PAN Rulestack Describe Object +type GlobalRulestackInfo struct { + // REQUIRED; rulestack description + AzureID *string +} + +// GlobalRulestackResource - PaloAltoNetworks GlobalRulestack +type GlobalRulestackResource struct { + // REQUIRED; Global Location + Location *string + + // REQUIRED; The resource-specific properties for this resource. + Properties *RulestackProperties + + // The managed service identities assigned to this resource. + Identity *AzureResourceManagerManagedIdentityProperties + + // 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 +} + +// GlobalRulestackResourceListResult - The response of a GlobalRulestackResource list operation. +type GlobalRulestackResourceListResult struct { + // REQUIRED; The items on this page + Value []*GlobalRulestackResource + + // The link to the next page of items + NextLink *string +} + +// GlobalRulestackResourceUpdate - The type used for update operations of the GlobalRulestackResource. +type GlobalRulestackResourceUpdate struct { + // The managed service identities assigned to this resource. + Identity *AzureResourceManagerManagedIdentityProperties + + // Global Location + Location *string + + // The updatable properties of the GlobalRulestackResource. + Properties *GlobalRulestackResourceUpdateProperties +} + +// GlobalRulestackResourceUpdateProperties - The updatable properties of the GlobalRulestackResource. +type GlobalRulestackResourceUpdateProperties struct { + // subscription scope of global rulestack + AssociatedSubscriptions []*string + + // Mode for default rules creation + DefaultMode *DefaultMode + + // rulestack description + Description *string + + // minimum version + MinAppIDVersion *string + + // PanEtag info + PanEtag *string + + // Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks + PanLocation *string + + // Rulestack Type + Scope *ScopeType + + // Security Profile + SecurityServices *SecurityServices +} + +// IPAddress - IP Address +type IPAddress struct { + // Address value + Address *string + + // Resource Id + ResourceID *string +} + +// IPAddressSpace - IP Address Space +type IPAddressSpace struct { + // Address Space + AddressSpace *string + + // Resource Id + ResourceID *string +} + +type ListAppIDResponse struct { + // REQUIRED; List of AppIds + Value []*string + + // next Link + NextLink *string +} + +// ListFirewallsResponse - List firewalls response +type ListFirewallsResponse struct { + // REQUIRED; firewalls list + Value []*string + + // next link + NextLink *string +} + +// LocalRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the LocalRulesClient.BeginCreateOrUpdate +// method. +type LocalRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LocalRulesClientBeginDeleteOptions contains the optional parameters for the LocalRulesClient.BeginDelete method. +type LocalRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LocalRulesClientGetCountersOptions contains the optional parameters for the LocalRulesClient.GetCounters method. +type LocalRulesClientGetCountersOptions struct { + FirewallName *string +} + +// LocalRulesClientGetOptions contains the optional parameters for the LocalRulesClient.Get method. +type LocalRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// LocalRulesClientListByLocalRulestacksOptions contains the optional parameters for the LocalRulesClient.NewListByLocalRulestacksPager +// method. +type LocalRulesClientListByLocalRulestacksOptions struct { + // placeholder for future optional parameters +} + +// LocalRulesClientRefreshCountersOptions contains the optional parameters for the LocalRulesClient.RefreshCounters method. +type LocalRulesClientRefreshCountersOptions struct { + FirewallName *string +} + +// LocalRulesClientResetCountersOptions contains the optional parameters for the LocalRulesClient.ResetCounters method. +type LocalRulesClientResetCountersOptions struct { + FirewallName *string +} + +// LocalRulesResource - LocalRulestack rule list +type LocalRulesResource struct { + // REQUIRED; The resource-specific properties for this resource. + Properties *RuleEntry + + // 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 +} + +// LocalRulesResourceListResult - The response of a LocalRulesResource list operation. +type LocalRulesResourceListResult struct { + // REQUIRED; The items on this page + Value []*LocalRulesResource + + // The link to the next page of items + NextLink *string +} + +// LocalRulestackResource - PaloAltoNetworks LocalRulestack +type LocalRulestackResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; The resource-specific properties for this resource. + Properties *RulestackProperties + + // The managed service identities assigned to this resource. + Identity *AzureResourceManagerManagedIdentityProperties + + // 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 +} + +// LocalRulestackResourceListResult - The response of a LocalRulestackResource list operation. +type LocalRulestackResourceListResult struct { + // REQUIRED; The items on this page + Value []*LocalRulestackResource + + // The link to the next page of items + NextLink *string +} + +// LocalRulestackResourceUpdate - The type used for update operations of the LocalRulestackResource. +type LocalRulestackResourceUpdate struct { + // The managed service identities assigned to this resource. + Identity *AzureResourceManagerManagedIdentityProperties + + // The updatable properties of the LocalRulestackResource. + Properties *LocalRulestackResourceUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// LocalRulestackResourceUpdateProperties - The updatable properties of the LocalRulestackResource. +type LocalRulestackResourceUpdateProperties struct { + // subscription scope of global rulestack + AssociatedSubscriptions []*string + + // Mode for default rules creation + DefaultMode *DefaultMode + + // rulestack description + Description *string + + // minimum version + MinAppIDVersion *string + + // PanEtag info + PanEtag *string + + // Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks + PanLocation *string + + // Rulestack Type + Scope *ScopeType + + // Security Profile + SecurityServices *SecurityServices +} + +// LocalRulestacksClientBeginCommitOptions contains the optional parameters for the LocalRulestacksClient.BeginCommit method. +type LocalRulestacksClientBeginCommitOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LocalRulestacksClientBeginCreateOrUpdateOptions contains the optional parameters for the LocalRulestacksClient.BeginCreateOrUpdate +// method. +type LocalRulestacksClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LocalRulestacksClientBeginDeleteOptions contains the optional parameters for the LocalRulestacksClient.BeginDelete method. +type LocalRulestacksClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// LocalRulestacksClientGetChangeLogOptions contains the optional parameters for the LocalRulestacksClient.GetChangeLog method. +type LocalRulestacksClientGetChangeLogOptions struct { + // placeholder for future optional parameters +} + +// LocalRulestacksClientGetOptions contains the optional parameters for the LocalRulestacksClient.Get method. +type LocalRulestacksClientGetOptions struct { + // placeholder for future optional parameters +} + +// LocalRulestacksClientGetSupportInfoOptions contains the optional parameters for the LocalRulestacksClient.GetSupportInfo +// method. +type LocalRulestacksClientGetSupportInfoOptions struct { + // email address on behalf of which this API called + Email *string +} + +// LocalRulestacksClientListAdvancedSecurityObjectsOptions contains the optional parameters for the LocalRulestacksClient.ListAdvancedSecurityObjects +// method. +type LocalRulestacksClientListAdvancedSecurityObjectsOptions struct { + Skip *string + Top *int32 +} + +// LocalRulestacksClientListAppIDsOptions contains the optional parameters for the LocalRulestacksClient.ListAppIDs method. +type LocalRulestacksClientListAppIDsOptions struct { + AppIDVersion *string + AppPrefix *string + Skip *string + Top *int32 +} + +// LocalRulestacksClientListByResourceGroupOptions contains the optional parameters for the LocalRulestacksClient.NewListByResourceGroupPager +// method. +type LocalRulestacksClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// LocalRulestacksClientListBySubscriptionOptions contains the optional parameters for the LocalRulestacksClient.NewListBySubscriptionPager +// method. +type LocalRulestacksClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// LocalRulestacksClientListCountriesOptions contains the optional parameters for the LocalRulestacksClient.ListCountries +// method. +type LocalRulestacksClientListCountriesOptions struct { + Skip *string + Top *int32 +} + +// LocalRulestacksClientListFirewallsOptions contains the optional parameters for the LocalRulestacksClient.ListFirewalls +// method. +type LocalRulestacksClientListFirewallsOptions struct { + // placeholder for future optional parameters +} + +// LocalRulestacksClientListPredefinedURLCategoriesOptions contains the optional parameters for the LocalRulestacksClient.ListPredefinedURLCategories +// method. +type LocalRulestacksClientListPredefinedURLCategoriesOptions struct { + Skip *string + Top *int32 +} + +// LocalRulestacksClientListSecurityServicesOptions contains the optional parameters for the LocalRulestacksClient.ListSecurityServices +// method. +type LocalRulestacksClientListSecurityServicesOptions struct { + Skip *string + Top *int32 +} + +// LocalRulestacksClientRevertOptions contains the optional parameters for the LocalRulestacksClient.Revert method. +type LocalRulestacksClientRevertOptions struct { + // placeholder for future optional parameters +} + +// LocalRulestacksClientUpdateOptions contains the optional parameters for the LocalRulestacksClient.Update method. +type LocalRulestacksClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// LogDestination - Log Destination +type LogDestination struct { + // Event Hub configurations + EventHubConfigurations *EventHub + + // Monitor Log configurations + MonitorConfigurations *MonitorLog + + // Storage account configurations + StorageConfigurations *StorageAccount +} + +// LogSettings - Log Settings for Firewall +type LogSettings struct { + // Application Insight details + ApplicationInsights *ApplicationInsights + + // Common destination configurations + CommonDestination *LogDestination + + // Decrypt destination configurations + DecryptLogDestination *LogDestination + + // Log option SAME/INDIVIDUAL + LogOption *LogOption + + // One of possible log type + LogType *LogType + + // Threat destination configurations + ThreatLogDestination *LogDestination + + // Traffic destination configurations + TrafficLogDestination *LogDestination +} + +// MarketplaceDetails of PAN Firewall resource +type MarketplaceDetails struct { + // REQUIRED; Offer Id + OfferID *string + + // REQUIRED; Publisher Id + PublisherID *string + + // Marketplace Subscription Status + MarketplaceSubscriptionStatus *MarketplaceSubscriptionStatus + + // READ-ONLY; Marketplace Subscription Id + MarketplaceSubscriptionID *string +} + +// MonitorLog configurations +type MonitorLog struct { + // Resource ID of MonitorLog + ID *string + + // Primary Key value for Monitor + PrimaryKey *string + + // Secondary Key value for Monitor + SecondaryKey *string + + // Subscription Id + SubscriptionID *string + + // MonitorLog workspace + Workspace *string +} + +// NameDescriptionObject - object type info +type NameDescriptionObject struct { + // REQUIRED; name value + Name *string + + // description value + Description *string +} + +// NetworkProfile - Network settings for Firewall +type NetworkProfile struct { + // REQUIRED; Enable egress NAT, enabled by default + EnableEgressNat *EgressNat + + // REQUIRED; vnet or vwan, cannot be updated + NetworkType *NetworkType + + // REQUIRED; List of IPs associated with the Firewall + PublicIPs []*IPAddress + + // Egress nat IP to use + EgressNatIP []*IPAddress + + // Vnet configurations + VnetConfiguration *VnetConfiguration + + // Vwan configurations + VwanConfiguration *VwanConfiguration +} + +// 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 +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PanoramaConfig - Panorama Config +type PanoramaConfig struct { + // REQUIRED; Base64 encoded string representing Panorama parameters to be used by Firewall to connect to Panorama. This string + // is generated via azure plugin in Panorama + ConfigString *string + + // READ-ONLY; Panorama Collector Group to join - (Once configured we can not edit the value) + CgName *string + + // READ-ONLY; Panorama Device Group to join + DgName *string + + // READ-ONLY; Resource name(may be unique) for PN admin + HostName *string + + // READ-ONLY; Primary Panorama Server IP address value in dotted format for IPv4 + PanoramaServer *string + + // READ-ONLY; Secondary Panorama Server IP address value in dotted format for IPv4 + PanoramaServer2 *string + + // READ-ONLY; Panorama Template Stack to join - (Once configured we can not edit the value) + TplName *string + + // READ-ONLY; VM auth key for panorama connectivity + VMAuthKey *string +} + +// PanoramaStatus - Panorama connectivity information +type PanoramaStatus struct { + // READ-ONLY; Secondary Panorama connection status + PanoramaServer2Status *ServerStatus + + // READ-ONLY; Primary Panorama connection status + PanoramaServerStatus *ServerStatus +} + +// PlanData - Billing plan information. +type PlanData struct { + // REQUIRED; different billing cycles like MONTHLY/WEEKLY + BillingCycle *BillingCycle + + // REQUIRED; plan id as published by Liftr.PAN + PlanID *string + + // different usage type like PAYG/COMMITTED + UsageType *UsageType + + // READ-ONLY; date when plan was applied + EffectiveDate *time.Time +} + +// PostRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the PostRulesClient.BeginCreateOrUpdate +// method. +type PostRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PostRulesClientBeginDeleteOptions contains the optional parameters for the PostRulesClient.BeginDelete method. +type PostRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PostRulesClientGetCountersOptions contains the optional parameters for the PostRulesClient.GetCounters method. +type PostRulesClientGetCountersOptions struct { + FirewallName *string +} + +// PostRulesClientGetOptions contains the optional parameters for the PostRulesClient.Get method. +type PostRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PostRulesClientListOptions contains the optional parameters for the PostRulesClient.NewListPager method. +type PostRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// PostRulesClientRefreshCountersOptions contains the optional parameters for the PostRulesClient.RefreshCounters method. +type PostRulesClientRefreshCountersOptions struct { + FirewallName *string +} + +// PostRulesClientResetCountersOptions contains the optional parameters for the PostRulesClient.ResetCounters method. +type PostRulesClientResetCountersOptions struct { + FirewallName *string +} + +// PostRulesResource - PostRulestack rule list +type PostRulesResource struct { + // REQUIRED; The resource-specific properties for this resource. + Properties *RuleEntry + + // 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 +} + +// PostRulesResourceListResult - The response of a PostRulesResource list operation. +type PostRulesResourceListResult struct { + // REQUIRED; The items on this page + Value []*PostRulesResource + + // The link to the next page of items + NextLink *string +} + +// PreRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the PreRulesClient.BeginCreateOrUpdate method. +type PreRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PreRulesClientBeginDeleteOptions contains the optional parameters for the PreRulesClient.BeginDelete method. +type PreRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PreRulesClientGetCountersOptions contains the optional parameters for the PreRulesClient.GetCounters method. +type PreRulesClientGetCountersOptions struct { + FirewallName *string +} + +// PreRulesClientGetOptions contains the optional parameters for the PreRulesClient.Get method. +type PreRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PreRulesClientListOptions contains the optional parameters for the PreRulesClient.NewListPager method. +type PreRulesClientListOptions struct { + // placeholder for future optional parameters +} + +// PreRulesClientRefreshCountersOptions contains the optional parameters for the PreRulesClient.RefreshCounters method. +type PreRulesClientRefreshCountersOptions struct { + FirewallName *string +} + +// PreRulesClientResetCountersOptions contains the optional parameters for the PreRulesClient.ResetCounters method. +type PreRulesClientResetCountersOptions struct { + FirewallName *string +} + +// PreRulesResource - PreRulestack rule list +type PreRulesResource struct { + // REQUIRED; The resource-specific properties for this resource. + Properties *RuleEntry + + // 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 +} + +// PreRulesResourceListResult - The response of a PreRulesResource list operation. +type PreRulesResourceListResult struct { + // REQUIRED; The items on this page + Value []*PreRulesResource + + // The link to the next page of items + NextLink *string +} + +// PredefinedURLCategoriesResponse - predefined url categories response +type PredefinedURLCategoriesResponse struct { + // REQUIRED; predefined url categories + Value []*PredefinedURLCategory + + // next link + NextLink *string +} + +// PredefinedURLCategory - Predefined URL category object +type PredefinedURLCategory struct { + // REQUIRED + Action *string + + // REQUIRED + Name *string +} + +// PrefixListGlobalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the PrefixListGlobalRulestackClient.BeginCreateOrUpdate +// method. +type PrefixListGlobalRulestackClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrefixListGlobalRulestackClientBeginDeleteOptions contains the optional parameters for the PrefixListGlobalRulestackClient.BeginDelete +// method. +type PrefixListGlobalRulestackClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrefixListGlobalRulestackClientGetOptions contains the optional parameters for the PrefixListGlobalRulestackClient.Get +// method. +type PrefixListGlobalRulestackClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrefixListGlobalRulestackClientListOptions contains the optional parameters for the PrefixListGlobalRulestackClient.NewListPager +// method. +type PrefixListGlobalRulestackClientListOptions struct { + // placeholder for future optional parameters +} + +// PrefixListGlobalRulestackResource - GlobalRulestack prefixList +type PrefixListGlobalRulestackResource struct { + // REQUIRED; The resource-specific properties for this resource. + Properties *PrefixObject + + // 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 +} + +// PrefixListGlobalRulestackResourceListResult - The response of a PrefixListGlobalRulestackResource list operation. +type PrefixListGlobalRulestackResourceListResult struct { + // REQUIRED; The items on this page + Value []*PrefixListGlobalRulestackResource + + // The link to the next page of items + NextLink *string +} + +// PrefixListLocalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the PrefixListLocalRulestackClient.BeginCreateOrUpdate +// method. +type PrefixListLocalRulestackClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrefixListLocalRulestackClientBeginDeleteOptions contains the optional parameters for the PrefixListLocalRulestackClient.BeginDelete +// method. +type PrefixListLocalRulestackClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrefixListLocalRulestackClientGetOptions contains the optional parameters for the PrefixListLocalRulestackClient.Get method. +type PrefixListLocalRulestackClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrefixListLocalRulestackClientListByLocalRulestacksOptions contains the optional parameters for the PrefixListLocalRulestackClient.NewListByLocalRulestacksPager +// method. +type PrefixListLocalRulestackClientListByLocalRulestacksOptions struct { + // placeholder for future optional parameters +} + +// PrefixListResource - LocalRulestack prefixList +type PrefixListResource struct { + // REQUIRED; The resource-specific properties for this resource. + Properties *PrefixObject + + // 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 +} + +// PrefixListResourceListResult - The response of a PrefixListResource list operation. +type PrefixListResourceListResult struct { + // REQUIRED; The items on this page + Value []*PrefixListResource + + // The link to the next page of items + NextLink *string +} + +// PrefixObject - prefix entry +type PrefixObject struct { + // REQUIRED; prefix list + PrefixList []*string + + // comment for this object + AuditComment *string + + // prefix description + Description *string + + // etag info + Etag *string + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// RuleCounter - Rule counter +type RuleCounter struct { + // REQUIRED; priority number + Priority *string + + // REQUIRED; rule name + RuleName *string + + // apps seen + AppSeen *AppSeenData + + // firewall name + FirewallName *string + + // hit count + HitCount *int32 + + // last updated timestamp + LastUpdatedTimestamp *time.Time + + // timestamp of request + RequestTimestamp *time.Time + + // rule list name + RuleListName *string + + // rule Stack Name + RuleStackName *string + + // timestamp of response + Timestamp *time.Time +} + +// RuleCounterReset - Rule counter reset +type RuleCounterReset struct { + // firewall name + FirewallName *string + + // rule list name + RuleListName *string + + // rule name + RuleName *string + + // rule Stack Name + RuleStackName *string + + // READ-ONLY; priority number + Priority *string +} + +// RuleEntry - definition of rule +type RuleEntry struct { + // REQUIRED; rule name + RuleName *string + + // rule action + ActionType *ActionEnum + + // array of rule applications + Applications []*string + + // rule comment + AuditComment *string + + // rule category + Category *Category + + // enable or disable decryption + DecryptionRuleType *DecryptionRuleTypeEnum + + // rule description + Description *string + + // destination address + Destination *DestinationAddr + + // enable or disable logging + EnableLogging *StateEnum + + // etag info + Etag *string + + // inbound Inspection Certificate + InboundInspectionCertificate *string + + // cidr should not be 'any' + NegateDestination *BooleanEnum + + // cidr should not be 'any' + NegateSource *BooleanEnum + + // any, application-default, TCP:number, UDP:number + Protocol *string + + // prot port list + ProtocolPortList []*string + + // state of this rule + RuleState *StateEnum + + // source address + Source *SourceAddr + + // tag for rule + Tags []*TagInfo + + // READ-ONLY + Priority *int32 + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// RulestackDetails - Associated rulestack details +type RulestackDetails struct { + // Rulestack location + Location *string + + // Resource Id + ResourceID *string + + // Associated rulestack Id + RulestackID *string +} + +// RulestackProperties - PAN Rulestack Describe Object +type RulestackProperties struct { + // subscription scope of global rulestack + AssociatedSubscriptions []*string + + // Mode for default rules creation + DefaultMode *DefaultMode + + // rulestack description + Description *string + + // minimum version + MinAppIDVersion *string + + // PanEtag info + PanEtag *string + + // Rulestack Location, Required for GlobalRulestacks, Not for LocalRulestacks + PanLocation *string + + // Rulestack Type + Scope *ScopeType + + // Security Profile + SecurityServices *SecurityServices + + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + +// SecurityServices - security services +type SecurityServices struct { + // Anti spyware Profile data + AntiSpywareProfile *string + + // anti virus profile data + AntiVirusProfile *string + + // DNS Subscription profile data + DNSSubscription *string + + // File blocking profile data + FileBlockingProfile *string + + // Trusted Egress Decryption profile data + OutboundTrustCertificate *string + + // Untrusted Egress Decryption profile data + OutboundUnTrustCertificate *string + + // URL filtering profile data + URLFilteringProfile *string + + // IPs Vulnerability Profile Data + VulnerabilityProfile *string +} + +// SecurityServicesResponse - Security services list response +type SecurityServicesResponse struct { + // REQUIRED; response value + Value *SecurityServicesTypeList + + // next link + NextLink *string +} + +// SecurityServicesTypeList - Security services type list +type SecurityServicesTypeList struct { + // REQUIRED; list + Entry []*NameDescriptionObject + + // security services type + Type *string +} + +// SourceAddr - Address properties +type SourceAddr struct { + // special value 'any' + Cidrs []*string + + // list of countries + Countries []*string + + // list of feeds + Feeds []*string + + // prefix list + PrefixLists []*string +} + +// StorageAccount - Storage Account configurations +type StorageAccount struct { + // Storage account name + AccountName *string + + // Resource ID of storage account + ID *string + + // Subscription Id + SubscriptionID *string +} + +// SupportInfo - Support information for the resource +type SupportInfo struct { + // Support account associated with given resource + AccountID *string + + // account registered in Customer Support Portal + AccountRegistered *BooleanEnum + + // Product usage is in free trial period + FreeTrial *BooleanEnum + + // Free trial credit remaining + FreeTrialCreditLeft *int32 + + // Free trial days remaining + FreeTrialDaysLeft *int32 + + // URL for paloaltonetworks live community + HelpURL *string + + // product SKU associated with given resource + ProductSKU *string + + // product Serial associated with given resource + ProductSerial *string + + // URL for registering product in paloaltonetworks Customer Service Portal + RegisterURL *string + + // URL for paloaltonetworks Customer Service Portal + SupportURL *string + + // user domain is supported in Customer Support Portal + UserDomainSupported *BooleanEnum + + // user registered in Customer Support Portal + UserRegistered *BooleanEnum +} + +// 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 +} + +// TagInfo - Tag +type TagInfo struct { + // REQUIRED; tag name + Key *string + + // REQUIRED; tag value + Value *string +} + +// VnetConfiguration - VnetInfo for Firewall Networking +type VnetConfiguration struct { + // REQUIRED; Trust Subnet + TrustSubnet *IPAddressSpace + + // REQUIRED; Untrust Subnet + UnTrustSubnet *IPAddressSpace + + // REQUIRED; Azure Virtual Network + Vnet *IPAddressSpace + + // IP of trust subnet for UDR + IPOfTrustSubnetForUdr *IPAddress +} + +// VwanConfiguration - VwanInfo for Firewall Networking +type VwanConfiguration struct { + // REQUIRED; vHub Address + VHub *IPAddressSpace + + // IP of trust subnet for UDR + IPOfTrustSubnetForUdr *IPAddress + + // Network Virtual Appliance resource ID + NetworkVirtualApplianceID *string + + // Trust Subnet + TrustSubnet *IPAddressSpace + + // Untrust Subnet + UnTrustSubnet *IPAddressSpace +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/models_serde.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/models_serde.go new file mode 100644 index 000000000000..578fddec7e83 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/models_serde.go @@ -0,0 +1,3530 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AdvSecurityObjectListResponse. +func (a AdvSecurityObjectListResponse) 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 AdvSecurityObjectListResponse. +func (a *AdvSecurityObjectListResponse) 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 AdvSecurityObjectModel. +func (a AdvSecurityObjectModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "entry", a.Entry) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdvSecurityObjectModel. +func (a *AdvSecurityObjectModel) 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 "entry": + err = unpopulate(val, "Entry", &a.Entry) + 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 AppSeenData. +func (a AppSeenData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appSeenList", a.AppSeenList) + populate(objectMap, "count", a.Count) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppSeenData. +func (a *AppSeenData) 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 "appSeenList": + err = unpopulate(val, "AppSeenList", &a.AppSeenList) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &a.Count) + 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 AppSeenInfo. +func (a AppSeenInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", a.Category) + populate(objectMap, "risk", a.Risk) + populate(objectMap, "standardPorts", a.StandardPorts) + populate(objectMap, "subCategory", a.SubCategory) + populate(objectMap, "tag", a.Tag) + populate(objectMap, "technology", a.Technology) + populate(objectMap, "title", a.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppSeenInfo. +func (a *AppSeenInfo) 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 "category": + err = unpopulate(val, "Category", &a.Category) + delete(rawMsg, key) + case "risk": + err = unpopulate(val, "Risk", &a.Risk) + delete(rawMsg, key) + case "standardPorts": + err = unpopulate(val, "StandardPorts", &a.StandardPorts) + delete(rawMsg, key) + case "subCategory": + err = unpopulate(val, "SubCategory", &a.SubCategory) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &a.Tag) + delete(rawMsg, key) + case "technology": + err = unpopulate(val, "Technology", &a.Technology) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &a.Title) + 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 ApplicationInsights. +func (a ApplicationInsights) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "key", a.Key) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationInsights. +func (a *ApplicationInsights) 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 "key": + err = unpopulate(val, "Key", &a.Key) + 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 AzureResourceManagerManagedIdentityProperties. +func (a AzureResourceManagerManagedIdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", a.PrincipalID) + populate(objectMap, "tenantId", a.TenantID) + populate(objectMap, "type", a.Type) + populate(objectMap, "userAssignedIdentities", a.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceManagerManagedIdentityProperties. +func (a *AzureResourceManagerManagedIdentityProperties) 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 "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &a.UserAssignedIdentities) + 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 AzureResourceManagerUserAssignedIdentity. +func (a AzureResourceManagerUserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", a.ClientID) + populate(objectMap, "principalId", a.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceManagerUserAssignedIdentity. +func (a *AzureResourceManagerUserAssignedIdentity) 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 "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &a.PrincipalID) + 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 Category. +func (c Category) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "feeds", c.Feeds) + populate(objectMap, "urlCustom", c.URLCustom) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Category. +func (c *Category) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "feeds": + err = unpopulate(val, "Feeds", &c.Feeds) + delete(rawMsg, key) + case "urlCustom": + err = unpopulate(val, "URLCustom", &c.URLCustom) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateObject. +func (c CertificateObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "auditComment", c.AuditComment) + populate(objectMap, "certificateSelfSigned", c.CertificateSelfSigned) + populate(objectMap, "certificateSignerResourceId", c.CertificateSignerResourceID) + populate(objectMap, "description", c.Description) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "provisioningState", c.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateObject. +func (c *CertificateObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auditComment": + err = unpopulate(val, "AuditComment", &c.AuditComment) + delete(rawMsg, key) + case "certificateSelfSigned": + err = unpopulate(val, "CertificateSelfSigned", &c.CertificateSelfSigned) + delete(rawMsg, key) + case "certificateSignerResourceId": + err = unpopulate(val, "CertificateSignerResourceID", &c.CertificateSignerResourceID) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateObjectGlobalRulestackResource. +func (c CertificateObjectGlobalRulestackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateObjectGlobalRulestackResource. +func (c *CertificateObjectGlobalRulestackResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateObjectGlobalRulestackResourceListResult. +func (c CertificateObjectGlobalRulestackResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateObjectGlobalRulestackResourceListResult. +func (c *CertificateObjectGlobalRulestackResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateObjectLocalRulestackResource. +func (c CertificateObjectLocalRulestackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateObjectLocalRulestackResource. +func (c *CertificateObjectLocalRulestackResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CertificateObjectLocalRulestackResourceListResult. +func (c CertificateObjectLocalRulestackResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateObjectLocalRulestackResourceListResult. +func (c *CertificateObjectLocalRulestackResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Changelog. +func (c Changelog) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "changes", c.Changes) + populateTimeRFC3339(objectMap, "lastCommitted", c.LastCommitted) + populateTimeRFC3339(objectMap, "lastModified", c.LastModified) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Changelog. +func (c *Changelog) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "changes": + err = unpopulate(val, "Changes", &c.Changes) + delete(rawMsg, key) + case "lastCommitted": + err = unpopulateTimeRFC3339(val, "LastCommitted", &c.LastCommitted) + delete(rawMsg, key) + case "lastModified": + err = unpopulateTimeRFC3339(val, "LastModified", &c.LastModified) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CountriesResponse. +func (c CountriesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CountriesResponse. +func (c *CountriesResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Country. +func (c Country) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", c.Code) + populate(objectMap, "description", c.Description) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Country. +func (c *Country) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &c.Code) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSSettings. +func (d DNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsServers", d.DNSServers) + populate(objectMap, "enableDnsProxy", d.EnableDNSProxy) + populate(objectMap, "enabledDnsType", d.EnabledDNSType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSSettings. +func (d *DNSSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dnsServers": + err = unpopulate(val, "DNSServers", &d.DNSServers) + delete(rawMsg, key) + case "enableDnsProxy": + err = unpopulate(val, "EnableDNSProxy", &d.EnableDNSProxy) + delete(rawMsg, key) + case "enabledDnsType": + err = unpopulate(val, "EnabledDNSType", &d.EnabledDNSType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DestinationAddr. +func (d DestinationAddr) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cidrs", d.Cidrs) + populate(objectMap, "countries", d.Countries) + populate(objectMap, "feeds", d.Feeds) + populate(objectMap, "fqdnLists", d.FqdnLists) + populate(objectMap, "prefixLists", d.PrefixLists) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DestinationAddr. +func (d *DestinationAddr) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cidrs": + err = unpopulate(val, "Cidrs", &d.Cidrs) + delete(rawMsg, key) + case "countries": + err = unpopulate(val, "Countries", &d.Countries) + delete(rawMsg, key) + case "feeds": + err = unpopulate(val, "Feeds", &d.Feeds) + delete(rawMsg, key) + case "fqdnLists": + err = unpopulate(val, "FqdnLists", &d.FqdnLists) + delete(rawMsg, key) + case "prefixLists": + err = unpopulate(val, "PrefixLists", &d.PrefixLists) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointConfiguration. +func (e EndpointConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "address", e.Address) + populate(objectMap, "port", e.Port) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointConfiguration. +func (e *EndpointConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "address": + err = unpopulate(val, "Address", &e.Address) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &e.Port) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHub. +func (e EventHub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "nameSpace", e.NameSpace) + populate(objectMap, "policyName", e.PolicyName) + populate(objectMap, "subscriptionId", e.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHub. +func (e *EventHub) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "nameSpace": + err = unpopulate(val, "NameSpace", &e.NameSpace) + delete(rawMsg, key) + case "policyName": + err = unpopulate(val, "PolicyName", &e.PolicyName) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallDeploymentProperties. +func (f FirewallDeploymentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "associatedRulestack", f.AssociatedRulestack) + populate(objectMap, "dnsSettings", f.DNSSettings) + populate(objectMap, "frontEndSettings", f.FrontEndSettings) + populate(objectMap, "isPanoramaManaged", f.IsPanoramaManaged) + populate(objectMap, "marketplaceDetails", f.MarketplaceDetails) + populate(objectMap, "networkProfile", f.NetworkProfile) + populate(objectMap, "panEtag", f.PanEtag) + populate(objectMap, "panoramaConfig", f.PanoramaConfig) + populate(objectMap, "planData", f.PlanData) + populate(objectMap, "provisioningState", f.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallDeploymentProperties. +func (f *FirewallDeploymentProperties) 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 "associatedRulestack": + err = unpopulate(val, "AssociatedRulestack", &f.AssociatedRulestack) + delete(rawMsg, key) + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &f.DNSSettings) + delete(rawMsg, key) + case "frontEndSettings": + err = unpopulate(val, "FrontEndSettings", &f.FrontEndSettings) + delete(rawMsg, key) + case "isPanoramaManaged": + err = unpopulate(val, "IsPanoramaManaged", &f.IsPanoramaManaged) + delete(rawMsg, key) + case "marketplaceDetails": + err = unpopulate(val, "MarketplaceDetails", &f.MarketplaceDetails) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &f.NetworkProfile) + delete(rawMsg, key) + case "panEtag": + err = unpopulate(val, "PanEtag", &f.PanEtag) + delete(rawMsg, key) + case "panoramaConfig": + err = unpopulate(val, "PanoramaConfig", &f.PanoramaConfig) + delete(rawMsg, key) + case "planData": + err = unpopulate(val, "PlanData", &f.PlanData) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + 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 FirewallResource. +func (f FirewallResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "identity", f.Identity) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallResource. +func (f *FirewallResource) 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 "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &f.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 FirewallResourceListResult. +func (f FirewallResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallResourceListResult. +func (f *FirewallResourceListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + 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 FirewallResourceUpdate. +func (f FirewallResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", f.Identity) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "tags", f.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallResourceUpdate. +func (f *FirewallResourceUpdate) 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 "identity": + err = unpopulate(val, "Identity", &f.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + 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 FirewallResourceUpdateProperties. +func (f FirewallResourceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "associatedRulestack", f.AssociatedRulestack) + populate(objectMap, "dnsSettings", f.DNSSettings) + populate(objectMap, "frontEndSettings", f.FrontEndSettings) + populate(objectMap, "isPanoramaManaged", f.IsPanoramaManaged) + populate(objectMap, "marketplaceDetails", f.MarketplaceDetails) + populate(objectMap, "networkProfile", f.NetworkProfile) + populate(objectMap, "panEtag", f.PanEtag) + populate(objectMap, "panoramaConfig", f.PanoramaConfig) + populate(objectMap, "planData", f.PlanData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallResourceUpdateProperties. +func (f *FirewallResourceUpdateProperties) 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 "associatedRulestack": + err = unpopulate(val, "AssociatedRulestack", &f.AssociatedRulestack) + delete(rawMsg, key) + case "dnsSettings": + err = unpopulate(val, "DNSSettings", &f.DNSSettings) + delete(rawMsg, key) + case "frontEndSettings": + err = unpopulate(val, "FrontEndSettings", &f.FrontEndSettings) + delete(rawMsg, key) + case "isPanoramaManaged": + err = unpopulate(val, "IsPanoramaManaged", &f.IsPanoramaManaged) + delete(rawMsg, key) + case "marketplaceDetails": + err = unpopulate(val, "MarketplaceDetails", &f.MarketplaceDetails) + delete(rawMsg, key) + case "networkProfile": + err = unpopulate(val, "NetworkProfile", &f.NetworkProfile) + delete(rawMsg, key) + case "panEtag": + err = unpopulate(val, "PanEtag", &f.PanEtag) + delete(rawMsg, key) + case "panoramaConfig": + err = unpopulate(val, "PanoramaConfig", &f.PanoramaConfig) + delete(rawMsg, key) + case "planData": + err = unpopulate(val, "PlanData", &f.PlanData) + 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 FirewallStatusProperty. +func (f FirewallStatusProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "healthReason", f.HealthReason) + populate(objectMap, "healthStatus", f.HealthStatus) + populate(objectMap, "isPanoramaManaged", f.IsPanoramaManaged) + populate(objectMap, "panoramaStatus", f.PanoramaStatus) + populate(objectMap, "provisioningState", f.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallStatusProperty. +func (f *FirewallStatusProperty) 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 "healthReason": + err = unpopulate(val, "HealthReason", &f.HealthReason) + delete(rawMsg, key) + case "healthStatus": + err = unpopulate(val, "HealthStatus", &f.HealthStatus) + delete(rawMsg, key) + case "isPanoramaManaged": + err = unpopulate(val, "IsPanoramaManaged", &f.IsPanoramaManaged) + delete(rawMsg, key) + case "panoramaStatus": + err = unpopulate(val, "PanoramaStatus", &f.PanoramaStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + 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 FirewallStatusResource. +func (f FirewallStatusResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallStatusResource. +func (f *FirewallStatusResource) 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 "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 FirewallStatusResourceListResult. +func (f FirewallStatusResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallStatusResourceListResult. +func (f *FirewallStatusResourceListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + 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 FqdnListGlobalRulestackResource. +func (f FqdnListGlobalRulestackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FqdnListGlobalRulestackResource. +func (f *FqdnListGlobalRulestackResource) 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 "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 FqdnListGlobalRulestackResourceListResult. +func (f FqdnListGlobalRulestackResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FqdnListGlobalRulestackResourceListResult. +func (f *FqdnListGlobalRulestackResourceListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + 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 FqdnListLocalRulestackResource. +func (f FqdnListLocalRulestackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FqdnListLocalRulestackResource. +func (f *FqdnListLocalRulestackResource) 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 "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 FqdnListLocalRulestackResourceListResult. +func (f FqdnListLocalRulestackResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FqdnListLocalRulestackResourceListResult. +func (f *FqdnListLocalRulestackResourceListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + 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 FqdnObject. +func (f FqdnObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "auditComment", f.AuditComment) + populate(objectMap, "description", f.Description) + populate(objectMap, "etag", f.Etag) + populate(objectMap, "fqdnList", f.FqdnList) + populate(objectMap, "provisioningState", f.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FqdnObject. +func (f *FqdnObject) 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 "auditComment": + err = unpopulate(val, "AuditComment", &f.AuditComment) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &f.Description) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, "Etag", &f.Etag) + delete(rawMsg, key) + case "fqdnList": + err = unpopulate(val, "FqdnList", &f.FqdnList) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + 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 FrontendSetting. +func (f FrontendSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backendConfiguration", f.BackendConfiguration) + populate(objectMap, "frontendConfiguration", f.FrontendConfiguration) + populate(objectMap, "name", f.Name) + populate(objectMap, "protocol", f.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FrontendSetting. +func (f *FrontendSetting) 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 "backendConfiguration": + err = unpopulate(val, "BackendConfiguration", &f.BackendConfiguration) + delete(rawMsg, key) + case "frontendConfiguration": + err = unpopulate(val, "FrontendConfiguration", &f.FrontendConfiguration) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &f.Protocol) + 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 GlobalRulestackInfo. +func (g GlobalRulestackInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureId", g.AzureID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalRulestackInfo. +func (g *GlobalRulestackInfo) 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 "azureId": + err = unpopulate(val, "AzureID", &g.AzureID) + 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 GlobalRulestackResource. +func (g GlobalRulestackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", g.ID) + populate(objectMap, "identity", g.Identity) + populate(objectMap, "location", g.Location) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalRulestackResource. +func (g *GlobalRulestackResource) 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 "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &g.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + 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 GlobalRulestackResourceListResult. +func (g GlobalRulestackResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalRulestackResourceListResult. +func (g *GlobalRulestackResourceListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + 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 GlobalRulestackResourceUpdate. +func (g GlobalRulestackResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", g.Identity) + populate(objectMap, "location", g.Location) + populate(objectMap, "properties", g.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalRulestackResourceUpdate. +func (g *GlobalRulestackResourceUpdate) 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 "identity": + err = unpopulate(val, "Identity", &g.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &g.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + 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 GlobalRulestackResourceUpdateProperties. +func (g GlobalRulestackResourceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "associatedSubscriptions", g.AssociatedSubscriptions) + populate(objectMap, "defaultMode", g.DefaultMode) + populate(objectMap, "description", g.Description) + populate(objectMap, "minAppIdVersion", g.MinAppIDVersion) + populate(objectMap, "panEtag", g.PanEtag) + populate(objectMap, "panLocation", g.PanLocation) + populate(objectMap, "scope", g.Scope) + populate(objectMap, "securityServices", g.SecurityServices) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GlobalRulestackResourceUpdateProperties. +func (g *GlobalRulestackResourceUpdateProperties) 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 "associatedSubscriptions": + err = unpopulate(val, "AssociatedSubscriptions", &g.AssociatedSubscriptions) + delete(rawMsg, key) + case "defaultMode": + err = unpopulate(val, "DefaultMode", &g.DefaultMode) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &g.Description) + delete(rawMsg, key) + case "minAppIdVersion": + err = unpopulate(val, "MinAppIDVersion", &g.MinAppIDVersion) + delete(rawMsg, key) + case "panEtag": + err = unpopulate(val, "PanEtag", &g.PanEtag) + delete(rawMsg, key) + case "panLocation": + err = unpopulate(val, "PanLocation", &g.PanLocation) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &g.Scope) + delete(rawMsg, key) + case "securityServices": + err = unpopulate(val, "SecurityServices", &g.SecurityServices) + 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 IPAddress. +func (i IPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "address", i.Address) + populate(objectMap, "resourceId", i.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPAddress. +func (i *IPAddress) 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 "address": + err = unpopulate(val, "Address", &i.Address) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &i.ResourceID) + 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 IPAddressSpace. +func (i IPAddressSpace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addressSpace", i.AddressSpace) + populate(objectMap, "resourceId", i.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPAddressSpace. +func (i *IPAddressSpace) 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 "addressSpace": + err = unpopulate(val, "AddressSpace", &i.AddressSpace) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &i.ResourceID) + 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 ListAppIDResponse. +func (l ListAppIDResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListAppIDResponse. +func (l *ListAppIDResponse) 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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, 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 ListFirewallsResponse. +func (l ListFirewallsResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListFirewallsResponse. +func (l *ListFirewallsResponse) 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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, 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 LocalRulesResource. +func (l LocalRulesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalRulesResource. +func (l *LocalRulesResource) 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 "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + 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 LocalRulesResourceListResult. +func (l LocalRulesResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalRulesResourceListResult. +func (l *LocalRulesResourceListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, 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 LocalRulestackResource. +func (l LocalRulestackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", l.ID) + populate(objectMap, "identity", l.Identity) + populate(objectMap, "location", l.Location) + populate(objectMap, "name", l.Name) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "systemData", l.SystemData) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "type", l.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalRulestackResource. +func (l *LocalRulestackResource) 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 "id": + err = unpopulate(val, "ID", &l.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &l.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &l.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + 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 LocalRulestackResourceListResult. +func (l LocalRulestackResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalRulestackResourceListResult. +func (l *LocalRulestackResourceListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, 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 LocalRulestackResourceUpdate. +func (l LocalRulestackResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", l.Identity) + populate(objectMap, "properties", l.Properties) + populate(objectMap, "tags", l.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalRulestackResourceUpdate. +func (l *LocalRulestackResourceUpdate) 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 "identity": + err = unpopulate(val, "Identity", &l.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &l.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &l.Tags) + 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 LocalRulestackResourceUpdateProperties. +func (l LocalRulestackResourceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "associatedSubscriptions", l.AssociatedSubscriptions) + populate(objectMap, "defaultMode", l.DefaultMode) + populate(objectMap, "description", l.Description) + populate(objectMap, "minAppIdVersion", l.MinAppIDVersion) + populate(objectMap, "panEtag", l.PanEtag) + populate(objectMap, "panLocation", l.PanLocation) + populate(objectMap, "scope", l.Scope) + populate(objectMap, "securityServices", l.SecurityServices) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalRulestackResourceUpdateProperties. +func (l *LocalRulestackResourceUpdateProperties) 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 "associatedSubscriptions": + err = unpopulate(val, "AssociatedSubscriptions", &l.AssociatedSubscriptions) + delete(rawMsg, key) + case "defaultMode": + err = unpopulate(val, "DefaultMode", &l.DefaultMode) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &l.Description) + delete(rawMsg, key) + case "minAppIdVersion": + err = unpopulate(val, "MinAppIDVersion", &l.MinAppIDVersion) + delete(rawMsg, key) + case "panEtag": + err = unpopulate(val, "PanEtag", &l.PanEtag) + delete(rawMsg, key) + case "panLocation": + err = unpopulate(val, "PanLocation", &l.PanLocation) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &l.Scope) + delete(rawMsg, key) + case "securityServices": + err = unpopulate(val, "SecurityServices", &l.SecurityServices) + 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 LogDestination. +func (l LogDestination) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventHubConfigurations", l.EventHubConfigurations) + populate(objectMap, "monitorConfigurations", l.MonitorConfigurations) + populate(objectMap, "storageConfigurations", l.StorageConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogDestination. +func (l *LogDestination) 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 "eventHubConfigurations": + err = unpopulate(val, "EventHubConfigurations", &l.EventHubConfigurations) + delete(rawMsg, key) + case "monitorConfigurations": + err = unpopulate(val, "MonitorConfigurations", &l.MonitorConfigurations) + delete(rawMsg, key) + case "storageConfigurations": + err = unpopulate(val, "StorageConfigurations", &l.StorageConfigurations) + 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 LogSettings. +func (l LogSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationInsights", l.ApplicationInsights) + populate(objectMap, "commonDestination", l.CommonDestination) + populate(objectMap, "decryptLogDestination", l.DecryptLogDestination) + populate(objectMap, "logOption", l.LogOption) + populate(objectMap, "logType", l.LogType) + populate(objectMap, "threatLogDestination", l.ThreatLogDestination) + populate(objectMap, "trafficLogDestination", l.TrafficLogDestination) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogSettings. +func (l *LogSettings) 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 "applicationInsights": + err = unpopulate(val, "ApplicationInsights", &l.ApplicationInsights) + delete(rawMsg, key) + case "commonDestination": + err = unpopulate(val, "CommonDestination", &l.CommonDestination) + delete(rawMsg, key) + case "decryptLogDestination": + err = unpopulate(val, "DecryptLogDestination", &l.DecryptLogDestination) + delete(rawMsg, key) + case "logOption": + err = unpopulate(val, "LogOption", &l.LogOption) + delete(rawMsg, key) + case "logType": + err = unpopulate(val, "LogType", &l.LogType) + delete(rawMsg, key) + case "threatLogDestination": + err = unpopulate(val, "ThreatLogDestination", &l.ThreatLogDestination) + delete(rawMsg, key) + case "trafficLogDestination": + err = unpopulate(val, "TrafficLogDestination", &l.TrafficLogDestination) + 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 MarketplaceDetails. +func (m MarketplaceDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "marketplaceSubscriptionId", m.MarketplaceSubscriptionID) + populate(objectMap, "marketplaceSubscriptionStatus", m.MarketplaceSubscriptionStatus) + populate(objectMap, "offerId", m.OfferID) + populate(objectMap, "publisherId", m.PublisherID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketplaceDetails. +func (m *MarketplaceDetails) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "marketplaceSubscriptionId": + err = unpopulate(val, "MarketplaceSubscriptionID", &m.MarketplaceSubscriptionID) + delete(rawMsg, key) + case "marketplaceSubscriptionStatus": + err = unpopulate(val, "MarketplaceSubscriptionStatus", &m.MarketplaceSubscriptionStatus) + delete(rawMsg, key) + case "offerId": + err = unpopulate(val, "OfferID", &m.OfferID) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &m.PublisherID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorLog. +func (m MonitorLog) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "primaryKey", m.PrimaryKey) + populate(objectMap, "secondaryKey", m.SecondaryKey) + populate(objectMap, "subscriptionId", m.SubscriptionID) + populate(objectMap, "workspace", m.Workspace) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorLog. +func (m *MonitorLog) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "primaryKey": + err = unpopulate(val, "PrimaryKey", &m.PrimaryKey) + delete(rawMsg, key) + case "secondaryKey": + err = unpopulate(val, "SecondaryKey", &m.SecondaryKey) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &m.SubscriptionID) + delete(rawMsg, key) + case "workspace": + err = unpopulate(val, "Workspace", &m.Workspace) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NameDescriptionObject. +func (n NameDescriptionObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", n.Description) + populate(objectMap, "name", n.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NameDescriptionObject. +func (n *NameDescriptionObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &n.Description) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkProfile. +func (n NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "egressNatIp", n.EgressNatIP) + populate(objectMap, "enableEgressNat", n.EnableEgressNat) + populate(objectMap, "networkType", n.NetworkType) + populate(objectMap, "publicIps", n.PublicIPs) + populate(objectMap, "vnetConfiguration", n.VnetConfiguration) + populate(objectMap, "vwanConfiguration", n.VwanConfiguration) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkProfile. +func (n *NetworkProfile) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "egressNatIp": + err = unpopulate(val, "EgressNatIP", &n.EgressNatIP) + delete(rawMsg, key) + case "enableEgressNat": + err = unpopulate(val, "EnableEgressNat", &n.EnableEgressNat) + delete(rawMsg, key) + case "networkType": + err = unpopulate(val, "NetworkType", &n.NetworkType) + delete(rawMsg, key) + case "publicIps": + err = unpopulate(val, "PublicIPs", &n.PublicIPs) + delete(rawMsg, key) + case "vnetConfiguration": + err = unpopulate(val, "VnetConfiguration", &n.VnetConfiguration) + delete(rawMsg, key) + case "vwanConfiguration": + err = unpopulate(val, "VwanConfiguration", &n.VwanConfiguration) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]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 PanoramaConfig. +func (p PanoramaConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cgName", p.CgName) + populate(objectMap, "configString", p.ConfigString) + populate(objectMap, "dgName", p.DgName) + populate(objectMap, "hostName", p.HostName) + populate(objectMap, "panoramaServer", p.PanoramaServer) + populate(objectMap, "panoramaServer2", p.PanoramaServer2) + populate(objectMap, "tplName", p.TplName) + populate(objectMap, "vmAuthKey", p.VMAuthKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PanoramaConfig. +func (p *PanoramaConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cgName": + err = unpopulate(val, "CgName", &p.CgName) + delete(rawMsg, key) + case "configString": + err = unpopulate(val, "ConfigString", &p.ConfigString) + delete(rawMsg, key) + case "dgName": + err = unpopulate(val, "DgName", &p.DgName) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &p.HostName) + delete(rawMsg, key) + case "panoramaServer": + err = unpopulate(val, "PanoramaServer", &p.PanoramaServer) + delete(rawMsg, key) + case "panoramaServer2": + err = unpopulate(val, "PanoramaServer2", &p.PanoramaServer2) + delete(rawMsg, key) + case "tplName": + err = unpopulate(val, "TplName", &p.TplName) + delete(rawMsg, key) + case "vmAuthKey": + err = unpopulate(val, "VMAuthKey", &p.VMAuthKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PanoramaStatus. +func (p PanoramaStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "panoramaServer2Status", p.PanoramaServer2Status) + populate(objectMap, "panoramaServerStatus", p.PanoramaServerStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PanoramaStatus. +func (p *PanoramaStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "panoramaServer2Status": + err = unpopulate(val, "PanoramaServer2Status", &p.PanoramaServer2Status) + delete(rawMsg, key) + case "panoramaServerStatus": + err = unpopulate(val, "PanoramaServerStatus", &p.PanoramaServerStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PlanData. +func (p PlanData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "billingCycle", p.BillingCycle) + populateTimeRFC3339(objectMap, "effectiveDate", p.EffectiveDate) + populate(objectMap, "planId", p.PlanID) + populate(objectMap, "usageType", p.UsageType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlanData. +func (p *PlanData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "billingCycle": + err = unpopulate(val, "BillingCycle", &p.BillingCycle) + delete(rawMsg, key) + case "effectiveDate": + err = unpopulateTimeRFC3339(val, "EffectiveDate", &p.EffectiveDate) + delete(rawMsg, key) + case "planId": + err = unpopulate(val, "PlanID", &p.PlanID) + delete(rawMsg, key) + case "usageType": + err = unpopulate(val, "UsageType", &p.UsageType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PostRulesResource. +func (p PostRulesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PostRulesResource. +func (p *PostRulesResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PostRulesResourceListResult. +func (p PostRulesResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PostRulesResourceListResult. +func (p *PostRulesResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PreRulesResource. +func (p PreRulesResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PreRulesResource. +func (p *PreRulesResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PreRulesResourceListResult. +func (p PreRulesResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PreRulesResourceListResult. +func (p *PreRulesResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PredefinedURLCategoriesResponse. +func (p PredefinedURLCategoriesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PredefinedURLCategoriesResponse. +func (p *PredefinedURLCategoriesResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PredefinedURLCategory. +func (p PredefinedURLCategory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", p.Action) + populate(objectMap, "name", p.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PredefinedURLCategory. +func (p *PredefinedURLCategory) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &p.Action) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrefixListGlobalRulestackResource. +func (p PrefixListGlobalRulestackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrefixListGlobalRulestackResource. +func (p *PrefixListGlobalRulestackResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrefixListGlobalRulestackResourceListResult. +func (p PrefixListGlobalRulestackResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrefixListGlobalRulestackResourceListResult. +func (p *PrefixListGlobalRulestackResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrefixListResource. +func (p PrefixListResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrefixListResource. +func (p *PrefixListResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrefixListResourceListResult. +func (p PrefixListResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrefixListResourceListResult. +func (p *PrefixListResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrefixObject. +func (p PrefixObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "auditComment", p.AuditComment) + populate(objectMap, "description", p.Description) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "prefixList", p.PrefixList) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrefixObject. +func (p *PrefixObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "auditComment": + err = unpopulate(val, "AuditComment", &p.AuditComment) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "prefixList": + err = unpopulate(val, "PrefixList", &p.PrefixList) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleCounter. +func (r RuleCounter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appSeen", r.AppSeen) + populate(objectMap, "firewallName", r.FirewallName) + populate(objectMap, "hitCount", r.HitCount) + populateTimeRFC3339(objectMap, "lastUpdatedTimestamp", r.LastUpdatedTimestamp) + populate(objectMap, "priority", r.Priority) + populateTimeRFC3339(objectMap, "requestTimestamp", r.RequestTimestamp) + populate(objectMap, "ruleListName", r.RuleListName) + populate(objectMap, "ruleName", r.RuleName) + populate(objectMap, "ruleStackName", r.RuleStackName) + populateTimeRFC3339(objectMap, "timestamp", r.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleCounter. +func (r *RuleCounter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appSeen": + err = unpopulate(val, "AppSeen", &r.AppSeen) + delete(rawMsg, key) + case "firewallName": + err = unpopulate(val, "FirewallName", &r.FirewallName) + delete(rawMsg, key) + case "hitCount": + err = unpopulate(val, "HitCount", &r.HitCount) + delete(rawMsg, key) + case "lastUpdatedTimestamp": + err = unpopulateTimeRFC3339(val, "LastUpdatedTimestamp", &r.LastUpdatedTimestamp) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &r.Priority) + delete(rawMsg, key) + case "requestTimestamp": + err = unpopulateTimeRFC3339(val, "RequestTimestamp", &r.RequestTimestamp) + delete(rawMsg, key) + case "ruleListName": + err = unpopulate(val, "RuleListName", &r.RuleListName) + delete(rawMsg, key) + case "ruleName": + err = unpopulate(val, "RuleName", &r.RuleName) + delete(rawMsg, key) + case "ruleStackName": + err = unpopulate(val, "RuleStackName", &r.RuleStackName) + delete(rawMsg, key) + case "timestamp": + err = unpopulateTimeRFC3339(val, "Timestamp", &r.Timestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleCounterReset. +func (r RuleCounterReset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "firewallName", r.FirewallName) + populate(objectMap, "priority", r.Priority) + populate(objectMap, "ruleListName", r.RuleListName) + populate(objectMap, "ruleName", r.RuleName) + populate(objectMap, "ruleStackName", r.RuleStackName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleCounterReset. +func (r *RuleCounterReset) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "firewallName": + err = unpopulate(val, "FirewallName", &r.FirewallName) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &r.Priority) + delete(rawMsg, key) + case "ruleListName": + err = unpopulate(val, "RuleListName", &r.RuleListName) + delete(rawMsg, key) + case "ruleName": + err = unpopulate(val, "RuleName", &r.RuleName) + delete(rawMsg, key) + case "ruleStackName": + err = unpopulate(val, "RuleStackName", &r.RuleStackName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RuleEntry. +func (r RuleEntry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", r.ActionType) + populate(objectMap, "applications", r.Applications) + populate(objectMap, "auditComment", r.AuditComment) + populate(objectMap, "category", r.Category) + populate(objectMap, "decryptionRuleType", r.DecryptionRuleType) + populate(objectMap, "description", r.Description) + populate(objectMap, "destination", r.Destination) + populate(objectMap, "enableLogging", r.EnableLogging) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "inboundInspectionCertificate", r.InboundInspectionCertificate) + populate(objectMap, "negateDestination", r.NegateDestination) + populate(objectMap, "negateSource", r.NegateSource) + populate(objectMap, "priority", r.Priority) + populate(objectMap, "protocol", r.Protocol) + populate(objectMap, "protocolPortList", r.ProtocolPortList) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "ruleName", r.RuleName) + populate(objectMap, "ruleState", r.RuleState) + populate(objectMap, "source", r.Source) + populate(objectMap, "tags", r.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleEntry. +func (r *RuleEntry) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &r.ActionType) + delete(rawMsg, key) + case "applications": + err = unpopulate(val, "Applications", &r.Applications) + delete(rawMsg, key) + case "auditComment": + err = unpopulate(val, "AuditComment", &r.AuditComment) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &r.Category) + delete(rawMsg, key) + case "decryptionRuleType": + err = unpopulate(val, "DecryptionRuleType", &r.DecryptionRuleType) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "destination": + err = unpopulate(val, "Destination", &r.Destination) + delete(rawMsg, key) + case "enableLogging": + err = unpopulate(val, "EnableLogging", &r.EnableLogging) + delete(rawMsg, key) + case "etag": + err = unpopulate(val, "Etag", &r.Etag) + delete(rawMsg, key) + case "inboundInspectionCertificate": + err = unpopulate(val, "InboundInspectionCertificate", &r.InboundInspectionCertificate) + delete(rawMsg, key) + case "negateDestination": + err = unpopulate(val, "NegateDestination", &r.NegateDestination) + delete(rawMsg, key) + case "negateSource": + err = unpopulate(val, "NegateSource", &r.NegateSource) + delete(rawMsg, key) + case "priority": + err = unpopulate(val, "Priority", &r.Priority) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &r.Protocol) + delete(rawMsg, key) + case "protocolPortList": + err = unpopulate(val, "ProtocolPortList", &r.ProtocolPortList) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "ruleName": + err = unpopulate(val, "RuleName", &r.RuleName) + delete(rawMsg, key) + case "ruleState": + err = unpopulate(val, "RuleState", &r.RuleState) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &r.Source) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RulestackDetails. +func (r RulestackDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "location", r.Location) + populate(objectMap, "resourceId", r.ResourceID) + populate(objectMap, "rulestackId", r.RulestackID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulestackDetails. +func (r *RulestackDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &r.Location) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &r.ResourceID) + delete(rawMsg, key) + case "rulestackId": + err = unpopulate(val, "RulestackID", &r.RulestackID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RulestackProperties. +func (r RulestackProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "associatedSubscriptions", r.AssociatedSubscriptions) + populate(objectMap, "defaultMode", r.DefaultMode) + populate(objectMap, "description", r.Description) + populate(objectMap, "minAppIdVersion", r.MinAppIDVersion) + populate(objectMap, "panEtag", r.PanEtag) + populate(objectMap, "panLocation", r.PanLocation) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "scope", r.Scope) + populate(objectMap, "securityServices", r.SecurityServices) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulestackProperties. +func (r *RulestackProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "associatedSubscriptions": + err = unpopulate(val, "AssociatedSubscriptions", &r.AssociatedSubscriptions) + delete(rawMsg, key) + case "defaultMode": + err = unpopulate(val, "DefaultMode", &r.DefaultMode) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "minAppIdVersion": + err = unpopulate(val, "MinAppIDVersion", &r.MinAppIDVersion) + delete(rawMsg, key) + case "panEtag": + err = unpopulate(val, "PanEtag", &r.PanEtag) + delete(rawMsg, key) + case "panLocation": + err = unpopulate(val, "PanLocation", &r.PanLocation) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &r.Scope) + delete(rawMsg, key) + case "securityServices": + err = unpopulate(val, "SecurityServices", &r.SecurityServices) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityServices. +func (s SecurityServices) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "antiSpywareProfile", s.AntiSpywareProfile) + populate(objectMap, "antiVirusProfile", s.AntiVirusProfile) + populate(objectMap, "dnsSubscription", s.DNSSubscription) + populate(objectMap, "fileBlockingProfile", s.FileBlockingProfile) + populate(objectMap, "outboundTrustCertificate", s.OutboundTrustCertificate) + populate(objectMap, "outboundUnTrustCertificate", s.OutboundUnTrustCertificate) + populate(objectMap, "urlFilteringProfile", s.URLFilteringProfile) + populate(objectMap, "vulnerabilityProfile", s.VulnerabilityProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityServices. +func (s *SecurityServices) 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 "antiSpywareProfile": + err = unpopulate(val, "AntiSpywareProfile", &s.AntiSpywareProfile) + delete(rawMsg, key) + case "antiVirusProfile": + err = unpopulate(val, "AntiVirusProfile", &s.AntiVirusProfile) + delete(rawMsg, key) + case "dnsSubscription": + err = unpopulate(val, "DNSSubscription", &s.DNSSubscription) + delete(rawMsg, key) + case "fileBlockingProfile": + err = unpopulate(val, "FileBlockingProfile", &s.FileBlockingProfile) + delete(rawMsg, key) + case "outboundTrustCertificate": + err = unpopulate(val, "OutboundTrustCertificate", &s.OutboundTrustCertificate) + delete(rawMsg, key) + case "outboundUnTrustCertificate": + err = unpopulate(val, "OutboundUnTrustCertificate", &s.OutboundUnTrustCertificate) + delete(rawMsg, key) + case "urlFilteringProfile": + err = unpopulate(val, "URLFilteringProfile", &s.URLFilteringProfile) + delete(rawMsg, key) + case "vulnerabilityProfile": + err = unpopulate(val, "VulnerabilityProfile", &s.VulnerabilityProfile) + 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 SecurityServicesResponse. +func (s SecurityServicesResponse) 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 SecurityServicesResponse. +func (s *SecurityServicesResponse) 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 SecurityServicesTypeList. +func (s SecurityServicesTypeList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "entry", s.Entry) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityServicesTypeList. +func (s *SecurityServicesTypeList) 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 "entry": + err = unpopulate(val, "Entry", &s.Entry) + 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 SourceAddr. +func (s SourceAddr) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cidrs", s.Cidrs) + populate(objectMap, "countries", s.Countries) + populate(objectMap, "feeds", s.Feeds) + populate(objectMap, "prefixLists", s.PrefixLists) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceAddr. +func (s *SourceAddr) 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 "cidrs": + err = unpopulate(val, "Cidrs", &s.Cidrs) + delete(rawMsg, key) + case "countries": + err = unpopulate(val, "Countries", &s.Countries) + delete(rawMsg, key) + case "feeds": + err = unpopulate(val, "Feeds", &s.Feeds) + delete(rawMsg, key) + case "prefixLists": + err = unpopulate(val, "PrefixLists", &s.PrefixLists) + 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 StorageAccount. +func (s StorageAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountName", s.AccountName) + populate(objectMap, "id", s.ID) + populate(objectMap, "subscriptionId", s.SubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageAccount. +func (s *StorageAccount) 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 "accountName": + err = unpopulate(val, "AccountName", &s.AccountName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &s.SubscriptionID) + 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 SupportInfo. +func (s SupportInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountId", s.AccountID) + populate(objectMap, "accountRegistered", s.AccountRegistered) + populate(objectMap, "freeTrial", s.FreeTrial) + populate(objectMap, "freeTrialCreditLeft", s.FreeTrialCreditLeft) + populate(objectMap, "freeTrialDaysLeft", s.FreeTrialDaysLeft) + populate(objectMap, "helpURL", s.HelpURL) + populate(objectMap, "productSku", s.ProductSKU) + populate(objectMap, "productSerial", s.ProductSerial) + populate(objectMap, "registerURL", s.RegisterURL) + populate(objectMap, "supportURL", s.SupportURL) + populate(objectMap, "userDomainSupported", s.UserDomainSupported) + populate(objectMap, "userRegistered", s.UserRegistered) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SupportInfo. +func (s *SupportInfo) 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 "accountId": + err = unpopulate(val, "AccountID", &s.AccountID) + delete(rawMsg, key) + case "accountRegistered": + err = unpopulate(val, "AccountRegistered", &s.AccountRegistered) + delete(rawMsg, key) + case "freeTrial": + err = unpopulate(val, "FreeTrial", &s.FreeTrial) + delete(rawMsg, key) + case "freeTrialCreditLeft": + err = unpopulate(val, "FreeTrialCreditLeft", &s.FreeTrialCreditLeft) + delete(rawMsg, key) + case "freeTrialDaysLeft": + err = unpopulate(val, "FreeTrialDaysLeft", &s.FreeTrialDaysLeft) + delete(rawMsg, key) + case "helpURL": + err = unpopulate(val, "HelpURL", &s.HelpURL) + delete(rawMsg, key) + case "productSku": + err = unpopulate(val, "ProductSKU", &s.ProductSKU) + delete(rawMsg, key) + case "productSerial": + err = unpopulate(val, "ProductSerial", &s.ProductSerial) + delete(rawMsg, key) + case "registerURL": + err = unpopulate(val, "RegisterURL", &s.RegisterURL) + delete(rawMsg, key) + case "supportURL": + err = unpopulate(val, "SupportURL", &s.SupportURL) + delete(rawMsg, key) + case "userDomainSupported": + err = unpopulate(val, "UserDomainSupported", &s.UserDomainSupported) + delete(rawMsg, key) + case "userRegistered": + err = unpopulate(val, "UserRegistered", &s.UserRegistered) + 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 TagInfo. +func (t TagInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", t.Key) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagInfo. +func (t *TagInfo) 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 "key": + err = unpopulate(val, "Key", &t.Key) + 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 VnetConfiguration. +func (v VnetConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipOfTrustSubnetForUdr", v.IPOfTrustSubnetForUdr) + populate(objectMap, "trustSubnet", v.TrustSubnet) + populate(objectMap, "unTrustSubnet", v.UnTrustSubnet) + populate(objectMap, "vnet", v.Vnet) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VnetConfiguration. +func (v *VnetConfiguration) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipOfTrustSubnetForUdr": + err = unpopulate(val, "IPOfTrustSubnetForUdr", &v.IPOfTrustSubnetForUdr) + delete(rawMsg, key) + case "trustSubnet": + err = unpopulate(val, "TrustSubnet", &v.TrustSubnet) + delete(rawMsg, key) + case "unTrustSubnet": + err = unpopulate(val, "UnTrustSubnet", &v.UnTrustSubnet) + delete(rawMsg, key) + case "vnet": + err = unpopulate(val, "Vnet", &v.Vnet) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VwanConfiguration. +func (v VwanConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ipOfTrustSubnetForUdr", v.IPOfTrustSubnetForUdr) + populate(objectMap, "networkVirtualApplianceId", v.NetworkVirtualApplianceID) + populate(objectMap, "trustSubnet", v.TrustSubnet) + populate(objectMap, "unTrustSubnet", v.UnTrustSubnet) + populate(objectMap, "vHub", v.VHub) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VwanConfiguration. +func (v *VwanConfiguration) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ipOfTrustSubnetForUdr": + err = unpopulate(val, "IPOfTrustSubnetForUdr", &v.IPOfTrustSubnetForUdr) + delete(rawMsg, key) + case "networkVirtualApplianceId": + err = unpopulate(val, "NetworkVirtualApplianceID", &v.NetworkVirtualApplianceID) + delete(rawMsg, key) + case "trustSubnet": + err = unpopulate(val, "TrustSubnet", &v.TrustSubnet) + delete(rawMsg, key) + case "unTrustSubnet": + err = unpopulate(val, "UnTrustSubnet", &v.UnTrustSubnet) + delete(rawMsg, key) + case "vHub": + err = unpopulate(val, "VHub", &v.VHub) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, 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/paloaltonetworksngfw/armpanngfw/operations_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/operations_client.go new file mode 100644 index 000000000000..78a6eb8a14b1 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/operations_client.go @@ -0,0 +1,94 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +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 2022-08-29-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/PaloAltoNetworks.Cloudngfw/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", "2022-08-29-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/paloaltonetworksngfw/armpanngfw/operations_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/operations_client_example_test.go new file mode 100644 index 000000000000..e2b9dff810bb --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/operations_client_example_test.go @@ -0,0 +1,85 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Operations_List_MaximumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.OperationListResult = armpanngfw.OperationListResult{ + // Value: []*armpanngfw.Operation{ + // { + // Name: to.Ptr("aaa"), + // ActionType: to.Ptr(armpanngfw.ActionTypeInternal), + // Display: &armpanngfw.OperationDisplay{ + // Description: to.Ptr("aaaaaaaa"), + // Operation: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // Provider: to.Ptr("aaaaaaaaaaa"), + // Resource: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // IsDataAction: to.Ptr(true), + // Origin: to.Ptr(armpanngfw.OriginUser), + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/Operations_List_MinimumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.OperationListResult = armpanngfw.OperationListResult{ + // } + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/postrules_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/postrules_client.go new file mode 100644 index 000000000000..4d5021eef05b --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/postrules_client.go @@ -0,0 +1,441 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PostRulesClient contains the methods for the PostRules group. +// Don't use this type directly, use NewPostRulesClient() instead. +type PostRulesClient struct { + internal *arm.Client +} + +// NewPostRulesClient creates a new instance of PostRulesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPostRulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PostRulesClient, error) { + cl, err := arm.NewClient(moduleName+".PostRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PostRulesClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a PostRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Post Rule priority +// - resource - Resource create parameters. +// - options - PostRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the PostRulesClient.BeginCreateOrUpdate +// method. +func (client *PostRulesClient) BeginCreateOrUpdate(ctx context.Context, globalRulestackName string, priority string, resource PostRulesResource, options *PostRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[PostRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, globalRulestackName, priority, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PostRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PostRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a PostRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *PostRulesClient) createOrUpdate(ctx context.Context, globalRulestackName string, priority string, resource PostRulesResource, options *PostRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, globalRulestackName, priority, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PostRulesClient) createOrUpdateCreateRequest(ctx context.Context, globalRulestackName string, priority string, resource PostRulesResource, options *PostRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a PostRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Post Rule priority +// - options - PostRulesClientBeginDeleteOptions contains the optional parameters for the PostRulesClient.BeginDelete method. +func (client *PostRulesClient) BeginDelete(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientBeginDeleteOptions) (*runtime.Poller[PostRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, globalRulestackName, priority, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PostRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PostRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a PostRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *PostRulesClient) deleteOperation(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, globalRulestackName, priority, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PostRulesClient) deleteCreateRequest(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a PostRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Post Rule priority +// - options - PostRulesClientGetOptions contains the optional parameters for the PostRulesClient.Get method. +func (client *PostRulesClient) Get(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientGetOptions) (PostRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, globalRulestackName, priority, options) + if err != nil { + return PostRulesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PostRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PostRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PostRulesClient) getCreateRequest(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PostRulesClient) getHandleResponse(resp *http.Response) (PostRulesClientGetResponse, error) { + result := PostRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PostRulesResource); err != nil { + return PostRulesClientGetResponse{}, err + } + return result, nil +} + +// GetCounters - Get counters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Post Rule priority +// - options - PostRulesClientGetCountersOptions contains the optional parameters for the PostRulesClient.GetCounters method. +func (client *PostRulesClient) GetCounters(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientGetCountersOptions) (PostRulesClientGetCountersResponse, error) { + req, err := client.getCountersCreateRequest(ctx, globalRulestackName, priority, options) + if err != nil { + return PostRulesClientGetCountersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PostRulesClientGetCountersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PostRulesClientGetCountersResponse{}, runtime.NewResponseError(resp) + } + return client.getCountersHandleResponse(resp) +} + +// getCountersCreateRequest creates the GetCounters request. +func (client *PostRulesClient) getCountersCreateRequest(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientGetCountersOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/getCounters" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + if options != nil && options.FirewallName != nil { + reqQP.Set("firewallName", *options.FirewallName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCountersHandleResponse handles the GetCounters response. +func (client *PostRulesClient) getCountersHandleResponse(resp *http.Response) (PostRulesClientGetCountersResponse, error) { + result := PostRulesClientGetCountersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RuleCounter); err != nil { + return PostRulesClientGetCountersResponse{}, err + } + return result, nil +} + +// NewListPager - List PostRulesResource resources by Tenant +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - PostRulesClientListOptions contains the optional parameters for the PostRulesClient.NewListPager method. +func (client *PostRulesClient) NewListPager(globalRulestackName string, options *PostRulesClientListOptions) *runtime.Pager[PostRulesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PostRulesClientListResponse]{ + More: func(page PostRulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PostRulesClientListResponse) (PostRulesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, globalRulestackName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PostRulesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PostRulesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PostRulesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *PostRulesClient) listCreateRequest(ctx context.Context, globalRulestackName string, options *PostRulesClientListOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PostRulesClient) listHandleResponse(resp *http.Response) (PostRulesClientListResponse, error) { + result := PostRulesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PostRulesResourceListResult); err != nil { + return PostRulesClientListResponse{}, err + } + return result, nil +} + +// RefreshCounters - Refresh counters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Post Rule priority +// - options - PostRulesClientRefreshCountersOptions contains the optional parameters for the PostRulesClient.RefreshCounters +// method. +func (client *PostRulesClient) RefreshCounters(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientRefreshCountersOptions) (PostRulesClientRefreshCountersResponse, error) { + req, err := client.refreshCountersCreateRequest(ctx, globalRulestackName, priority, options) + if err != nil { + return PostRulesClientRefreshCountersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PostRulesClientRefreshCountersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return PostRulesClientRefreshCountersResponse{}, runtime.NewResponseError(resp) + } + return PostRulesClientRefreshCountersResponse{}, nil +} + +// refreshCountersCreateRequest creates the RefreshCounters request. +func (client *PostRulesClient) refreshCountersCreateRequest(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientRefreshCountersOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/refreshCounters" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + if options != nil && options.FirewallName != nil { + reqQP.Set("firewallName", *options.FirewallName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ResetCounters - Reset counters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Post Rule priority +// - options - PostRulesClientResetCountersOptions contains the optional parameters for the PostRulesClient.ResetCounters method. +func (client *PostRulesClient) ResetCounters(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientResetCountersOptions) (PostRulesClientResetCountersResponse, error) { + req, err := client.resetCountersCreateRequest(ctx, globalRulestackName, priority, options) + if err != nil { + return PostRulesClientResetCountersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PostRulesClientResetCountersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PostRulesClientResetCountersResponse{}, runtime.NewResponseError(resp) + } + return client.resetCountersHandleResponse(resp) +} + +// resetCountersCreateRequest creates the ResetCounters request. +func (client *PostRulesClient) resetCountersCreateRequest(ctx context.Context, globalRulestackName string, priority string, options *PostRulesClientResetCountersOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/postRules/{priority}/resetCounters" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + if options != nil && options.FirewallName != nil { + reqQP.Set("firewallName", *options.FirewallName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// resetCountersHandleResponse handles the ResetCounters response. +func (client *PostRulesClient) resetCountersHandleResponse(resp *http.Response) (PostRulesClientResetCountersResponse, error) { + result := PostRulesClientResetCountersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RuleCounterReset); err != nil { + return PostRulesClientResetCountersResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/postrules_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/postrules_client_example_test.go new file mode 100644 index 000000000000..70d6be251a30 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/postrules_client_example_test.go @@ -0,0 +1,629 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_List_MaximumSet_Gen.json +func ExamplePostRulesClient_NewListPager_postRulesListMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPostRulesClient().NewListPager("lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.PostRulesResourceListResult = armpanngfw.PostRulesResourceListResult{ + // Value: []*armpanngfw.PostRulesResource{ + // { + // Name: to.Ptr("aaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.RuleEntry{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + // Applications: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // AuditComment: to.Ptr("aaa"), + // Category: &armpanngfw.Category{ + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // URLCustom: []*string{ + // to.Ptr("aaaaa")}, + // }, + // DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + // Destination: &armpanngfw.DestinationAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaaaaaaaaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // FqdnLists: []*string{ + // to.Ptr("aaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // }, + // EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // InboundInspectionCertificate: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + // NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + // Priority: to.Ptr[int32](24), + // ProtocolPortList: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + // Source: &armpanngfw.SourceAddr{ + // Cidrs: []*string{ + // to.Ptr("aaa")}, + // Countries: []*string{ + // to.Ptr("aaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, + // }, + // Tags: []*armpanngfw.TagInfo{ + // { + // Key: to.Ptr("keyName"), + // Value: to.Ptr("value"), + // }}, + // Protocol: to.Ptr("aaaa"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_List_MinimumSet_Gen.json +func ExamplePostRulesClient_NewListPager_postRulesListMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPostRulesClient().NewListPager("lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.PostRulesResourceListResult = armpanngfw.PostRulesResourceListResult{ + // Value: []*armpanngfw.PostRulesResource{ + // { + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/lrs1/postrules/1"), + // Properties: &armpanngfw.RuleEntry{ + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_Get_MaximumSet_Gen.json +func ExamplePostRulesClient_Get_postRulesGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPostRulesClient().Get(ctx, "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PostRulesResource = armpanngfw.PostRulesResource{ + // Name: to.Ptr("aaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.RuleEntry{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + // Applications: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // AuditComment: to.Ptr("aaa"), + // Category: &armpanngfw.Category{ + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // URLCustom: []*string{ + // to.Ptr("aaaaa")}, + // }, + // DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + // Destination: &armpanngfw.DestinationAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaaaaaaaaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // FqdnLists: []*string{ + // to.Ptr("aaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // }, + // EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // InboundInspectionCertificate: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + // NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + // Priority: to.Ptr[int32](24), + // ProtocolPortList: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + // Source: &armpanngfw.SourceAddr{ + // Cidrs: []*string{ + // to.Ptr("aaa")}, + // Countries: []*string{ + // to.Ptr("aaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, + // }, + // Tags: []*armpanngfw.TagInfo{ + // { + // Key: to.Ptr("keyName"), + // Value: to.Ptr("value"), + // }}, + // Protocol: to.Ptr("aaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_Get_MinimumSet_Gen.json +func ExamplePostRulesClient_Get_postRulesGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPostRulesClient().Get(ctx, "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PostRulesResource = armpanngfw.PostRulesResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/lrs1/postrules/1"), + // Properties: &armpanngfw.RuleEntry{ + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_CreateOrUpdate_MaximumSet_Gen.json +func ExamplePostRulesClient_BeginCreateOrUpdate_postRulesCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPostRulesClient().BeginCreateOrUpdate(ctx, "lrs1", "1", armpanngfw.PostRulesResource{ + Properties: &armpanngfw.RuleEntry{ + Description: to.Ptr("description of post rule"), + ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + Applications: []*string{ + to.Ptr("app1")}, + AuditComment: to.Ptr("example comment"), + Category: &armpanngfw.Category{ + Feeds: []*string{ + to.Ptr("feed")}, + URLCustom: []*string{ + to.Ptr("https://microsoft.com")}, + }, + DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + Destination: &armpanngfw.DestinationAddr{ + Cidrs: []*string{ + to.Ptr("1.0.0.1/10")}, + Countries: []*string{ + to.Ptr("India")}, + Feeds: []*string{ + to.Ptr("feed")}, + FqdnLists: []*string{ + to.Ptr("FQDN1")}, + PrefixLists: []*string{ + to.Ptr("PL1")}, + }, + EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + Etag: to.Ptr("c18e6eef-ba3e-49ee-8a85-2b36c863a9d0"), + InboundInspectionCertificate: to.Ptr("cert1"), + NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + ProtocolPortList: []*string{ + to.Ptr("80")}, + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + RuleName: to.Ptr("postRule1"), + RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + Source: &armpanngfw.SourceAddr{ + Cidrs: []*string{ + to.Ptr("1.0.0.1/10")}, + Countries: []*string{ + to.Ptr("India")}, + Feeds: []*string{ + to.Ptr("feed")}, + PrefixLists: []*string{ + to.Ptr("PL1")}, + }, + Tags: []*armpanngfw.TagInfo{ + { + Key: to.Ptr("keyName"), + Value: to.Ptr("value"), + }}, + Protocol: to.Ptr("HTTP"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PostRulesResource = armpanngfw.PostRulesResource{ + // Name: to.Ptr("aaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.RuleEntry{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + // Applications: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // AuditComment: to.Ptr("aaa"), + // Category: &armpanngfw.Category{ + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // URLCustom: []*string{ + // to.Ptr("aaaaa")}, + // }, + // DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + // Destination: &armpanngfw.DestinationAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaaaaaaaaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // FqdnLists: []*string{ + // to.Ptr("aaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // }, + // EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // InboundInspectionCertificate: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + // NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + // Priority: to.Ptr[int32](24), + // ProtocolPortList: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + // Source: &armpanngfw.SourceAddr{ + // Cidrs: []*string{ + // to.Ptr("aaa")}, + // Countries: []*string{ + // to.Ptr("aaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, + // }, + // Tags: []*armpanngfw.TagInfo{ + // { + // Key: to.Ptr("keyName"), + // Value: to.Ptr("value"), + // }}, + // Protocol: to.Ptr("aaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_CreateOrUpdate_MinimumSet_Gen.json +func ExamplePostRulesClient_BeginCreateOrUpdate_postRulesCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPostRulesClient().BeginCreateOrUpdate(ctx, "lrs1", "1", armpanngfw.PostRulesResource{ + Properties: &armpanngfw.RuleEntry{ + RuleName: to.Ptr("postRule1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PostRulesResource = armpanngfw.PostRulesResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/lrs1/postrules/1"), + // Properties: &armpanngfw.RuleEntry{ + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_Delete_MaximumSet_Gen.json +func ExamplePostRulesClient_BeginDelete_postRulesDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPostRulesClient().BeginDelete(ctx, "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_Delete_MinimumSet_Gen.json +func ExamplePostRulesClient_BeginDelete_postRulesDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPostRulesClient().BeginDelete(ctx, "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_getCounters_MaximumSet_Gen.json +func ExamplePostRulesClient_GetCounters_postRulesGetCountersMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPostRulesClient().GetCounters(ctx, "lrs1", "1", &armpanngfw.PostRulesClientGetCountersOptions{FirewallName: to.Ptr("firewall1")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounter = armpanngfw.RuleCounter{ + // AppSeen: &armpanngfw.AppSeenData{ + // AppSeenList: []*armpanngfw.AppSeenInfo{ + // { + // Category: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // Risk: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // StandardPorts: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // SubCategory: to.Ptr("aaaaaaaaaaaaaaaaa"), + // Tag: to.Ptr("aaaaaaaaaa"), + // Technology: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // Title: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // }}, + // Count: to.Ptr[int32](13), + // }, + // FirewallName: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // HitCount: to.Ptr[int32](20), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // Priority: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // RequestTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // RuleListName: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // RuleName: to.Ptr("aaaa"), + // RuleStackName: to.Ptr("aaaaaaaaaaaaaaaaa"), + // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_getCounters_MinimumSet_Gen.json +func ExamplePostRulesClient_GetCounters_postRulesGetCountersMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPostRulesClient().GetCounters(ctx, "lrs1", "1", &armpanngfw.PostRulesClientGetCountersOptions{FirewallName: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounter = armpanngfw.RuleCounter{ + // Priority: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // RuleName: to.Ptr("aaaa"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_refreshCounters_MaximumSet_Gen.json +func ExamplePostRulesClient_RefreshCounters_postRulesRefreshCountersMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewPostRulesClient().RefreshCounters(ctx, "lrs1", "1", &armpanngfw.PostRulesClientRefreshCountersOptions{FirewallName: to.Ptr("firewall1")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_refreshCounters_MinimumSet_Gen.json +func ExamplePostRulesClient_RefreshCounters_postRulesRefreshCountersMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewPostRulesClient().RefreshCounters(ctx, "lrs1", "1", &armpanngfw.PostRulesClientRefreshCountersOptions{FirewallName: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_resetCounters_MaximumSet_Gen.json +func ExamplePostRulesClient_ResetCounters_postRulesResetCountersMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPostRulesClient().ResetCounters(ctx, "lrs1", "1", &armpanngfw.PostRulesClientResetCountersOptions{FirewallName: to.Ptr("firewall1")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounterReset = armpanngfw.RuleCounterReset{ + // FirewallName: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // Priority: to.Ptr("aaaaaaa"), + // RuleListName: to.Ptr("aaaaa"), + // RuleName: to.Ptr("aaaaa"), + // RuleStackName: to.Ptr("aa"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PostRules_resetCounters_MinimumSet_Gen.json +func ExamplePostRulesClient_ResetCounters_postRulesResetCountersMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPostRulesClient().ResetCounters(ctx, "lrs1", "1", &armpanngfw.PostRulesClientResetCountersOptions{FirewallName: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounterReset = armpanngfw.RuleCounterReset{ + // } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistglobalrulestack_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistglobalrulestack_client.go new file mode 100644 index 000000000000..12dc57df8b7e --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistglobalrulestack_client.go @@ -0,0 +1,284 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrefixListGlobalRulestackClient contains the methods for the PrefixListGlobalRulestack group. +// Don't use this type directly, use NewPrefixListGlobalRulestackClient() instead. +type PrefixListGlobalRulestackClient struct { + internal *arm.Client +} + +// NewPrefixListGlobalRulestackClient creates a new instance of PrefixListGlobalRulestackClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrefixListGlobalRulestackClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PrefixListGlobalRulestackClient, error) { + cl, err := arm.NewClient(moduleName+".PrefixListGlobalRulestackClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrefixListGlobalRulestackClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a PrefixListGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - name - Local Rule priority +// - resource - Resource create parameters. +// - options - PrefixListGlobalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the PrefixListGlobalRulestackClient.BeginCreateOrUpdate +// method. +func (client *PrefixListGlobalRulestackClient) BeginCreateOrUpdate(ctx context.Context, globalRulestackName string, name string, resource PrefixListGlobalRulestackResource, options *PrefixListGlobalRulestackClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrefixListGlobalRulestackClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, globalRulestackName, name, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrefixListGlobalRulestackClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PrefixListGlobalRulestackClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a PrefixListGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *PrefixListGlobalRulestackClient) createOrUpdate(ctx context.Context, globalRulestackName string, name string, resource PrefixListGlobalRulestackResource, options *PrefixListGlobalRulestackClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, globalRulestackName, name, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrefixListGlobalRulestackClient) createOrUpdateCreateRequest(ctx context.Context, globalRulestackName string, name string, resource PrefixListGlobalRulestackResource, options *PrefixListGlobalRulestackClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a PrefixListGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - name - Local Rule priority +// - options - PrefixListGlobalRulestackClientBeginDeleteOptions contains the optional parameters for the PrefixListGlobalRulestackClient.BeginDelete +// method. +func (client *PrefixListGlobalRulestackClient) BeginDelete(ctx context.Context, globalRulestackName string, name string, options *PrefixListGlobalRulestackClientBeginDeleteOptions) (*runtime.Poller[PrefixListGlobalRulestackClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, globalRulestackName, name, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrefixListGlobalRulestackClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PrefixListGlobalRulestackClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a PrefixListGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *PrefixListGlobalRulestackClient) deleteOperation(ctx context.Context, globalRulestackName string, name string, options *PrefixListGlobalRulestackClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, globalRulestackName, name, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrefixListGlobalRulestackClient) deleteCreateRequest(ctx context.Context, globalRulestackName string, name string, options *PrefixListGlobalRulestackClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a PrefixListGlobalRulestackResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - name - Local Rule priority +// - options - PrefixListGlobalRulestackClientGetOptions contains the optional parameters for the PrefixListGlobalRulestackClient.Get +// method. +func (client *PrefixListGlobalRulestackClient) Get(ctx context.Context, globalRulestackName string, name string, options *PrefixListGlobalRulestackClientGetOptions) (PrefixListGlobalRulestackClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, globalRulestackName, name, options) + if err != nil { + return PrefixListGlobalRulestackClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrefixListGlobalRulestackClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrefixListGlobalRulestackClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrefixListGlobalRulestackClient) getCreateRequest(ctx context.Context, globalRulestackName string, name string, options *PrefixListGlobalRulestackClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists/{name}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrefixListGlobalRulestackClient) getHandleResponse(resp *http.Response) (PrefixListGlobalRulestackClientGetResponse, error) { + result := PrefixListGlobalRulestackClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrefixListGlobalRulestackResource); err != nil { + return PrefixListGlobalRulestackClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List PrefixListGlobalRulestackResource resources by Tenant +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - PrefixListGlobalRulestackClientListOptions contains the optional parameters for the PrefixListGlobalRulestackClient.NewListPager +// method. +func (client *PrefixListGlobalRulestackClient) NewListPager(globalRulestackName string, options *PrefixListGlobalRulestackClientListOptions) *runtime.Pager[PrefixListGlobalRulestackClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrefixListGlobalRulestackClientListResponse]{ + More: func(page PrefixListGlobalRulestackClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrefixListGlobalRulestackClientListResponse) (PrefixListGlobalRulestackClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, globalRulestackName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrefixListGlobalRulestackClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrefixListGlobalRulestackClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrefixListGlobalRulestackClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *PrefixListGlobalRulestackClient) listCreateRequest(ctx context.Context, globalRulestackName string, options *PrefixListGlobalRulestackClientListOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/prefixlists" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrefixListGlobalRulestackClient) listHandleResponse(resp *http.Response) (PrefixListGlobalRulestackClientListResponse, error) { + result := PrefixListGlobalRulestackClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrefixListGlobalRulestackResourceListResult); err != nil { + return PrefixListGlobalRulestackClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistglobalrulestack_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistglobalrulestack_client_example_test.go new file mode 100644 index 000000000000..e5b66dd44d85 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistglobalrulestack_client_example_test.go @@ -0,0 +1,303 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListGlobalRulestack_List_MaximumSet_Gen.json +func ExamplePrefixListGlobalRulestackClient_NewListPager_prefixListGlobalRulestackListMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrefixListGlobalRulestackClient().NewListPager("praval", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.PrefixListGlobalRulestackResourceListResult = armpanngfw.PrefixListGlobalRulestackResourceListResult{ + // Value: []*armpanngfw.PrefixListGlobalRulestackResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.PrefixObject{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // AuditComment: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + // PrefixList: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListGlobalRulestack_List_MinimumSet_Gen.json +func ExamplePrefixListGlobalRulestackClient_NewListPager_prefixListGlobalRulestackListMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrefixListGlobalRulestackClient().NewListPager("praval", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.PrefixListGlobalRulestackResourceListResult = armpanngfw.PrefixListGlobalRulestackResourceListResult{ + // Value: []*armpanngfw.PrefixListGlobalRulestackResource{ + // { + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval/prefixlists/prefixlists1"), + // Properties: &armpanngfw.PrefixObject{ + // PrefixList: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListGlobalRulestack_Get_MaximumSet_Gen.json +func ExamplePrefixListGlobalRulestackClient_Get_prefixListGlobalRulestackGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrefixListGlobalRulestackClient().Get(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrefixListGlobalRulestackResource = armpanngfw.PrefixListGlobalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.PrefixObject{ + // Description: to.Ptr("string"), + // AuditComment: to.Ptr("comment"), + // Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // PrefixList: []*string{ + // to.Ptr("1.0.0.0/24")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListGlobalRulestack_Get_MinimumSet_Gen.json +func ExamplePrefixListGlobalRulestackClient_Get_prefixListGlobalRulestackGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrefixListGlobalRulestackClient().Get(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrefixListGlobalRulestackResource = armpanngfw.PrefixListGlobalRulestackResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval/prefixlists/armid1"), + // Properties: &armpanngfw.PrefixObject{ + // PrefixList: []*string{ + // to.Ptr("1.0.0.0/24")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListGlobalRulestack_CreateOrUpdate_MaximumSet_Gen.json +func ExamplePrefixListGlobalRulestackClient_BeginCreateOrUpdate_prefixListGlobalRulestackCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrefixListGlobalRulestackClient().BeginCreateOrUpdate(ctx, "praval", "armid1", armpanngfw.PrefixListGlobalRulestackResource{ + Properties: &armpanngfw.PrefixObject{ + Description: to.Ptr("string"), + AuditComment: to.Ptr("comment"), + Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + PrefixList: []*string{ + to.Ptr("1.0.0.0/24")}, + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrefixListGlobalRulestackResource = armpanngfw.PrefixListGlobalRulestackResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.PrefixObject{ + // Description: to.Ptr("string"), + // AuditComment: to.Ptr("comment"), + // Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // PrefixList: []*string{ + // to.Ptr("1.0.0.0/24")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListGlobalRulestack_CreateOrUpdate_MinimumSet_Gen.json +func ExamplePrefixListGlobalRulestackClient_BeginCreateOrUpdate_prefixListGlobalRulestackCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrefixListGlobalRulestackClient().BeginCreateOrUpdate(ctx, "praval", "armid1", armpanngfw.PrefixListGlobalRulestackResource{ + Properties: &armpanngfw.PrefixObject{ + PrefixList: []*string{ + to.Ptr("1.0.0.0/24")}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrefixListGlobalRulestackResource = armpanngfw.PrefixListGlobalRulestackResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/praval/prefixlists/armid1"), + // Properties: &armpanngfw.PrefixObject{ + // PrefixList: []*string{ + // to.Ptr("1.0.0.0/24")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListGlobalRulestack_Delete_MaximumSet_Gen.json +func ExamplePrefixListGlobalRulestackClient_BeginDelete_prefixListGlobalRulestackDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrefixListGlobalRulestackClient().BeginDelete(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListGlobalRulestack_Delete_MinimumSet_Gen.json +func ExamplePrefixListGlobalRulestackClient_BeginDelete_prefixListGlobalRulestackDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrefixListGlobalRulestackClient().BeginDelete(ctx, "praval", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistlocalrulestack_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistlocalrulestack_client.go new file mode 100644 index 000000000000..da9bd36daec7 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistlocalrulestack_client.go @@ -0,0 +1,323 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrefixListLocalRulestackClient contains the methods for the PrefixListLocalRulestack group. +// Don't use this type directly, use NewPrefixListLocalRulestackClient() instead. +type PrefixListLocalRulestackClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrefixListLocalRulestackClient creates a new instance of PrefixListLocalRulestackClient 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 NewPrefixListLocalRulestackClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrefixListLocalRulestackClient, error) { + cl, err := arm.NewClient(moduleName+".PrefixListLocalRulestackClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrefixListLocalRulestackClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a PrefixListResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - name - Local Rule priority +// - resource - Resource create parameters. +// - options - PrefixListLocalRulestackClientBeginCreateOrUpdateOptions contains the optional parameters for the PrefixListLocalRulestackClient.BeginCreateOrUpdate +// method. +func (client *PrefixListLocalRulestackClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, localRulestackName string, name string, resource PrefixListResource, options *PrefixListLocalRulestackClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrefixListLocalRulestackClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, localRulestackName, name, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrefixListLocalRulestackClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PrefixListLocalRulestackClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a PrefixListResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *PrefixListLocalRulestackClient) createOrUpdate(ctx context.Context, resourceGroupName string, localRulestackName string, name string, resource PrefixListResource, options *PrefixListLocalRulestackClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, localRulestackName, name, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrefixListLocalRulestackClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, name string, resource PrefixListResource, options *PrefixListLocalRulestackClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a PrefixListResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - name - Local Rule priority +// - options - PrefixListLocalRulestackClientBeginDeleteOptions contains the optional parameters for the PrefixListLocalRulestackClient.BeginDelete +// method. +func (client *PrefixListLocalRulestackClient) BeginDelete(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *PrefixListLocalRulestackClientBeginDeleteOptions) (*runtime.Poller[PrefixListLocalRulestackClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, localRulestackName, name, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrefixListLocalRulestackClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PrefixListLocalRulestackClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a PrefixListResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *PrefixListLocalRulestackClient) deleteOperation(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *PrefixListLocalRulestackClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, localRulestackName, name, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrefixListLocalRulestackClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *PrefixListLocalRulestackClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a PrefixListResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - name - Local Rule priority +// - options - PrefixListLocalRulestackClientGetOptions contains the optional parameters for the PrefixListLocalRulestackClient.Get +// method. +func (client *PrefixListLocalRulestackClient) Get(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *PrefixListLocalRulestackClientGetOptions) (PrefixListLocalRulestackClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, localRulestackName, name, options) + if err != nil { + return PrefixListLocalRulestackClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrefixListLocalRulestackClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrefixListLocalRulestackClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrefixListLocalRulestackClient) getCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, name string, options *PrefixListLocalRulestackClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists/{name}" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + if name == "" { + return nil, errors.New("parameter name cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrefixListLocalRulestackClient) getHandleResponse(resp *http.Response) (PrefixListLocalRulestackClientGetResponse, error) { + result := PrefixListLocalRulestackClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrefixListResource); err != nil { + return PrefixListLocalRulestackClientGetResponse{}, err + } + return result, nil +} + +// NewListByLocalRulestacksPager - List PrefixListResource resources by LocalRulestacks +// +// Generated from API version 2022-08-29-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - localRulestackName - LocalRulestack resource name +// - options - PrefixListLocalRulestackClientListByLocalRulestacksOptions contains the optional parameters for the PrefixListLocalRulestackClient.NewListByLocalRulestacksPager +// method. +func (client *PrefixListLocalRulestackClient) NewListByLocalRulestacksPager(resourceGroupName string, localRulestackName string, options *PrefixListLocalRulestackClientListByLocalRulestacksOptions) *runtime.Pager[PrefixListLocalRulestackClientListByLocalRulestacksResponse] { + return runtime.NewPager(runtime.PagingHandler[PrefixListLocalRulestackClientListByLocalRulestacksResponse]{ + More: func(page PrefixListLocalRulestackClientListByLocalRulestacksResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrefixListLocalRulestackClientListByLocalRulestacksResponse) (PrefixListLocalRulestackClientListByLocalRulestacksResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByLocalRulestacksCreateRequest(ctx, resourceGroupName, localRulestackName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PrefixListLocalRulestackClientListByLocalRulestacksResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrefixListLocalRulestackClientListByLocalRulestacksResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrefixListLocalRulestackClientListByLocalRulestacksResponse{}, runtime.NewResponseError(resp) + } + return client.listByLocalRulestacksHandleResponse(resp) + }, + }) +} + +// listByLocalRulestacksCreateRequest creates the ListByLocalRulestacks request. +func (client *PrefixListLocalRulestackClient) listByLocalRulestacksCreateRequest(ctx context.Context, resourceGroupName string, localRulestackName string, options *PrefixListLocalRulestackClientListByLocalRulestacksOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/{localRulestackName}/prefixlists" + 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 localRulestackName == "" { + return nil, errors.New("parameter localRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{localRulestackName}", url.PathEscape(localRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByLocalRulestacksHandleResponse handles the ListByLocalRulestacks response. +func (client *PrefixListLocalRulestackClient) listByLocalRulestacksHandleResponse(resp *http.Response) (PrefixListLocalRulestackClientListByLocalRulestacksResponse, error) { + result := PrefixListLocalRulestackClientListByLocalRulestacksResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrefixListResourceListResult); err != nil { + return PrefixListLocalRulestackClientListByLocalRulestacksResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistlocalrulestack_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistlocalrulestack_client_example_test.go new file mode 100644 index 000000000000..71dc87c5e2c5 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prefixlistlocalrulestack_client_example_test.go @@ -0,0 +1,303 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MaximumSet_Gen.json +func ExamplePrefixListLocalRulestackClient_NewListByLocalRulestacksPager_prefixListLocalRulestackListByLocalRulestacksMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrefixListLocalRulestackClient().NewListByLocalRulestacksPager("rgopenapi", "lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.PrefixListResourceListResult = armpanngfw.PrefixListResourceListResult{ + // Value: []*armpanngfw.PrefixListResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // Type: to.Ptr("aa"), + // ID: to.Ptr("aaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.PrefixObject{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // AuditComment: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaa"), + // PrefixList: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListLocalRulestack_ListByLocalRulestacks_MinimumSet_Gen.json +func ExamplePrefixListLocalRulestackClient_NewListByLocalRulestacksPager_prefixListLocalRulestackListByLocalRulestacksMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrefixListLocalRulestackClient().NewListByLocalRulestacksPager("rgopenapi", "lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.PrefixListResourceListResult = armpanngfw.PrefixListResourceListResult{ + // Value: []*armpanngfw.PrefixListResource{ + // { + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval/prefixlists/prefixlists1"), + // Properties: &armpanngfw.PrefixObject{ + // PrefixList: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListLocalRulestack_Get_MaximumSet_Gen.json +func ExamplePrefixListLocalRulestackClient_Get_prefixListLocalRulestackGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrefixListLocalRulestackClient().Get(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrefixListResource = armpanngfw.PrefixListResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.PrefixObject{ + // Description: to.Ptr("string"), + // AuditComment: to.Ptr("comment"), + // Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // PrefixList: []*string{ + // to.Ptr("1.0.0.0/24")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListLocalRulestack_Get_MinimumSet_Gen.json +func ExamplePrefixListLocalRulestackClient_Get_prefixListLocalRulestackGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrefixListLocalRulestackClient().Get(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrefixListResource = armpanngfw.PrefixListResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval/prefixlists/armid1"), + // Properties: &armpanngfw.PrefixObject{ + // PrefixList: []*string{ + // to.Ptr("1.0.0.0/24")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListLocalRulestack_CreateOrUpdate_MaximumSet_Gen.json +func ExamplePrefixListLocalRulestackClient_BeginCreateOrUpdate_prefixListLocalRulestackCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrefixListLocalRulestackClient().BeginCreateOrUpdate(ctx, "rgopenapi", "lrs1", "armid1", armpanngfw.PrefixListResource{ + Properties: &armpanngfw.PrefixObject{ + Description: to.Ptr("string"), + AuditComment: to.Ptr("comment"), + Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + PrefixList: []*string{ + to.Ptr("1.0.0.0/24")}, + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrefixListResource = armpanngfw.PrefixListResource{ + // Name: to.Ptr("armid1"), + // Type: to.Ptr("certificates"), + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalrulestacks/armid1/certificates/armid1"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.PrefixObject{ + // Description: to.Ptr("string"), + // AuditComment: to.Ptr("comment"), + // Etag: to.Ptr("2bf4a339-294d-4c25-b0b2-ef649e9f5c27"), + // PrefixList: []*string{ + // to.Ptr("1.0.0.0/24")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListLocalRulestack_CreateOrUpdate_MinimumSet_Gen.json +func ExamplePrefixListLocalRulestackClient_BeginCreateOrUpdate_prefixListLocalRulestackCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrefixListLocalRulestackClient().BeginCreateOrUpdate(ctx, "rgopenapi", "lrs1", "armid1", armpanngfw.PrefixListResource{ + Properties: &armpanngfw.PrefixObject{ + PrefixList: []*string{ + to.Ptr("1.0.0.0/24")}, + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PrefixListResource = armpanngfw.PrefixListResource{ + // ID: to.Ptr("/subscriptions/2bf4a339-294d-4c25-b0b2-ef649e9f5c27/resourcegroups/rgopenapi/providers/PaloAltoNetworks.Cloudngfw/localRulestacks/praval/prefixlists/armid1"), + // Properties: &armpanngfw.PrefixObject{ + // PrefixList: []*string{ + // to.Ptr("1.0.0.0/24")}, + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListLocalRulestack_Delete_MaximumSet_Gen.json +func ExamplePrefixListLocalRulestackClient_BeginDelete_prefixListLocalRulestackDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrefixListLocalRulestackClient().BeginDelete(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PrefixListLocalRulestack_Delete_MinimumSet_Gen.json +func ExamplePrefixListLocalRulestackClient_BeginDelete_prefixListLocalRulestackDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrefixListLocalRulestackClient().BeginDelete(ctx, "rgopenapi", "lrs1", "armid1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prerules_client.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prerules_client.go new file mode 100644 index 000000000000..4fbd9b8ed729 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prerules_client.go @@ -0,0 +1,441 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PreRulesClient contains the methods for the PreRules group. +// Don't use this type directly, use NewPreRulesClient() instead. +type PreRulesClient struct { + internal *arm.Client +} + +// NewPreRulesClient creates a new instance of PreRulesClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPreRulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PreRulesClient, error) { + cl, err := arm.NewClient(moduleName+".PreRulesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PreRulesClient{ + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a PreRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Pre Rule priority +// - resource - Resource create parameters. +// - options - PreRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the PreRulesClient.BeginCreateOrUpdate +// method. +func (client *PreRulesClient) BeginCreateOrUpdate(ctx context.Context, globalRulestackName string, priority string, resource PreRulesResource, options *PreRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[PreRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, globalRulestackName, priority, resource, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PreRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PreRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a PreRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *PreRulesClient) createOrUpdate(ctx context.Context, globalRulestackName string, priority string, resource PreRulesResource, options *PreRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, globalRulestackName, priority, resource, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PreRulesClient) createOrUpdateCreateRequest(ctx context.Context, globalRulestackName string, priority string, resource PreRulesResource, options *PreRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, resource) +} + +// BeginDelete - Delete a PreRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Pre Rule priority +// - options - PreRulesClientBeginDeleteOptions contains the optional parameters for the PreRulesClient.BeginDelete method. +func (client *PreRulesClient) BeginDelete(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientBeginDeleteOptions) (*runtime.Poller[PreRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, globalRulestackName, priority, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PreRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[PreRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a PreRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +func (client *PreRulesClient) deleteOperation(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, globalRulestackName, priority, options) + if err != nil { + return nil, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PreRulesClient) deleteCreateRequest(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a PreRulesResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Pre Rule priority +// - options - PreRulesClientGetOptions contains the optional parameters for the PreRulesClient.Get method. +func (client *PreRulesClient) Get(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientGetOptions) (PreRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, globalRulestackName, priority, options) + if err != nil { + return PreRulesClientGetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PreRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PreRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PreRulesClient) getCreateRequest(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PreRulesClient) getHandleResponse(resp *http.Response) (PreRulesClientGetResponse, error) { + result := PreRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PreRulesResource); err != nil { + return PreRulesClientGetResponse{}, err + } + return result, nil +} + +// GetCounters - Get counters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Pre Rule priority +// - options - PreRulesClientGetCountersOptions contains the optional parameters for the PreRulesClient.GetCounters method. +func (client *PreRulesClient) GetCounters(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientGetCountersOptions) (PreRulesClientGetCountersResponse, error) { + req, err := client.getCountersCreateRequest(ctx, globalRulestackName, priority, options) + if err != nil { + return PreRulesClientGetCountersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PreRulesClientGetCountersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PreRulesClientGetCountersResponse{}, runtime.NewResponseError(resp) + } + return client.getCountersHandleResponse(resp) +} + +// getCountersCreateRequest creates the GetCounters request. +func (client *PreRulesClient) getCountersCreateRequest(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientGetCountersOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/getCounters" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + if options != nil && options.FirewallName != nil { + reqQP.Set("firewallName", *options.FirewallName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getCountersHandleResponse handles the GetCounters response. +func (client *PreRulesClient) getCountersHandleResponse(resp *http.Response) (PreRulesClientGetCountersResponse, error) { + result := PreRulesClientGetCountersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RuleCounter); err != nil { + return PreRulesClientGetCountersResponse{}, err + } + return result, nil +} + +// NewListPager - List PreRulesResource resources by Tenant +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - options - PreRulesClientListOptions contains the optional parameters for the PreRulesClient.NewListPager method. +func (client *PreRulesClient) NewListPager(globalRulestackName string, options *PreRulesClientListOptions) *runtime.Pager[PreRulesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PreRulesClientListResponse]{ + More: func(page PreRulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PreRulesClientListResponse) (PreRulesClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, globalRulestackName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return PreRulesClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PreRulesClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PreRulesClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *PreRulesClient) listCreateRequest(ctx context.Context, globalRulestackName string, options *PreRulesClientListOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + 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", "2022-08-29-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PreRulesClient) listHandleResponse(resp *http.Response) (PreRulesClientListResponse, error) { + result := PreRulesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PreRulesResourceListResult); err != nil { + return PreRulesClientListResponse{}, err + } + return result, nil +} + +// RefreshCounters - Refresh counters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Pre Rule priority +// - options - PreRulesClientRefreshCountersOptions contains the optional parameters for the PreRulesClient.RefreshCounters +// method. +func (client *PreRulesClient) RefreshCounters(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientRefreshCountersOptions) (PreRulesClientRefreshCountersResponse, error) { + req, err := client.refreshCountersCreateRequest(ctx, globalRulestackName, priority, options) + if err != nil { + return PreRulesClientRefreshCountersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PreRulesClientRefreshCountersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return PreRulesClientRefreshCountersResponse{}, runtime.NewResponseError(resp) + } + return PreRulesClientRefreshCountersResponse{}, nil +} + +// refreshCountersCreateRequest creates the RefreshCounters request. +func (client *PreRulesClient) refreshCountersCreateRequest(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientRefreshCountersOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/refreshCounters" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + if options != nil && options.FirewallName != nil { + reqQP.Set("firewallName", *options.FirewallName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// ResetCounters - Reset counters +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-29-preview +// - globalRulestackName - GlobalRulestack resource name +// - priority - Pre Rule priority +// - options - PreRulesClientResetCountersOptions contains the optional parameters for the PreRulesClient.ResetCounters method. +func (client *PreRulesClient) ResetCounters(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientResetCountersOptions) (PreRulesClientResetCountersResponse, error) { + req, err := client.resetCountersCreateRequest(ctx, globalRulestackName, priority, options) + if err != nil { + return PreRulesClientResetCountersResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PreRulesClientResetCountersResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PreRulesClientResetCountersResponse{}, runtime.NewResponseError(resp) + } + return client.resetCountersHandleResponse(resp) +} + +// resetCountersCreateRequest creates the ResetCounters request. +func (client *PreRulesClient) resetCountersCreateRequest(ctx context.Context, globalRulestackName string, priority string, options *PreRulesClientResetCountersOptions) (*policy.Request, error) { + urlPath := "/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/{globalRulestackName}/preRules/{priority}/resetCounters" + if globalRulestackName == "" { + return nil, errors.New("parameter globalRulestackName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{globalRulestackName}", url.PathEscape(globalRulestackName)) + if priority == "" { + return nil, errors.New("parameter priority cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{priority}", url.PathEscape(priority)) + 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", "2022-08-29-preview") + if options != nil && options.FirewallName != nil { + reqQP.Set("firewallName", *options.FirewallName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// resetCountersHandleResponse handles the ResetCounters response. +func (client *PreRulesClient) resetCountersHandleResponse(resp *http.Response) (PreRulesClientResetCountersResponse, error) { + result := PreRulesClientResetCountersResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RuleCounterReset); err != nil { + return PreRulesClientResetCountersResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prerules_client_example_test.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prerules_client_example_test.go new file mode 100644 index 000000000000..118cba83affd --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/prerules_client_example_test.go @@ -0,0 +1,629 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_List_MaximumSet_Gen.json +func ExamplePreRulesClient_NewListPager_preRulesListMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPreRulesClient().NewListPager("lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.PreRulesResourceListResult = armpanngfw.PreRulesResourceListResult{ + // Value: []*armpanngfw.PreRulesResource{ + // { + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.RuleEntry{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + // Applications: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // AuditComment: to.Ptr("aaa"), + // Category: &armpanngfw.Category{ + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // URLCustom: []*string{ + // to.Ptr("aaaaa")}, + // }, + // DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + // Destination: &armpanngfw.DestinationAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaaaaaaaaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // FqdnLists: []*string{ + // to.Ptr("aaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // }, + // EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // InboundInspectionCertificate: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + // NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + // Priority: to.Ptr[int32](24), + // ProtocolPortList: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + // Source: &armpanngfw.SourceAddr{ + // Cidrs: []*string{ + // to.Ptr("aaa")}, + // Countries: []*string{ + // to.Ptr("aaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, + // }, + // Tags: []*armpanngfw.TagInfo{ + // { + // Key: to.Ptr("keyName"), + // Value: to.Ptr("value"), + // }}, + // Protocol: to.Ptr("aaaa"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_List_MinimumSet_Gen.json +func ExamplePreRulesClient_NewListPager_preRulesListMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPreRulesClient().NewListPager("lrs1", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page.PreRulesResourceListResult = armpanngfw.PreRulesResourceListResult{ + // Value: []*armpanngfw.PreRulesResource{ + // { + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/lrs1/prerules/1"), + // Properties: &armpanngfw.RuleEntry{ + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // }}, + // } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_Get_MaximumSet_Gen.json +func ExamplePreRulesClient_Get_preRulesGetMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPreRulesClient().Get(ctx, "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PreRulesResource = armpanngfw.PreRulesResource{ + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.RuleEntry{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + // Applications: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // AuditComment: to.Ptr("aaa"), + // Category: &armpanngfw.Category{ + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // URLCustom: []*string{ + // to.Ptr("aaaaa")}, + // }, + // DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + // Destination: &armpanngfw.DestinationAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaaaaaaaaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // FqdnLists: []*string{ + // to.Ptr("aaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // }, + // EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // InboundInspectionCertificate: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + // NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + // Priority: to.Ptr[int32](24), + // ProtocolPortList: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + // Source: &armpanngfw.SourceAddr{ + // Cidrs: []*string{ + // to.Ptr("aaa")}, + // Countries: []*string{ + // to.Ptr("aaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, + // }, + // Tags: []*armpanngfw.TagInfo{ + // { + // Key: to.Ptr("keyName"), + // Value: to.Ptr("value"), + // }}, + // Protocol: to.Ptr("aaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_Get_MinimumSet_Gen.json +func ExamplePreRulesClient_Get_preRulesGetMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPreRulesClient().Get(ctx, "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PreRulesResource = armpanngfw.PreRulesResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/lrs1/prerules/1"), + // Properties: &armpanngfw.RuleEntry{ + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_CreateOrUpdate_MaximumSet_Gen.json +func ExamplePreRulesClient_BeginCreateOrUpdate_preRulesCreateOrUpdateMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPreRulesClient().BeginCreateOrUpdate(ctx, "lrs1", "1", armpanngfw.PreRulesResource{ + Properties: &armpanngfw.RuleEntry{ + Description: to.Ptr("description of pre rule"), + ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + Applications: []*string{ + to.Ptr("app1")}, + AuditComment: to.Ptr("example comment"), + Category: &armpanngfw.Category{ + Feeds: []*string{ + to.Ptr("feed")}, + URLCustom: []*string{ + to.Ptr("https://microsoft.com")}, + }, + DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + Destination: &armpanngfw.DestinationAddr{ + Cidrs: []*string{ + to.Ptr("1.0.0.1/10")}, + Countries: []*string{ + to.Ptr("India")}, + Feeds: []*string{ + to.Ptr("feed")}, + FqdnLists: []*string{ + to.Ptr("FQDN1")}, + PrefixLists: []*string{ + to.Ptr("PL1")}, + }, + EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + Etag: to.Ptr("c18e6eef-ba3e-49ee-8a85-2b36c863a9d0"), + InboundInspectionCertificate: to.Ptr("cert1"), + NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + ProtocolPortList: []*string{ + to.Ptr("80")}, + ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateAccepted), + RuleName: to.Ptr("preRule1"), + RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + Source: &armpanngfw.SourceAddr{ + Cidrs: []*string{ + to.Ptr("1.0.0.1/10")}, + Countries: []*string{ + to.Ptr("India")}, + Feeds: []*string{ + to.Ptr("feed")}, + PrefixLists: []*string{ + to.Ptr("PL1")}, + }, + Tags: []*armpanngfw.TagInfo{ + { + Key: to.Ptr("keyName"), + Value: to.Ptr("value"), + }}, + Protocol: to.Ptr("HTTP"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PreRulesResource = armpanngfw.PreRulesResource{ + // Name: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // Type: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaa"), + // SystemData: &armpanngfw.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // CreatedBy: to.Ptr("praval"), + // CreatedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // LastModifiedBy: to.Ptr("praval"), + // LastModifiedByType: to.Ptr(armpanngfw.CreatedByTypeUser), + // }, + // Properties: &armpanngfw.RuleEntry{ + // Description: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // ActionType: to.Ptr(armpanngfw.ActionEnumAllow), + // Applications: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // AuditComment: to.Ptr("aaa"), + // Category: &armpanngfw.Category{ + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // URLCustom: []*string{ + // to.Ptr("aaaaa")}, + // }, + // DecryptionRuleType: to.Ptr(armpanngfw.DecryptionRuleTypeEnumSSLOutboundInspection), + // Destination: &armpanngfw.DestinationAddr{ + // Cidrs: []*string{ + // to.Ptr("aaaaaaa")}, + // Countries: []*string{ + // to.Ptr("aaaaaaaaaaaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // FqdnLists: []*string{ + // to.Ptr("aaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")}, + // }, + // EnableLogging: to.Ptr(armpanngfw.StateEnumDISABLED), + // Etag: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // InboundInspectionCertificate: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // NegateDestination: to.Ptr(armpanngfw.BooleanEnumTRUE), + // NegateSource: to.Ptr(armpanngfw.BooleanEnumTRUE), + // Priority: to.Ptr[int32](24), + // ProtocolPortList: []*string{ + // to.Ptr("aaaaaaaaaaaa")}, + // ProvisioningState: to.Ptr(armpanngfw.ProvisioningStateSucceeded), + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // RuleState: to.Ptr(armpanngfw.StateEnumDISABLED), + // Source: &armpanngfw.SourceAddr{ + // Cidrs: []*string{ + // to.Ptr("aaa")}, + // Countries: []*string{ + // to.Ptr("aaaaa")}, + // Feeds: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaa")}, + // PrefixLists: []*string{ + // to.Ptr("aaaaaaaaaaaaaaaaaaaa")}, + // }, + // Tags: []*armpanngfw.TagInfo{ + // { + // Key: to.Ptr("keyName"), + // Value: to.Ptr("value"), + // }}, + // Protocol: to.Ptr("aaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_CreateOrUpdate_MinimumSet_Gen.json +func ExamplePreRulesClient_BeginCreateOrUpdate_preRulesCreateOrUpdateMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPreRulesClient().BeginCreateOrUpdate(ctx, "lrs1", "1", armpanngfw.PreRulesResource{ + Properties: &armpanngfw.RuleEntry{ + RuleName: to.Ptr("preRule1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.PreRulesResource = armpanngfw.PreRulesResource{ + // ID: to.Ptr("/providers/PaloAltoNetworks.Cloudngfw/globalRulestacks/lrs1/prerules/1"), + // Properties: &armpanngfw.RuleEntry{ + // RuleName: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), + // }, + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_Delete_MaximumSet_Gen.json +func ExamplePreRulesClient_BeginDelete_preRulesDeleteMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPreRulesClient().BeginDelete(ctx, "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_Delete_MinimumSet_Gen.json +func ExamplePreRulesClient_BeginDelete_preRulesDeleteMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPreRulesClient().BeginDelete(ctx, "lrs1", "1", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_getCounters_MaximumSet_Gen.json +func ExamplePreRulesClient_GetCounters_preRulesGetCountersMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPreRulesClient().GetCounters(ctx, "lrs1", "1", &armpanngfw.PreRulesClientGetCountersOptions{FirewallName: to.Ptr("firewall1")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounter = armpanngfw.RuleCounter{ + // AppSeen: &armpanngfw.AppSeenData{ + // AppSeenList: []*armpanngfw.AppSeenInfo{ + // { + // Category: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // Risk: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaa"), + // StandardPorts: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // SubCategory: to.Ptr("aaaaaaaaaaaaaaaaa"), + // Tag: to.Ptr("aaaaaaaaaa"), + // Technology: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // Title: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), + // }}, + // Count: to.Ptr[int32](13), + // }, + // FirewallName: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // HitCount: to.Ptr[int32](20), + // LastUpdatedTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // Priority: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // RequestTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // RuleListName: to.Ptr("aaaaaaaaaaaaaaaaaaa"), + // RuleName: to.Ptr("aaaa"), + // RuleStackName: to.Ptr("aaaaaaaaaaaaaaaaa"), + // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-09T05:08:24.229Z"); return t}()), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_getCounters_MinimumSet_Gen.json +func ExamplePreRulesClient_GetCounters_preRulesGetCountersMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPreRulesClient().GetCounters(ctx, "lrs1", "1", &armpanngfw.PreRulesClientGetCountersOptions{FirewallName: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounter = armpanngfw.RuleCounter{ + // Priority: to.Ptr("aaaaaaaaaaaaaaaaaaaa"), + // RuleName: to.Ptr("aaaa"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_refreshCounters_MaximumSet_Gen.json +func ExamplePreRulesClient_RefreshCounters_preRulesRefreshCountersMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewPreRulesClient().RefreshCounters(ctx, "lrs1", "1", &armpanngfw.PreRulesClientRefreshCountersOptions{FirewallName: to.Ptr("firewall1")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_refreshCounters_MinimumSet_Gen.json +func ExamplePreRulesClient_RefreshCounters_preRulesRefreshCountersMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = clientFactory.NewPreRulesClient().RefreshCounters(ctx, "lrs1", "1", &armpanngfw.PreRulesClientRefreshCountersOptions{FirewallName: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_resetCounters_MaximumSet_Gen.json +func ExamplePreRulesClient_ResetCounters_preRulesResetCountersMaximumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPreRulesClient().ResetCounters(ctx, "lrs1", "1", &armpanngfw.PreRulesClientResetCountersOptions{FirewallName: to.Ptr("firewall1")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounterReset = armpanngfw.RuleCounterReset{ + // FirewallName: to.Ptr("aaaaaaaaaaaaaaaaaa"), + // Priority: to.Ptr("aaaaaaa"), + // RuleListName: to.Ptr("aaaaa"), + // RuleName: to.Ptr("aaaaa"), + // RuleStackName: to.Ptr("aa"), + // } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/fdf43f2fdacf17bd78c0621df44a5c024b61db82/specification/paloaltonetworks/resource-manager/PaloAltoNetworks.Cloudngfw/preview/2022-08-29-preview/examples/PreRules_resetCounters_MinimumSet_Gen.json +func ExamplePreRulesClient_ResetCounters_preRulesResetCountersMinimumSetGen() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armpanngfw.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPreRulesClient().ResetCounters(ctx, "lrs1", "1", &armpanngfw.PreRulesClientResetCountersOptions{FirewallName: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res.RuleCounterReset = armpanngfw.RuleCounterReset{ + // } +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/response_types.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/response_types.go new file mode 100644 index 000000000000..45565bcd1f6d --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/response_types.go @@ -0,0 +1,450 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +// CertificateObjectGlobalRulestackClientCreateOrUpdateResponse contains the response from method CertificateObjectGlobalRulestackClient.BeginCreateOrUpdate. +type CertificateObjectGlobalRulestackClientCreateOrUpdateResponse struct { + CertificateObjectGlobalRulestackResource +} + +// CertificateObjectGlobalRulestackClientDeleteResponse contains the response from method CertificateObjectGlobalRulestackClient.BeginDelete. +type CertificateObjectGlobalRulestackClientDeleteResponse struct { + // placeholder for future response values +} + +// CertificateObjectGlobalRulestackClientGetResponse contains the response from method CertificateObjectGlobalRulestackClient.Get. +type CertificateObjectGlobalRulestackClientGetResponse struct { + CertificateObjectGlobalRulestackResource +} + +// CertificateObjectGlobalRulestackClientListResponse contains the response from method CertificateObjectGlobalRulestackClient.NewListPager. +type CertificateObjectGlobalRulestackClientListResponse struct { + CertificateObjectGlobalRulestackResourceListResult +} + +// CertificateObjectLocalRulestackClientCreateOrUpdateResponse contains the response from method CertificateObjectLocalRulestackClient.BeginCreateOrUpdate. +type CertificateObjectLocalRulestackClientCreateOrUpdateResponse struct { + CertificateObjectLocalRulestackResource +} + +// CertificateObjectLocalRulestackClientDeleteResponse contains the response from method CertificateObjectLocalRulestackClient.BeginDelete. +type CertificateObjectLocalRulestackClientDeleteResponse struct { + // placeholder for future response values +} + +// CertificateObjectLocalRulestackClientGetResponse contains the response from method CertificateObjectLocalRulestackClient.Get. +type CertificateObjectLocalRulestackClientGetResponse struct { + CertificateObjectLocalRulestackResource +} + +// CertificateObjectLocalRulestackClientListByLocalRulestacksResponse contains the response from method CertificateObjectLocalRulestackClient.NewListByLocalRulestacksPager. +type CertificateObjectLocalRulestackClientListByLocalRulestacksResponse struct { + CertificateObjectLocalRulestackResourceListResult +} + +// FirewallStatusClientGetResponse contains the response from method FirewallStatusClient.Get. +type FirewallStatusClientGetResponse struct { + FirewallStatusResource +} + +// FirewallStatusClientListByFirewallsResponse contains the response from method FirewallStatusClient.NewListByFirewallsPager. +type FirewallStatusClientListByFirewallsResponse struct { + FirewallStatusResourceListResult +} + +// FirewallsClientCreateOrUpdateResponse contains the response from method FirewallsClient.BeginCreateOrUpdate. +type FirewallsClientCreateOrUpdateResponse struct { + FirewallResource +} + +// FirewallsClientDeleteResponse contains the response from method FirewallsClient.BeginDelete. +type FirewallsClientDeleteResponse struct { + // placeholder for future response values +} + +// FirewallsClientGetGlobalRulestackResponse contains the response from method FirewallsClient.GetGlobalRulestack. +type FirewallsClientGetGlobalRulestackResponse struct { + GlobalRulestackInfo +} + +// FirewallsClientGetLogProfileResponse contains the response from method FirewallsClient.GetLogProfile. +type FirewallsClientGetLogProfileResponse struct { + LogSettings +} + +// FirewallsClientGetResponse contains the response from method FirewallsClient.Get. +type FirewallsClientGetResponse struct { + FirewallResource +} + +// FirewallsClientGetSupportInfoResponse contains the response from method FirewallsClient.GetSupportInfo. +type FirewallsClientGetSupportInfoResponse struct { + SupportInfo +} + +// FirewallsClientListByResourceGroupResponse contains the response from method FirewallsClient.NewListByResourceGroupPager. +type FirewallsClientListByResourceGroupResponse struct { + FirewallResourceListResult +} + +// FirewallsClientListBySubscriptionResponse contains the response from method FirewallsClient.NewListBySubscriptionPager. +type FirewallsClientListBySubscriptionResponse struct { + FirewallResourceListResult +} + +// FirewallsClientSaveLogProfileResponse contains the response from method FirewallsClient.SaveLogProfile. +type FirewallsClientSaveLogProfileResponse struct { + // placeholder for future response values +} + +// FirewallsClientUpdateResponse contains the response from method FirewallsClient.Update. +type FirewallsClientUpdateResponse struct { + FirewallResource +} + +// FqdnListGlobalRulestackClientCreateOrUpdateResponse contains the response from method FqdnListGlobalRulestackClient.BeginCreateOrUpdate. +type FqdnListGlobalRulestackClientCreateOrUpdateResponse struct { + FqdnListGlobalRulestackResource +} + +// FqdnListGlobalRulestackClientDeleteResponse contains the response from method FqdnListGlobalRulestackClient.BeginDelete. +type FqdnListGlobalRulestackClientDeleteResponse struct { + // placeholder for future response values +} + +// FqdnListGlobalRulestackClientGetResponse contains the response from method FqdnListGlobalRulestackClient.Get. +type FqdnListGlobalRulestackClientGetResponse struct { + FqdnListGlobalRulestackResource +} + +// FqdnListGlobalRulestackClientListResponse contains the response from method FqdnListGlobalRulestackClient.NewListPager. +type FqdnListGlobalRulestackClientListResponse struct { + FqdnListGlobalRulestackResourceListResult +} + +// FqdnListLocalRulestackClientCreateOrUpdateResponse contains the response from method FqdnListLocalRulestackClient.BeginCreateOrUpdate. +type FqdnListLocalRulestackClientCreateOrUpdateResponse struct { + FqdnListLocalRulestackResource +} + +// FqdnListLocalRulestackClientDeleteResponse contains the response from method FqdnListLocalRulestackClient.BeginDelete. +type FqdnListLocalRulestackClientDeleteResponse struct { + // placeholder for future response values +} + +// FqdnListLocalRulestackClientGetResponse contains the response from method FqdnListLocalRulestackClient.Get. +type FqdnListLocalRulestackClientGetResponse struct { + FqdnListLocalRulestackResource +} + +// FqdnListLocalRulestackClientListByLocalRulestacksResponse contains the response from method FqdnListLocalRulestackClient.NewListByLocalRulestacksPager. +type FqdnListLocalRulestackClientListByLocalRulestacksResponse struct { + FqdnListLocalRulestackResourceListResult +} + +// GlobalRulestackClientCommitResponse contains the response from method GlobalRulestackClient.BeginCommit. +type GlobalRulestackClientCommitResponse struct { + // placeholder for future response values +} + +// GlobalRulestackClientCreateOrUpdateResponse contains the response from method GlobalRulestackClient.BeginCreateOrUpdate. +type GlobalRulestackClientCreateOrUpdateResponse struct { + GlobalRulestackResource +} + +// GlobalRulestackClientDeleteResponse contains the response from method GlobalRulestackClient.BeginDelete. +type GlobalRulestackClientDeleteResponse struct { + // placeholder for future response values +} + +// GlobalRulestackClientGetChangeLogResponse contains the response from method GlobalRulestackClient.GetChangeLog. +type GlobalRulestackClientGetChangeLogResponse struct { + Changelog +} + +// GlobalRulestackClientGetResponse contains the response from method GlobalRulestackClient.Get. +type GlobalRulestackClientGetResponse struct { + GlobalRulestackResource +} + +// GlobalRulestackClientListAdvancedSecurityObjectsResponse contains the response from method GlobalRulestackClient.ListAdvancedSecurityObjects. +type GlobalRulestackClientListAdvancedSecurityObjectsResponse struct { + AdvSecurityObjectListResponse +} + +// GlobalRulestackClientListAppIDsResponse contains the response from method GlobalRulestackClient.ListAppIDs. +type GlobalRulestackClientListAppIDsResponse struct { + ListAppIDResponse +} + +// GlobalRulestackClientListCountriesResponse contains the response from method GlobalRulestackClient.ListCountries. +type GlobalRulestackClientListCountriesResponse struct { + CountriesResponse +} + +// GlobalRulestackClientListFirewallsResponse contains the response from method GlobalRulestackClient.ListFirewalls. +type GlobalRulestackClientListFirewallsResponse struct { + ListFirewallsResponse +} + +// GlobalRulestackClientListPredefinedURLCategoriesResponse contains the response from method GlobalRulestackClient.ListPredefinedURLCategories. +type GlobalRulestackClientListPredefinedURLCategoriesResponse struct { + PredefinedURLCategoriesResponse +} + +// GlobalRulestackClientListResponse contains the response from method GlobalRulestackClient.NewListPager. +type GlobalRulestackClientListResponse struct { + GlobalRulestackResourceListResult +} + +// GlobalRulestackClientListSecurityServicesResponse contains the response from method GlobalRulestackClient.ListSecurityServices. +type GlobalRulestackClientListSecurityServicesResponse struct { + SecurityServicesResponse +} + +// GlobalRulestackClientRevertResponse contains the response from method GlobalRulestackClient.Revert. +type GlobalRulestackClientRevertResponse struct { + // placeholder for future response values +} + +// GlobalRulestackClientUpdateResponse contains the response from method GlobalRulestackClient.Update. +type GlobalRulestackClientUpdateResponse struct { + GlobalRulestackResource +} + +// LocalRulesClientCreateOrUpdateResponse contains the response from method LocalRulesClient.BeginCreateOrUpdate. +type LocalRulesClientCreateOrUpdateResponse struct { + LocalRulesResource +} + +// LocalRulesClientDeleteResponse contains the response from method LocalRulesClient.BeginDelete. +type LocalRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// LocalRulesClientGetCountersResponse contains the response from method LocalRulesClient.GetCounters. +type LocalRulesClientGetCountersResponse struct { + RuleCounter +} + +// LocalRulesClientGetResponse contains the response from method LocalRulesClient.Get. +type LocalRulesClientGetResponse struct { + LocalRulesResource +} + +// LocalRulesClientListByLocalRulestacksResponse contains the response from method LocalRulesClient.NewListByLocalRulestacksPager. +type LocalRulesClientListByLocalRulestacksResponse struct { + LocalRulesResourceListResult +} + +// LocalRulesClientRefreshCountersResponse contains the response from method LocalRulesClient.RefreshCounters. +type LocalRulesClientRefreshCountersResponse struct { + // placeholder for future response values +} + +// LocalRulesClientResetCountersResponse contains the response from method LocalRulesClient.ResetCounters. +type LocalRulesClientResetCountersResponse struct { + RuleCounterReset +} + +// LocalRulestacksClientCommitResponse contains the response from method LocalRulestacksClient.BeginCommit. +type LocalRulestacksClientCommitResponse struct { + // placeholder for future response values +} + +// LocalRulestacksClientCreateOrUpdateResponse contains the response from method LocalRulestacksClient.BeginCreateOrUpdate. +type LocalRulestacksClientCreateOrUpdateResponse struct { + LocalRulestackResource +} + +// LocalRulestacksClientDeleteResponse contains the response from method LocalRulestacksClient.BeginDelete. +type LocalRulestacksClientDeleteResponse struct { + // placeholder for future response values +} + +// LocalRulestacksClientGetChangeLogResponse contains the response from method LocalRulestacksClient.GetChangeLog. +type LocalRulestacksClientGetChangeLogResponse struct { + Changelog +} + +// LocalRulestacksClientGetResponse contains the response from method LocalRulestacksClient.Get. +type LocalRulestacksClientGetResponse struct { + LocalRulestackResource +} + +// LocalRulestacksClientGetSupportInfoResponse contains the response from method LocalRulestacksClient.GetSupportInfo. +type LocalRulestacksClientGetSupportInfoResponse struct { + SupportInfo +} + +// LocalRulestacksClientListAdvancedSecurityObjectsResponse contains the response from method LocalRulestacksClient.ListAdvancedSecurityObjects. +type LocalRulestacksClientListAdvancedSecurityObjectsResponse struct { + AdvSecurityObjectListResponse +} + +// LocalRulestacksClientListAppIDsResponse contains the response from method LocalRulestacksClient.ListAppIDs. +type LocalRulestacksClientListAppIDsResponse struct { + ListAppIDResponse +} + +// LocalRulestacksClientListByResourceGroupResponse contains the response from method LocalRulestacksClient.NewListByResourceGroupPager. +type LocalRulestacksClientListByResourceGroupResponse struct { + LocalRulestackResourceListResult +} + +// LocalRulestacksClientListBySubscriptionResponse contains the response from method LocalRulestacksClient.NewListBySubscriptionPager. +type LocalRulestacksClientListBySubscriptionResponse struct { + LocalRulestackResourceListResult +} + +// LocalRulestacksClientListCountriesResponse contains the response from method LocalRulestacksClient.ListCountries. +type LocalRulestacksClientListCountriesResponse struct { + CountriesResponse +} + +// LocalRulestacksClientListFirewallsResponse contains the response from method LocalRulestacksClient.ListFirewalls. +type LocalRulestacksClientListFirewallsResponse struct { + ListFirewallsResponse +} + +// LocalRulestacksClientListPredefinedURLCategoriesResponse contains the response from method LocalRulestacksClient.ListPredefinedURLCategories. +type LocalRulestacksClientListPredefinedURLCategoriesResponse struct { + PredefinedURLCategoriesResponse +} + +// LocalRulestacksClientListSecurityServicesResponse contains the response from method LocalRulestacksClient.ListSecurityServices. +type LocalRulestacksClientListSecurityServicesResponse struct { + SecurityServicesResponse +} + +// LocalRulestacksClientRevertResponse contains the response from method LocalRulestacksClient.Revert. +type LocalRulestacksClientRevertResponse struct { + // placeholder for future response values +} + +// LocalRulestacksClientUpdateResponse contains the response from method LocalRulestacksClient.Update. +type LocalRulestacksClientUpdateResponse struct { + LocalRulestackResource +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + OperationListResult +} + +// PostRulesClientCreateOrUpdateResponse contains the response from method PostRulesClient.BeginCreateOrUpdate. +type PostRulesClientCreateOrUpdateResponse struct { + PostRulesResource +} + +// PostRulesClientDeleteResponse contains the response from method PostRulesClient.BeginDelete. +type PostRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// PostRulesClientGetCountersResponse contains the response from method PostRulesClient.GetCounters. +type PostRulesClientGetCountersResponse struct { + RuleCounter +} + +// PostRulesClientGetResponse contains the response from method PostRulesClient.Get. +type PostRulesClientGetResponse struct { + PostRulesResource +} + +// PostRulesClientListResponse contains the response from method PostRulesClient.NewListPager. +type PostRulesClientListResponse struct { + PostRulesResourceListResult +} + +// PostRulesClientRefreshCountersResponse contains the response from method PostRulesClient.RefreshCounters. +type PostRulesClientRefreshCountersResponse struct { + // placeholder for future response values +} + +// PostRulesClientResetCountersResponse contains the response from method PostRulesClient.ResetCounters. +type PostRulesClientResetCountersResponse struct { + RuleCounterReset +} + +// PreRulesClientCreateOrUpdateResponse contains the response from method PreRulesClient.BeginCreateOrUpdate. +type PreRulesClientCreateOrUpdateResponse struct { + PreRulesResource +} + +// PreRulesClientDeleteResponse contains the response from method PreRulesClient.BeginDelete. +type PreRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// PreRulesClientGetCountersResponse contains the response from method PreRulesClient.GetCounters. +type PreRulesClientGetCountersResponse struct { + RuleCounter +} + +// PreRulesClientGetResponse contains the response from method PreRulesClient.Get. +type PreRulesClientGetResponse struct { + PreRulesResource +} + +// PreRulesClientListResponse contains the response from method PreRulesClient.NewListPager. +type PreRulesClientListResponse struct { + PreRulesResourceListResult +} + +// PreRulesClientRefreshCountersResponse contains the response from method PreRulesClient.RefreshCounters. +type PreRulesClientRefreshCountersResponse struct { + // placeholder for future response values +} + +// PreRulesClientResetCountersResponse contains the response from method PreRulesClient.ResetCounters. +type PreRulesClientResetCountersResponse struct { + RuleCounterReset +} + +// PrefixListGlobalRulestackClientCreateOrUpdateResponse contains the response from method PrefixListGlobalRulestackClient.BeginCreateOrUpdate. +type PrefixListGlobalRulestackClientCreateOrUpdateResponse struct { + PrefixListGlobalRulestackResource +} + +// PrefixListGlobalRulestackClientDeleteResponse contains the response from method PrefixListGlobalRulestackClient.BeginDelete. +type PrefixListGlobalRulestackClientDeleteResponse struct { + // placeholder for future response values +} + +// PrefixListGlobalRulestackClientGetResponse contains the response from method PrefixListGlobalRulestackClient.Get. +type PrefixListGlobalRulestackClientGetResponse struct { + PrefixListGlobalRulestackResource +} + +// PrefixListGlobalRulestackClientListResponse contains the response from method PrefixListGlobalRulestackClient.NewListPager. +type PrefixListGlobalRulestackClientListResponse struct { + PrefixListGlobalRulestackResourceListResult +} + +// PrefixListLocalRulestackClientCreateOrUpdateResponse contains the response from method PrefixListLocalRulestackClient.BeginCreateOrUpdate. +type PrefixListLocalRulestackClientCreateOrUpdateResponse struct { + PrefixListResource +} + +// PrefixListLocalRulestackClientDeleteResponse contains the response from method PrefixListLocalRulestackClient.BeginDelete. +type PrefixListLocalRulestackClientDeleteResponse struct { + // placeholder for future response values +} + +// PrefixListLocalRulestackClientGetResponse contains the response from method PrefixListLocalRulestackClient.Get. +type PrefixListLocalRulestackClientGetResponse struct { + PrefixListResource +} + +// PrefixListLocalRulestackClientListByLocalRulestacksResponse contains the response from method PrefixListLocalRulestackClient.NewListByLocalRulestacksPager. +type PrefixListLocalRulestackClientListByLocalRulestacksResponse struct { + PrefixListResourceListResult +} diff --git a/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/time_rfc3339.go b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/time_rfc3339.go new file mode 100644 index 000000000000..b37eb2234926 --- /dev/null +++ b/sdk/resourcemanager/paloaltonetworksngfw/armpanngfw/time_rfc3339.go @@ -0,0 +1,87 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// DO NOT EDIT. + +package armpanngfw + +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 +}