armhanaonazure

package module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 12 Imported by: 2

README

Azure SAP HANA Module for Go

PkgGoDev

The armhanaonazure module provides operations for working with Azure SAP HANA.

Source code

Getting started

Prerequisites

  • an Azure subscription
  • Go 1.18 or above (You could download and install the latest version of Go from here. 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.)

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure SAP HANA module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hanaonazure/armhanaonazure

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure SAP HANA. The azidentity module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.

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.

Client Factory

Azure SAP HANA module consists of one or more clients. We provide a client factory which could be used to create any client in this module.

clientFactory, err := armhanaonazure.NewClientFactory(<subscription ID>, 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.

options := arm.ClientOptions {
    ClientOptions: azcore.ClientOptions {
        Cloud: cloud.AzureChina,
    },
}
clientFactory, err := armhanaonazure.NewClientFactory(<subscription ID>, 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.

client := clientFactory.NewSapMonitorsClient()

Fakes

The fake package contains types used for constructing in-memory fake servers used in unit tests. This allows writing tests to cover various success/error conditions without the need for connecting to a live service.

Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes.

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the SAP HANA 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.

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. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFactory added in v0.6.0

type ClientFactory struct {
	// contains filtered or unexported fields
}

ClientFactory is a client factory used to create any client in this module. Don't use this type directly, use NewClientFactory instead.

func NewClientFactory added in v0.6.0

func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error)

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 - Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewOperationsClient added in v0.6.0

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

func (*ClientFactory) NewProviderInstancesClient added in v0.6.0

func (c *ClientFactory) NewProviderInstancesClient() *ProviderInstancesClient

NewProviderInstancesClient creates a new instance of ProviderInstancesClient.

func (*ClientFactory) NewSapMonitorsClient added in v0.6.0

func (c *ClientFactory) NewSapMonitorsClient() *SapMonitorsClient

NewSapMonitorsClient creates a new instance of SapMonitorsClient.

type Display

type Display struct {
	// READ-ONLY; The localized friendly description for the operation as shown to the user. This description should be thorough,
	// yet concise. It will be used in tool-tips and detailed views.
	Description *string

	// READ-ONLY; The localized friendly name for the operation as shown to the user. This name should be concise (to fit in drop
	// downs), but clear (self-documenting). Use Title Casing and include the entity/resource
	// to which it applies.
	Operation *string

	// READ-ONLY; The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs
	// UX. Default value is 'user,system'
	Origin *string

	// READ-ONLY; The localized friendly form of the resource provider name. This form is also expected to include the publisher/company
	// responsible. Use Title Casing. Begin with "Microsoft" for 1st party services.
	Provider *string

	// READ-ONLY; The localized friendly form of the resource type related to this action/operation. This form should match the
	// public documentation for the resource provider. Use Title Casing. For examples, refer to
	// the “name” section.
	Resource *string
}

Display - Detailed HANA operation information

func (Display) MarshalJSON added in v0.6.0

func (d Display) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Display.

func (*Display) UnmarshalJSON added in v0.6.0

func (d *Display) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Display.

type ErrorResponse

type ErrorResponse struct {
	// Describes the error object.
	Error *ErrorResponseError
}

ErrorResponse - Describes the format of Error response.

func (ErrorResponse) MarshalJSON added in v0.6.0

func (e ErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorResponse.

func (*ErrorResponse) UnmarshalJSON added in v0.6.0

func (e *ErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse.

type ErrorResponseError

type ErrorResponseError struct {
	// READ-ONLY; Error code
	Code *string

	// READ-ONLY; Error message indicating why the operation failed.
	Message *string
}

ErrorResponseError - Describes the error object.

func (ErrorResponseError) MarshalJSON added in v0.6.0

func (e ErrorResponseError) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ErrorResponseError.

func (*ErrorResponseError) UnmarshalJSON added in v0.6.0

func (e *ErrorResponseError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseError.

type HanaProvisioningStatesEnum

type HanaProvisioningStatesEnum string

HanaProvisioningStatesEnum - State of provisioning of the HanaInstance

const (
	HanaProvisioningStatesEnumAccepted  HanaProvisioningStatesEnum = "Accepted"
	HanaProvisioningStatesEnumCreating  HanaProvisioningStatesEnum = "Creating"
	HanaProvisioningStatesEnumDeleting  HanaProvisioningStatesEnum = "Deleting"
	HanaProvisioningStatesEnumFailed    HanaProvisioningStatesEnum = "Failed"
	HanaProvisioningStatesEnumMigrating HanaProvisioningStatesEnum = "Migrating"
	HanaProvisioningStatesEnumSucceeded HanaProvisioningStatesEnum = "Succeeded"
	HanaProvisioningStatesEnumUpdating  HanaProvisioningStatesEnum = "Updating"
)

func PossibleHanaProvisioningStatesEnumValues

func PossibleHanaProvisioningStatesEnumValues() []HanaProvisioningStatesEnum

PossibleHanaProvisioningStatesEnumValues returns the possible values for the HanaProvisioningStatesEnum const type.

type Operation

type Operation struct {
	// Displayed HANA operation information
	Display *Display

	// READ-ONLY; The name of the operation being performed on this particular object. This name should match the action name
	// that appears in RBAC / the event service.
	Name *string
}

Operation - HANA operation information

func (Operation) MarshalJSON added in v0.6.0

func (o Operation) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON added in v0.6.0

func (o *Operation) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

type OperationList

type OperationList struct {
	// List of HANA operations
	Value []*Operation
}

OperationList - List of HANA operations

func (OperationList) MarshalJSON

func (o OperationList) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type OperationList.

func (*OperationList) UnmarshalJSON added in v0.6.0

func (o *OperationList) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type OperationList.

type OperationsClient

type OperationsClient struct {
	// contains filtered or unexported fields
}

OperationsClient contains the methods for the Operations group. Don't use this type directly, use NewOperationsClient() instead.

func NewOperationsClient

func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error)

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 (*OperationsClient) NewListPager added in v0.4.0

NewListPager - Gets a list of SAP HANA management operations.

Generated from API version 2020-02-07-preview

  • options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/HanaOperations_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", 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.OperationList = armhanaonazure.OperationList{
		// 	Value: []*armhanaonazure.Operation{
		// 		{
		// 			Name: to.Ptr("HanaOp1"),
		// 			Display: &armhanaonazure.Display{
		// 				Description: to.Ptr("HanaOp1Description"),
		// 				Operation: to.Ptr("HanaOp1OperationName"),
		// 				Origin: to.Ptr("HanaOp1Origin"),
		// 				Provider: to.Ptr("HanaOp1ProviderName"),
		// 				Resource: to.Ptr("HanaOp1ResourceName"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("HanaOp2"),
		// 			Display: &armhanaonazure.Display{
		// 				Description: to.Ptr("HanaOp2Description"),
		// 				Operation: to.Ptr("HanaOp2OperationName"),
		// 				Origin: to.Ptr("HanaOp2Origin"),
		// 				Provider: to.Ptr("HanaOp2ProviderName"),
		// 				Resource: to.Ptr("HanaOp2ResourceName"),
		// 			},
		// 	}},
		// }
	}
}
Output:

type OperationsClientListOptions added in v0.2.0

type OperationsClientListOptions struct {
}

OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method.

type OperationsClientListResponse added in v0.2.0

type OperationsClientListResponse struct {
	// List of HANA operations
	OperationList
}

OperationsClientListResponse contains the response from method OperationsClient.NewListPager.

type ProviderInstance

type ProviderInstance struct {
	// Provider Instance properties
	Properties *ProviderInstanceProperties

	// 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

ProviderInstance - A provider instance associated with a SAP monitor.

func (ProviderInstance) MarshalJSON

func (p ProviderInstance) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ProviderInstance.

func (*ProviderInstance) UnmarshalJSON added in v0.6.0

func (p *ProviderInstance) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ProviderInstance.

type ProviderInstanceListResult

type ProviderInstanceListResult struct {
	// The URL to get the next set of provider instances.
	NextLink *string

	// The list of provider instances.
	Value []*ProviderInstance
}

ProviderInstanceListResult - The response from the List provider instances operation.

func (ProviderInstanceListResult) MarshalJSON

func (p ProviderInstanceListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ProviderInstanceListResult.

func (*ProviderInstanceListResult) UnmarshalJSON added in v0.6.0

func (p *ProviderInstanceListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ProviderInstanceListResult.

type ProviderInstanceProperties

type ProviderInstanceProperties struct {
	// A JSON string containing metadata of the provider instance.
	Metadata *string

	// A JSON string containing the properties of the provider instance.
	Properties *string

	// The type of provider instance.
	Type *string

	// READ-ONLY; State of provisioning of the provider instance
	ProvisioningState *HanaProvisioningStatesEnum
}

ProviderInstanceProperties - Describes the properties of a provider instance.

func (ProviderInstanceProperties) MarshalJSON added in v0.6.0

func (p ProviderInstanceProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ProviderInstanceProperties.

func (*ProviderInstanceProperties) UnmarshalJSON added in v0.6.0

func (p *ProviderInstanceProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ProviderInstanceProperties.

type ProviderInstancesClient

type ProviderInstancesClient struct {
	// contains filtered or unexported fields
}

ProviderInstancesClient contains the methods for the ProviderInstances group. Don't use this type directly, use NewProviderInstancesClient() instead.

func NewProviderInstancesClient

func NewProviderInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProviderInstancesClient, error)

NewProviderInstancesClient creates a new instance of ProviderInstancesClient with the specified values.

  • subscriptionID - Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ProviderInstancesClient) BeginCreate

func (client *ProviderInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, sapMonitorName string, providerInstanceName string, providerInstanceParameter ProviderInstance, options *ProviderInstancesClientBeginCreateOptions) (*runtime.Poller[ProviderInstancesClientCreateResponse], error)

BeginCreate - Creates a provider instance for the specified subscription, resource group, SapMonitor name, and resource name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-02-07-preview

  • resourceGroupName - Name of the resource group.
  • sapMonitorName - Name of the SAP monitor resource.
  • providerInstanceName - Name of the provider instance.
  • providerInstanceParameter - Request body representing a provider instance
  • options - ProviderInstancesClientBeginCreateOptions contains the optional parameters for the ProviderInstancesClient.BeginCreate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/ProviderInstances_Create.json

package main

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/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewProviderInstancesClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", armhanaonazure.ProviderInstance{
		Properties: &armhanaonazure.ProviderInstanceProperties{
			Type:       to.Ptr("hana"),
			Metadata:   to.Ptr("{\"key\":\"value\"}"),
			Properties: to.Ptr("{\"hostname\":\"10.0.0.6\",\"dbName\":\"SYSTEMDB\",\"sqlPort\":30013,\"dbUsername\":\"SYSTEM\",\"dbPassword\":\"PASSWORD\"}"),
		},
	}, 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.ProviderInstance = armhanaonazure.ProviderInstance{
	// 	Name: to.Ptr("myProviderInstance"),
	// 	Type: to.Ptr("Microsoft.HanaOnAzure/sapMonitors/providerInstances"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/sapMonitors/mySapMonitor/providerInstances/myProviderInstance"),
	// 	Properties: &armhanaonazure.ProviderInstanceProperties{
	// 		Type: to.Ptr("SapHana"),
	// 		Metadata: to.Ptr("{\"key\":\"value\"}"),
	// 		Properties: to.Ptr("{\"hostname\":\"10.0.0.6\",\"dbName\":\"SYSTEMDB\",\"sqlPort\":30013,\"dbUsername\":\"SYSTEM\"}"),
	// 		ProvisioningState: to.Ptr(armhanaonazure.HanaProvisioningStatesEnumSucceeded),
	// 	},
	// }
}
Output:

func (*ProviderInstancesClient) BeginDelete

func (client *ProviderInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, sapMonitorName string, providerInstanceName string, options *ProviderInstancesClientBeginDeleteOptions) (*runtime.Poller[ProviderInstancesClientDeleteResponse], error)

BeginDelete - Deletes a provider instance for the specified subscription, resource group, SapMonitor name, and resource name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-02-07-preview

  • resourceGroupName - Name of the resource group.
  • sapMonitorName - Name of the SAP monitor resource.
  • providerInstanceName - Name of the provider instance.
  • options - ProviderInstancesClientBeginDeleteOptions contains the optional parameters for the ProviderInstancesClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/ProviderInstances_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewProviderInstancesClient().BeginDelete(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", 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)
	}
}
Output:

func (*ProviderInstancesClient) Get

func (client *ProviderInstancesClient) Get(ctx context.Context, resourceGroupName string, sapMonitorName string, providerInstanceName string, options *ProviderInstancesClientGetOptions) (ProviderInstancesClientGetResponse, error)

Get - Gets properties of a provider instance for the specified subscription, resource group, SapMonitor name, and resource name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-02-07-preview

  • resourceGroupName - Name of the resource group.
  • sapMonitorName - Name of the SAP monitor resource.
  • providerInstanceName - Name of the provider instance.
  • options - ProviderInstancesClientGetOptions contains the optional parameters for the ProviderInstancesClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/ProviderInstances_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewProviderInstancesClient().Get(ctx, "myResourceGroup", "mySapMonitor", "myProviderInstance", 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.ProviderInstance = armhanaonazure.ProviderInstance{
	// 	Name: to.Ptr("myProviderInstance"),
	// 	Type: to.Ptr("Microsoft.HanaOnAzure/sapMonitors/providerInstances"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/sapMonitors/mySapMonitor/providerInstances/myProviderInstance"),
	// 	Properties: &armhanaonazure.ProviderInstanceProperties{
	// 		Type: to.Ptr("SapHana"),
	// 		Metadata: to.Ptr("{\"key\":\"value\"}"),
	// 		Properties: to.Ptr("{\"hostname\":\"10.0.0.6\",\"dbName\":\"SYSTEMDB\",\"sqlPort\":30013,\"dbUsername\":\"SYSTEM\"}"),
	// 	},
	// }
}
Output:

func (*ProviderInstancesClient) NewListPager added in v0.4.0

func (client *ProviderInstancesClient) NewListPager(resourceGroupName string, sapMonitorName string, options *ProviderInstancesClientListOptions) *runtime.Pager[ProviderInstancesClientListResponse]

NewListPager - Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each provider instances.

Generated from API version 2020-02-07-preview

  • resourceGroupName - Name of the resource group.
  • sapMonitorName - Name of the SAP monitor resource.
  • options - ProviderInstancesClientListOptions contains the optional parameters for the ProviderInstancesClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/ProviderInstances_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewProviderInstancesClient().NewListPager("myResourceGroup", "mySapMonitor", 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.ProviderInstanceListResult = armhanaonazure.ProviderInstanceListResult{
		// 	Value: []*armhanaonazure.ProviderInstance{
		// 		{
		// 			Name: to.Ptr("myProviderInstance1"),
		// 			Type: to.Ptr("Microsoft.HanaOnAzure/sapMonitors/providerInstances"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/sapMonitors/mySapMonitor/providerInstances/myProviderInstance1"),
		// 			Properties: &armhanaonazure.ProviderInstanceProperties{
		// 				Type: to.Ptr("SapHana"),
		// 				Metadata: to.Ptr("{\"key\":\"value\"}"),
		// 				Properties: to.Ptr("{\"hostname\":\"10.0.0.6\",\"dbName\":\"SYSTEMDB\",\"sqlPort\":30013,\"dbUsername\":\"SYSTEM\"}"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myProviderInstance2"),
		// 			Type: to.Ptr("Microsoft.HanaOnAzure/sapMonitors/providerInstances"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/sapMonitors/mySapMonitor/providerInstances/myProviderInstance2"),
		// 			Properties: &armhanaonazure.ProviderInstanceProperties{
		// 				Type: to.Ptr("PrometheusHaCluster"),
		// 				Metadata: to.Ptr("{\"key\":\"value\"}"),
		// 				Properties: to.Ptr("{\"prometheusUrl\":\"http://10.0.0.21:9664/metrics\"}"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("myProviderInstance2"),
		// 			Type: to.Ptr("Microsoft.HanaOnAzure/sapMonitors/providerInstances"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/sapMonitors/mySapMonitor/providerInstances/myProviderInstance2"),
		// 			Properties: &armhanaonazure.ProviderInstanceProperties{
		// 				Type: to.Ptr("MsSqlServer"),
		// 				Metadata: to.Ptr("{\"key\":\"value\"}"),
		// 				Properties: to.Ptr("{\"sqlHostname\":\"10.0.0.6\",\"sqlPort\":1433,\"sqlUsername\":\"sqladmin\"}"),
		// 			},
		// 	}},
		// }
	}
}
Output:

type ProviderInstancesClientBeginCreateOptions added in v0.2.0

type ProviderInstancesClientBeginCreateOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

ProviderInstancesClientBeginCreateOptions contains the optional parameters for the ProviderInstancesClient.BeginCreate method.

type ProviderInstancesClientBeginDeleteOptions added in v0.2.0

type ProviderInstancesClientBeginDeleteOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

ProviderInstancesClientBeginDeleteOptions contains the optional parameters for the ProviderInstancesClient.BeginDelete method.

type ProviderInstancesClientCreateResponse added in v0.2.0

type ProviderInstancesClientCreateResponse struct {
	// A provider instance associated with a SAP monitor.
	ProviderInstance
}

ProviderInstancesClientCreateResponse contains the response from method ProviderInstancesClient.BeginCreate.

type ProviderInstancesClientDeleteResponse added in v0.2.0

type ProviderInstancesClientDeleteResponse struct {
}

ProviderInstancesClientDeleteResponse contains the response from method ProviderInstancesClient.BeginDelete.

type ProviderInstancesClientGetOptions added in v0.2.0

type ProviderInstancesClientGetOptions struct {
}

ProviderInstancesClientGetOptions contains the optional parameters for the ProviderInstancesClient.Get method.

type ProviderInstancesClientGetResponse added in v0.2.0

type ProviderInstancesClientGetResponse struct {
	// A provider instance associated with a SAP monitor.
	ProviderInstance
}

ProviderInstancesClientGetResponse contains the response from method ProviderInstancesClient.Get.

type ProviderInstancesClientListOptions added in v0.2.0

type ProviderInstancesClientListOptions struct {
}

ProviderInstancesClientListOptions contains the optional parameters for the ProviderInstancesClient.NewListPager method.

type ProviderInstancesClientListResponse added in v0.2.0

type ProviderInstancesClientListResponse struct {
	// The response from the List provider instances operation.
	ProviderInstanceListResult
}

ProviderInstancesClientListResponse contains the response from method ProviderInstancesClient.NewListPager.

type ProxyResource

type ProxyResource struct {
	// 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location

func (ProxyResource) MarshalJSON added in v0.6.0

func (p ProxyResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ProxyResource.

func (*ProxyResource) UnmarshalJSON added in v0.6.0

func (p *ProxyResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource.

type Resource

type Resource struct {
	// 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

Resource - Common fields that are returned in the response for all Azure Resource Manager resources

func (Resource) MarshalJSON

func (r Resource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Resource.

func (*Resource) UnmarshalJSON added in v0.6.0

func (r *Resource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Resource.

type SapMonitor

type SapMonitor struct {
	// REQUIRED; The geo-location where the resource lives
	Location *string

	// SAP monitor properties
	Properties *SapMonitorProperties

	// 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

SapMonitor - SAP monitor info on Azure (ARM properties and SAP monitor properties)

func (SapMonitor) MarshalJSON

func (s SapMonitor) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SapMonitor.

func (*SapMonitor) UnmarshalJSON added in v0.6.0

func (s *SapMonitor) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SapMonitor.

type SapMonitorListResult

type SapMonitorListResult struct {
	// The URL to get the next set of SAP monitors.
	NextLink *string

	// The list of SAP monitors.
	Value []*SapMonitor
}

SapMonitorListResult - The response from the List SAP monitors operation.

func (SapMonitorListResult) MarshalJSON

func (s SapMonitorListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SapMonitorListResult.

func (*SapMonitorListResult) UnmarshalJSON added in v0.6.0

func (s *SapMonitorListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SapMonitorListResult.

type SapMonitorProperties

type SapMonitorProperties struct {
	// The value indicating whether to send analytics to Microsoft
	EnableCustomerAnalytics *bool

	// The ARM ID of the Log Analytics Workspace that is used for monitoring
	LogAnalyticsWorkspaceArmID *string

	// The workspace ID of the log analytics workspace to be used for monitoring
	LogAnalyticsWorkspaceID *string

	// The shared key of the log analytics workspace that is used for monitoring
	LogAnalyticsWorkspaceSharedKey *string

	// The subnet which the SAP monitor will be deployed in
	MonitorSubnet *string

	// READ-ONLY; The name of the resource group the SAP Monitor resources get deployed into.
	ManagedResourceGroupName *string

	// READ-ONLY; State of provisioning of the HanaInstance
	ProvisioningState *HanaProvisioningStatesEnum

	// READ-ONLY; The version of the payload running in the Collector VM
	SapMonitorCollectorVersion *string
}

SapMonitorProperties - Describes the properties of a SAP monitor.

func (SapMonitorProperties) MarshalJSON added in v0.6.0

func (s SapMonitorProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type SapMonitorProperties.

func (*SapMonitorProperties) UnmarshalJSON added in v0.6.0

func (s *SapMonitorProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type SapMonitorProperties.

type SapMonitorsClient

type SapMonitorsClient struct {
	// contains filtered or unexported fields
}

SapMonitorsClient contains the methods for the SapMonitors group. Don't use this type directly, use NewSapMonitorsClient() instead.

func NewSapMonitorsClient

func NewSapMonitorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SapMonitorsClient, error)

NewSapMonitorsClient creates a new instance of SapMonitorsClient with the specified values.

  • subscriptionID - Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*SapMonitorsClient) BeginCreate

func (client *SapMonitorsClient) BeginCreate(ctx context.Context, resourceGroupName string, sapMonitorName string, sapMonitorParameter SapMonitor, options *SapMonitorsClientBeginCreateOptions) (*runtime.Poller[SapMonitorsClientCreateResponse], error)

BeginCreate - Creates a SAP monitor for the specified subscription, resource group, and resource name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-02-07-preview

  • resourceGroupName - Name of the resource group.
  • sapMonitorName - Name of the SAP monitor resource.
  • sapMonitorParameter - Request body representing a SAP Monitor
  • options - SapMonitorsClientBeginCreateOptions contains the optional parameters for the SapMonitorsClient.BeginCreate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_Create.json

package main

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/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewSapMonitorsClient().BeginCreate(ctx, "myResourceGroup", "mySapMonitor", armhanaonazure.SapMonitor{
		Location: to.Ptr("westus"),
		Tags: map[string]*string{
			"key": to.Ptr("value"),
		},
		Properties: &armhanaonazure.SapMonitorProperties{
			EnableCustomerAnalytics:        to.Ptr(true),
			LogAnalyticsWorkspaceArmID:     to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"),
			LogAnalyticsWorkspaceID:        to.Ptr("00000000-0000-0000-0000-000000000000"),
			LogAnalyticsWorkspaceSharedKey: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000=="),
			MonitorSubnet:                  to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"),
		},
	}, 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.SapMonitor = armhanaonazure.SapMonitor{
	// 	Name: to.Ptr("myHanaInstance"),
	// 	Type: to.Ptr("Microsoft.HanaOnAzure/hanaInstances"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/hanaInstances/myHanaInstance"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"key": to.Ptr("value"),
	// 	},
	// 	Properties: &armhanaonazure.SapMonitorProperties{
	// 		EnableCustomerAnalytics: to.Ptr(true),
	// 		LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"),
	// 		LogAnalyticsWorkspaceID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		LogAnalyticsWorkspaceSharedKey: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000=="),
	// 		ManagedResourceGroupName: to.Ptr("myManagedResourceGroup"),
	// 		MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"),
	// 		ProvisioningState: to.Ptr(armhanaonazure.HanaProvisioningStatesEnumSucceeded),
	// 		SapMonitorCollectorVersion: to.Ptr("v1.0"),
	// 	},
	// }
}
Output:

func (*SapMonitorsClient) BeginDelete

func (client *SapMonitorsClient) BeginDelete(ctx context.Context, resourceGroupName string, sapMonitorName string, options *SapMonitorsClientBeginDeleteOptions) (*runtime.Poller[SapMonitorsClientDeleteResponse], error)

BeginDelete - Deletes a SAP monitor with the specified subscription, resource group, and monitor name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-02-07-preview

  • resourceGroupName - Name of the resource group.
  • sapMonitorName - Name of the SAP monitor resource.
  • options - SapMonitorsClientBeginDeleteOptions contains the optional parameters for the SapMonitorsClient.BeginDelete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewSapMonitorsClient().BeginDelete(ctx, "myResourceGroup", "mySapMonitor", 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)
	}
}
Output:

func (*SapMonitorsClient) Get

func (client *SapMonitorsClient) Get(ctx context.Context, resourceGroupName string, sapMonitorName string, options *SapMonitorsClientGetOptions) (SapMonitorsClientGetResponse, error)

Get - Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-02-07-preview

  • resourceGroupName - Name of the resource group.
  • sapMonitorName - Name of the SAP monitor resource.
  • options - SapMonitorsClientGetOptions contains the optional parameters for the SapMonitorsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_Get.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSapMonitorsClient().Get(ctx, "myResourceGroup", "mySapMonitor", 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.SapMonitor = armhanaonazure.SapMonitor{
	// 	Name: to.Ptr("mySapMonitor"),
	// 	Type: to.Ptr("Microsoft.HanaOnAzure/sapMonitors"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/sapMonitors/mySapMonitor"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"key": to.Ptr("value"),
	// 	},
	// 	Properties: &armhanaonazure.SapMonitorProperties{
	// 		EnableCustomerAnalytics: to.Ptr(true),
	// 		LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"),
	// 		LogAnalyticsWorkspaceID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		LogAnalyticsWorkspaceSharedKey: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000=="),
	// 		ManagedResourceGroupName: to.Ptr("myManagedResourceGroup"),
	// 		MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"),
	// 		ProvisioningState: to.Ptr(armhanaonazure.HanaProvisioningStatesEnumSucceeded),
	// 		SapMonitorCollectorVersion: to.Ptr("v1.0"),
	// 	},
	// }
}
Output:

func (*SapMonitorsClient) NewListPager added in v0.4.0

NewListPager - Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP monitor.

Generated from API version 2020-02-07-preview

  • options - SapMonitorsClientListOptions contains the optional parameters for the SapMonitorsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_List.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewSapMonitorsClient().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.SapMonitorListResult = armhanaonazure.SapMonitorListResult{
		// 	Value: []*armhanaonazure.SapMonitor{
		// 		{
		// 			Name: to.Ptr("mySapMonitor1"),
		// 			Type: to.Ptr("Microsoft.HanaOnAzure/sapMonitors"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/sapMonitors/mySapMonitor1"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"key": to.Ptr("value"),
		// 			},
		// 			Properties: &armhanaonazure.SapMonitorProperties{
		// 				EnableCustomerAnalytics: to.Ptr(true),
		// 				LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"),
		// 				LogAnalyticsWorkspaceID: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 				LogAnalyticsWorkspaceSharedKey: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000=="),
		// 				ManagedResourceGroupName: to.Ptr("myManagedResourceGroup"),
		// 				MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"),
		// 				ProvisioningState: to.Ptr(armhanaonazure.HanaProvisioningStatesEnumSucceeded),
		// 				SapMonitorCollectorVersion: to.Ptr("v1.0"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("mySapMonitor2"),
		// 			Type: to.Ptr("Microsoft.HanaOnAzure/sapMonitors"),
		// 			ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/sapMonitors/mySapMonitor2"),
		// 			Location: to.Ptr("westus"),
		// 			Tags: map[string]*string{
		// 				"key": to.Ptr("value"),
		// 			},
		// 			Properties: &armhanaonazure.SapMonitorProperties{
		// 				EnableCustomerAnalytics: to.Ptr(true),
		// 				LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"),
		// 				LogAnalyticsWorkspaceID: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 				LogAnalyticsWorkspaceSharedKey: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000=="),
		// 				ManagedResourceGroupName: to.Ptr("myManagedResourceGroup"),
		// 				MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"),
		// 				ProvisioningState: to.Ptr(armhanaonazure.HanaProvisioningStatesEnumSucceeded),
		// 				SapMonitorCollectorVersion: to.Ptr("v1.0"),
		// 			},
		// 	}},
		// }
	}
}
Output:

func (*SapMonitorsClient) Update

func (client *SapMonitorsClient) Update(ctx context.Context, resourceGroupName string, sapMonitorName string, tagsParameter Tags, options *SapMonitorsClientUpdateOptions) (SapMonitorsClientUpdateResponse, error)

Update - Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-02-07-preview

  • resourceGroupName - Name of the resource group.
  • sapMonitorName - Name of the SAP monitor resource.
  • tagsParameter - Request body that only contains the new Tags field
  • options - SapMonitorsClientUpdateOptions contains the optional parameters for the SapMonitorsClient.Update method.
Example (DeleteTagsFieldOfASapMonitor)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_PatchTags_Delete.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSapMonitorsClient().Update(ctx, "myResourceGroup", "mySapMonitor", armhanaonazure.Tags{
		Tags: map[string]*string{},
	}, 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.SapMonitor = armhanaonazure.SapMonitor{
	// 	Name: to.Ptr("mySapMonitor"),
	// 	Type: to.Ptr("Microsoft.HanaOnAzure/sapMonitors"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/sapMonitors/mySapMonitor"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 	},
	// 	Properties: &armhanaonazure.SapMonitorProperties{
	// 		EnableCustomerAnalytics: to.Ptr(true),
	// 		LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"),
	// 		LogAnalyticsWorkspaceID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		LogAnalyticsWorkspaceSharedKey: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000=="),
	// 		ManagedResourceGroupName: to.Ptr("myManagedResourceGroup"),
	// 		MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"),
	// 		ProvisioningState: to.Ptr(armhanaonazure.HanaProvisioningStatesEnumSucceeded),
	// 		SapMonitorCollectorVersion: to.Ptr("v1.0"),
	// 	},
	// }
}
Output:

Example (UpdateTagsFieldOfASapMonitor)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hanaonazure/resource-manager/Microsoft.HanaOnAzure/preview/2020-02-07-preview/examples/SapMonitors_PatchTags.json

package main

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/hanaonazure/armhanaonazure"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armhanaonazure.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSapMonitorsClient().Update(ctx, "myResourceGroup", "mySapMonitor", armhanaonazure.Tags{
		Tags: map[string]*string{
			"testkey": to.Ptr("testvalue"),
		},
	}, 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.SapMonitor = armhanaonazure.SapMonitor{
	// 	Name: to.Ptr("mySapMonitor"),
	// 	Type: to.Ptr("Microsoft.HanaOnAzure/sapMonitors"),
	// 	ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.HanaOnAzure/sapMonitors/mySapMonitor"),
	// 	Location: to.Ptr("westus"),
	// 	Tags: map[string]*string{
	// 		"testkey": to.Ptr("testvalue"),
	// 	},
	// 	Properties: &armhanaonazure.SapMonitorProperties{
	// 		EnableCustomerAnalytics: to.Ptr(true),
	// 		LogAnalyticsWorkspaceArmID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.operationalinsights/workspaces/myWorkspace"),
	// 		LogAnalyticsWorkspaceID: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 		LogAnalyticsWorkspaceSharedKey: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000=="),
	// 		ManagedResourceGroupName: to.Ptr("myManagedResourceGroup"),
	// 		MonitorSubnet: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet"),
	// 		ProvisioningState: to.Ptr(armhanaonazure.HanaProvisioningStatesEnumSucceeded),
	// 		SapMonitorCollectorVersion: to.Ptr("v1.0"),
	// 	},
	// }
}
Output:

type SapMonitorsClientBeginCreateOptions added in v0.2.0

type SapMonitorsClientBeginCreateOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

SapMonitorsClientBeginCreateOptions contains the optional parameters for the SapMonitorsClient.BeginCreate method.

type SapMonitorsClientBeginDeleteOptions added in v0.2.0

type SapMonitorsClientBeginDeleteOptions struct {
	// Resumes the LRO from the provided token.
	ResumeToken string
}

SapMonitorsClientBeginDeleteOptions contains the optional parameters for the SapMonitorsClient.BeginDelete method.

type SapMonitorsClientCreateResponse added in v0.2.0

type SapMonitorsClientCreateResponse struct {
	// SAP monitor info on Azure (ARM properties and SAP monitor properties)
	SapMonitor
}

SapMonitorsClientCreateResponse contains the response from method SapMonitorsClient.BeginCreate.

type SapMonitorsClientDeleteResponse added in v0.2.0

type SapMonitorsClientDeleteResponse struct {
}

SapMonitorsClientDeleteResponse contains the response from method SapMonitorsClient.BeginDelete.

type SapMonitorsClientGetOptions added in v0.2.0

type SapMonitorsClientGetOptions struct {
}

SapMonitorsClientGetOptions contains the optional parameters for the SapMonitorsClient.Get method.

type SapMonitorsClientGetResponse added in v0.2.0

type SapMonitorsClientGetResponse struct {
	// SAP monitor info on Azure (ARM properties and SAP monitor properties)
	SapMonitor
}

SapMonitorsClientGetResponse contains the response from method SapMonitorsClient.Get.

type SapMonitorsClientListOptions added in v0.2.0

type SapMonitorsClientListOptions struct {
}

SapMonitorsClientListOptions contains the optional parameters for the SapMonitorsClient.NewListPager method.

type SapMonitorsClientListResponse added in v0.2.0

type SapMonitorsClientListResponse struct {
	// The response from the List SAP monitors operation.
	SapMonitorListResult
}

SapMonitorsClientListResponse contains the response from method SapMonitorsClient.NewListPager.

type SapMonitorsClientUpdateOptions added in v0.2.0

type SapMonitorsClientUpdateOptions struct {
}

SapMonitorsClientUpdateOptions contains the optional parameters for the SapMonitorsClient.Update method.

type SapMonitorsClientUpdateResponse added in v0.2.0

type SapMonitorsClientUpdateResponse struct {
	// SAP monitor info on Azure (ARM properties and SAP monitor properties)
	SapMonitor
}

SapMonitorsClientUpdateResponse contains the response from method SapMonitorsClient.Update.

type Tags

type Tags struct {
	// Tags field of the resource.
	Tags map[string]*string
}

Tags field of the resource.

func (Tags) MarshalJSON

func (t Tags) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Tags.

func (*Tags) UnmarshalJSON added in v0.6.0

func (t *Tags) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Tags.

type TrackedResource

type TrackedResource struct {
	// REQUIRED; The geo-location where the resource lives
	Location *string

	// 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'

func (TrackedResource) MarshalJSON

func (t TrackedResource) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type TrackedResource.

func (*TrackedResource) UnmarshalJSON added in v0.6.0

func (t *TrackedResource) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL