armadvisor

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 15 Imported by: 4

README

Azure Advisor Module for Go

PkgGoDev

The armadvisor module provides operations for working with Azure Advisor.

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 Advisor module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/advisor/armadvisor

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Advisor. 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 Advisor 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 := armadvisor.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 := armadvisor.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.NewSuppressionsClient()

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 Advisor 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 ARMErrorResponseBody

type ARMErrorResponseBody struct {
	// Gets or sets the string that can be used to programmatically identify the error.
	Code *string

	// Gets or sets the string that describes the error in detail and provides debugging information.
	Message *string
}

ARMErrorResponseBody - ARM error response body.

func (ARMErrorResponseBody) MarshalJSON added in v1.1.0

func (a ARMErrorResponseBody) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ARMErrorResponseBody.

func (*ARMErrorResponseBody) UnmarshalJSON added in v1.1.0

func (a *ARMErrorResponseBody) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ARMErrorResponseBody.

type ArmErrorResponse

type ArmErrorResponse struct {
	// ARM error response body.
	Error *ARMErrorResponseBody
}

func (ArmErrorResponse) MarshalJSON added in v1.1.0

func (a ArmErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ArmErrorResponse.

func (*ArmErrorResponse) UnmarshalJSON added in v1.1.0

func (a *ArmErrorResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ArmErrorResponse.

type CPUThreshold

type CPUThreshold string

CPUThreshold - Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20.

const (
	CPUThresholdFifteen CPUThreshold = "15"
	CPUThresholdFive    CPUThreshold = "5"
	CPUThresholdTen     CPUThreshold = "10"
	CPUThresholdTwenty  CPUThreshold = "20"
)

func PossibleCPUThresholdValues

func PossibleCPUThresholdValues() []CPUThreshold

PossibleCPUThresholdValues returns the possible values for the CPUThreshold const type.

type Category

type Category string
const (
	CategoryCost                  Category = "Cost"
	CategoryHighAvailability      Category = "HighAvailability"
	CategoryOperationalExcellence Category = "OperationalExcellence"
	CategoryPerformance           Category = "Performance"
	CategorySecurity              Category = "Security"
)

func PossibleCategoryValues

func PossibleCategoryValues() []Category

PossibleCategoryValues returns the possible values for the Category const type.

type ClientFactory added in v1.1.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 v1.1.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 - The Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ClientFactory) NewConfigurationsClient added in v1.1.0

func (c *ClientFactory) NewConfigurationsClient() *ConfigurationsClient

NewConfigurationsClient creates a new instance of ConfigurationsClient.

func (*ClientFactory) NewOperationsClient added in v1.1.0

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

func (*ClientFactory) NewRecommendationMetadataClient added in v1.1.0

func (c *ClientFactory) NewRecommendationMetadataClient() *RecommendationMetadataClient

NewRecommendationMetadataClient creates a new instance of RecommendationMetadataClient.

func (*ClientFactory) NewRecommendationsClient added in v1.1.0

func (c *ClientFactory) NewRecommendationsClient() *RecommendationsClient

NewRecommendationsClient creates a new instance of RecommendationsClient.

func (*ClientFactory) NewSuppressionsClient added in v1.1.0

func (c *ClientFactory) NewSuppressionsClient() *SuppressionsClient

NewSuppressionsClient creates a new instance of SuppressionsClient.

type ConfigData

type ConfigData struct {
	// The Advisor configuration data structure.
	Properties *ConfigDataProperties

	// READ-ONLY; The resource ID.
	ID *string

	// READ-ONLY; The name of the resource.
	Name *string

	// READ-ONLY; The type of the resource.
	Type *string
}

ConfigData - The Advisor configuration data structure.

func (ConfigData) MarshalJSON added in v1.1.0

func (c ConfigData) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ConfigData.

func (*ConfigData) UnmarshalJSON added in v1.1.0

func (c *ConfigData) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ConfigData.

type ConfigDataProperties

type ConfigDataProperties struct {
	// Advisor digest configuration. Valid only for subscriptions
	Digests []*DigestConfig

	// Exclude the resource from Advisor evaluations. Valid values: False (default) or True.
	Exclude *bool

	// Minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5
	// (default), 10, 15 or 20.
	LowCPUThreshold *CPUThreshold
}

ConfigDataProperties - Configuration data properties

func (ConfigDataProperties) MarshalJSON

func (c ConfigDataProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ConfigDataProperties.

func (*ConfigDataProperties) UnmarshalJSON added in v1.1.0

func (c *ConfigDataProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ConfigDataProperties.

type ConfigurationListResult

type ConfigurationListResult struct {
	// The link used to get the next page of configurations.
	NextLink *string

	// The list of configurations.
	Value []*ConfigData
}

ConfigurationListResult - The list of Advisor configurations.

func (ConfigurationListResult) MarshalJSON

func (c ConfigurationListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type ConfigurationListResult.

func (*ConfigurationListResult) UnmarshalJSON added in v1.1.0

func (c *ConfigurationListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationListResult.

type ConfigurationName

type ConfigurationName string
const (
	ConfigurationNameDefault ConfigurationName = "default"
)

func PossibleConfigurationNameValues

func PossibleConfigurationNameValues() []ConfigurationName

PossibleConfigurationNameValues returns the possible values for the ConfigurationName const type.

type ConfigurationsClient

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

ConfigurationsClient contains the methods for the Configurations group. Don't use this type directly, use NewConfigurationsClient() instead.

func NewConfigurationsClient

func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationsClient, error)

NewConfigurationsClient creates a new instance of ConfigurationsClient with the specified values.

  • subscriptionID - The Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*ConfigurationsClient) CreateInResourceGroup

func (client *ConfigurationsClient) CreateInResourceGroup(ctx context.Context, configurationName ConfigurationName, resourceGroup string, configContract ConfigData, options *ConfigurationsClientCreateInResourceGroupOptions) (ConfigurationsClientCreateInResourceGroupResponse, error)

CreateInResourceGroup - Create/Overwrite Azure Advisor configuration. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-01-01

  • configurationName - Advisor configuration name. Value must be 'default'
  • resourceGroup - The name of the Azure resource group.
  • configContract - The Azure Advisor configuration data structure.
  • options - ConfigurationsClientCreateInResourceGroupOptions contains the optional parameters for the ConfigurationsClient.CreateInResourceGroup method.

func (*ConfigurationsClient) CreateInSubscription

CreateInSubscription - Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-01-01

  • configurationName - Advisor configuration name. Value must be 'default'
  • configContract - The Azure Advisor configuration data structure.
  • options - ConfigurationsClientCreateInSubscriptionOptions contains the optional parameters for the ConfigurationsClient.CreateInSubscription method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateConfiguration.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/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewConfigurationsClient().CreateInSubscription(ctx, armadvisor.ConfigurationNameDefault, armadvisor.ConfigData{
		Properties: &armadvisor.ConfigDataProperties{
			Digests: []*armadvisor.DigestConfig{
				{
					Name:                  to.Ptr("digestConfigName"),
					ActionGroupResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName"),
					Categories: []*armadvisor.Category{
						to.Ptr(armadvisor.CategoryHighAvailability),
						to.Ptr(armadvisor.CategorySecurity),
						to.Ptr(armadvisor.CategoryPerformance),
						to.Ptr(armadvisor.CategoryCost),
						to.Ptr(armadvisor.CategoryOperationalExcellence)},
					Frequency: to.Ptr[int32](30),
					State:     to.Ptr(armadvisor.DigestConfigStateActive),
					Language:  to.Ptr("en"),
				}},
			Exclude:         to.Ptr(true),
			LowCPUThreshold: to.Ptr(armadvisor.CPUThresholdFive),
		},
	}, 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.ConfigData = armadvisor.ConfigData{
	// 	Name: to.Ptr("default"),
	// 	Type: to.Ptr("Microsoft.Advisor/configurations"),
	// 	ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Advisor/configurations/default"),
	// 	Properties: &armadvisor.ConfigDataProperties{
	// 		Digests: []*armadvisor.DigestConfig{
	// 			{
	// 				Name: to.Ptr("digestConfigName"),
	// 				ActionGroupResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName"),
	// 				Categories: []*armadvisor.Category{
	// 					to.Ptr(armadvisor.CategoryHighAvailability),
	// 					to.Ptr(armadvisor.CategorySecurity),
	// 					to.Ptr(armadvisor.CategoryPerformance),
	// 					to.Ptr(armadvisor.CategoryCost),
	// 					to.Ptr(armadvisor.CategoryOperationalExcellence)},
	// 					Frequency: to.Ptr[int32](30),
	// 					State: to.Ptr(armadvisor.DigestConfigStateActive),
	// 					Language: to.Ptr("en"),
	// 			}},
	// 			Exclude: to.Ptr(true),
	// 			LowCPUThreshold: to.Ptr(armadvisor.CPUThresholdFive),
	// 		},
	// 	}
}
Output:

func (*ConfigurationsClient) NewListByResourceGroupPager added in v0.4.0

NewListByResourceGroupPager - Retrieve Azure Advisor configurations.

Generated from API version 2020-01-01

  • resourceGroup - The name of the Azure resource group.
  • options - ConfigurationsClientListByResourceGroupOptions contains the optional parameters for the ConfigurationsClient.NewListByResourceGroupPager method.

func (*ConfigurationsClient) NewListBySubscriptionPager added in v0.4.0

NewListBySubscriptionPager - Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups.

Generated from API version 2020-01-01

  • options - ConfigurationsClientListBySubscriptionOptions contains the optional parameters for the ConfigurationsClient.NewListBySubscriptionPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListConfigurations.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewConfigurationsClient().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.ConfigurationListResult = armadvisor.ConfigurationListResult{
		// 	Value: []*armadvisor.ConfigData{
		// 		{
		// 			Name: to.Ptr("default"),
		// 			Type: to.Ptr("Microsoft.Advisor/configurations"),
		// 			ID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Advisor/configurations/default"),
		// 			Properties: &armadvisor.ConfigDataProperties{
		// 				Digests: []*armadvisor.DigestConfig{
		// 					{
		// 						Name: to.Ptr("digestConfigName"),
		// 						ActionGroupResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName"),
		// 						Categories: []*armadvisor.Category{
		// 							to.Ptr(armadvisor.CategoryHighAvailability),
		// 							to.Ptr(armadvisor.CategorySecurity),
		// 							to.Ptr(armadvisor.CategoryPerformance),
		// 							to.Ptr(armadvisor.CategoryCost),
		// 							to.Ptr(armadvisor.CategoryOperationalExcellence)},
		// 							Frequency: to.Ptr[int32](30),
		// 							State: to.Ptr(armadvisor.DigestConfigStateActive),
		// 							Language: to.Ptr("en"),
		// 					}},
		// 					Exclude: to.Ptr(false),
		// 					LowCPUThreshold: to.Ptr(armadvisor.CPUThresholdFive),
		// 				},
		// 		}},
		// 	}
	}
}
Output:

type ConfigurationsClientCreateInResourceGroupOptions added in v0.2.0

type ConfigurationsClientCreateInResourceGroupOptions struct {
}

ConfigurationsClientCreateInResourceGroupOptions contains the optional parameters for the ConfigurationsClient.CreateInResourceGroup method.

type ConfigurationsClientCreateInResourceGroupResponse added in v0.2.0

type ConfigurationsClientCreateInResourceGroupResponse struct {
	// The Advisor configuration data structure.
	ConfigData
}

ConfigurationsClientCreateInResourceGroupResponse contains the response from method ConfigurationsClient.CreateInResourceGroup.

type ConfigurationsClientCreateInSubscriptionOptions added in v0.2.0

type ConfigurationsClientCreateInSubscriptionOptions struct {
}

ConfigurationsClientCreateInSubscriptionOptions contains the optional parameters for the ConfigurationsClient.CreateInSubscription method.

type ConfigurationsClientCreateInSubscriptionResponse added in v0.2.0

type ConfigurationsClientCreateInSubscriptionResponse struct {
	// The Advisor configuration data structure.
	ConfigData
}

ConfigurationsClientCreateInSubscriptionResponse contains the response from method ConfigurationsClient.CreateInSubscription.

type ConfigurationsClientListByResourceGroupOptions added in v0.2.0

type ConfigurationsClientListByResourceGroupOptions struct {
}

ConfigurationsClientListByResourceGroupOptions contains the optional parameters for the ConfigurationsClient.NewListByResourceGroupPager method.

type ConfigurationsClientListByResourceGroupResponse added in v0.2.0

type ConfigurationsClientListByResourceGroupResponse struct {
	// The list of Advisor configurations.
	ConfigurationListResult
}

ConfigurationsClientListByResourceGroupResponse contains the response from method ConfigurationsClient.NewListByResourceGroupPager.

type ConfigurationsClientListBySubscriptionOptions added in v0.2.0

type ConfigurationsClientListBySubscriptionOptions struct {
}

ConfigurationsClientListBySubscriptionOptions contains the optional parameters for the ConfigurationsClient.NewListBySubscriptionPager method.

type ConfigurationsClientListBySubscriptionResponse added in v0.2.0

type ConfigurationsClientListBySubscriptionResponse struct {
	// The list of Advisor configurations.
	ConfigurationListResult
}

ConfigurationsClientListBySubscriptionResponse contains the response from method ConfigurationsClient.NewListBySubscriptionPager.

type DigestConfig

type DigestConfig struct {
	// Action group resource id used by digest.
	ActionGroupResourceID *string

	// Categories to send digest for. If categories are not provided, then digest will be sent for all categories.
	Categories []*Category

	// Frequency that digest will be triggered, in days. Value must be between 7 and 30 days inclusive.
	Frequency *int32

	// Language for digest content body. Value must be ISO 639-1 code for one of Azure portal supported languages. Otherwise,
	// it will be converted into one. Default value is English (en).
	Language *string

	// Name of digest configuration. Value is case-insensitive and must be unique within a subscription.
	Name *string

	// State of digest configuration.
	State *DigestConfigState
}

DigestConfig - Advisor Digest configuration entity

func (DigestConfig) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type DigestConfig.

func (*DigestConfig) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type DigestConfig.

type DigestConfigState

type DigestConfigState string

DigestConfigState - State of digest configuration.

const (
	DigestConfigStateActive   DigestConfigState = "Active"
	DigestConfigStateDisabled DigestConfigState = "Disabled"
)

func PossibleDigestConfigStateValues

func PossibleDigestConfigStateValues() []DigestConfigState

PossibleDigestConfigStateValues returns the possible values for the DigestConfigState const type.

type Impact

type Impact string

Impact - The business impact of the recommendation.

const (
	ImpactHigh   Impact = "High"
	ImpactLow    Impact = "Low"
	ImpactMedium Impact = "Medium"
)

func PossibleImpactValues

func PossibleImpactValues() []Impact

PossibleImpactValues returns the possible values for the Impact const type.

type MetadataEntity

type MetadataEntity struct {
	// The resource Id of the metadata entity.
	ID *string

	// The name of the metadata entity.
	Name *string

	// The metadata entity properties.
	Properties *MetadataEntityProperties

	// The type of the metadata entity.
	Type *string
}

MetadataEntity - The metadata entity contract.

func (MetadataEntity) MarshalJSON added in v1.1.0

func (m MetadataEntity) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MetadataEntity.

func (*MetadataEntity) UnmarshalJSON added in v1.1.0

func (m *MetadataEntity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MetadataEntity.

type MetadataEntityListResult

type MetadataEntityListResult struct {
	// The link used to get the next page of metadata.
	NextLink *string

	// The list of metadata entities.
	Value []*MetadataEntity
}

MetadataEntityListResult - The list of metadata entities

func (MetadataEntityListResult) MarshalJSON

func (m MetadataEntityListResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MetadataEntityListResult.

func (*MetadataEntityListResult) UnmarshalJSON added in v1.1.0

func (m *MetadataEntityListResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MetadataEntityListResult.

type MetadataEntityProperties

type MetadataEntityProperties struct {
	// The list of scenarios applicable to this metadata entity.
	ApplicableScenarios []*Scenario

	// The list of keys on which this entity depends on.
	DependsOn []*string

	// The display name.
	DisplayName *string

	// The list of supported values.
	SupportedValues []*MetadataSupportedValueDetail
}

MetadataEntityProperties - The metadata entity properties

func (MetadataEntityProperties) MarshalJSON

func (m MetadataEntityProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MetadataEntityProperties.

func (*MetadataEntityProperties) UnmarshalJSON added in v1.1.0

func (m *MetadataEntityProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MetadataEntityProperties.

type MetadataSupportedValueDetail

type MetadataSupportedValueDetail struct {
	// The display name.
	DisplayName *string

	// The id.
	ID *string
}

MetadataSupportedValueDetail - The metadata supported value detail.

func (MetadataSupportedValueDetail) MarshalJSON added in v1.1.0

func (m MetadataSupportedValueDetail) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type MetadataSupportedValueDetail.

func (*MetadataSupportedValueDetail) UnmarshalJSON added in v1.1.0

func (m *MetadataSupportedValueDetail) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type MetadataSupportedValueDetail.

type OperationDisplayInfo

type OperationDisplayInfo struct {
	// The description of the operation.
	Description *string

	// The action that users can perform, based on their permission level.
	Operation *string

	// Service provider: Microsoft Advisor.
	Provider *string

	// Resource on which the operation is performed.
	Resource *string
}

OperationDisplayInfo - The operation supported by Advisor.

func (OperationDisplayInfo) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type OperationDisplayInfo.

func (*OperationDisplayInfo) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayInfo.

type OperationEntity

type OperationEntity struct {
	// The operation supported by Advisor.
	Display *OperationDisplayInfo

	// Operation name: {provider}/{resource}/{operation}.
	Name *string
}

OperationEntity - The operation supported by Advisor.

func (OperationEntity) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type OperationEntity.

func (*OperationEntity) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationEntity.

type OperationEntityListResult

type OperationEntityListResult struct {
	// The link used to get the next page of operations.
	NextLink *string

	// The list of operations.
	Value []*OperationEntity
}

OperationEntityListResult - The list of Advisor operations.

func (OperationEntityListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OperationEntityListResult.

func (*OperationEntityListResult) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationEntityListResult.

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 - Lists all the available Advisor REST API operations.

Generated from API version 2020-01-01

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

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 {
	// The list of Advisor operations.
	OperationEntityListResult
}

OperationsClientListResponse contains the response from method OperationsClient.NewListPager.

type RecommendationMetadataClient

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

RecommendationMetadataClient contains the methods for the RecommendationMetadata group. Don't use this type directly, use NewRecommendationMetadataClient() instead.

func NewRecommendationMetadataClient

func NewRecommendationMetadataClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RecommendationMetadataClient, error)

NewRecommendationMetadataClient creates a new instance of RecommendationMetadataClient with the specified values.

  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*RecommendationMetadataClient) Get

Get - Gets the metadata entity. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-01-01

  • name - Name of metadata entity.
  • options - RecommendationMetadataClientGetOptions contains the optional parameters for the RecommendationMetadataClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetRecommendationMetadataEntity.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewRecommendationMetadataClient().Get(ctx, "types", 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.MetadataEntity = armadvisor.MetadataEntity{
	// 	Name: to.Ptr("recommendationType"),
	// 	Type: to.Ptr("Microsoft.Advisor/metadata"),
	// 	ID: to.Ptr("providers/Microsoft.Advisor/metadata/recommendationType"),
	// 	Properties: &armadvisor.MetadataEntityProperties{
	// 		ApplicableScenarios: []*armadvisor.Scenario{
	// 			to.Ptr(armadvisor.ScenarioAlerts)},
	// 			DependsOn: []*string{
	// 				to.Ptr("category"),
	// 				to.Ptr("impact")},
	// 				DisplayName: to.Ptr("Recommendation Type"),
	// 				SupportedValues: []*armadvisor.MetadataSupportedValueDetail{
	// 					{
	// 						DisplayName: to.Ptr("Upgrade your SKU or add more instances to ensure fault tolerance"),
	// 						ID: to.Ptr("6a2b1e70-bd4c-4163-86de-5243d7ac05ee"),
	// 					},
	// 					{
	// 						DisplayName: to.Ptr("Delete ExpressRoute circuits in the provider status of Not Provisioned"),
	// 						ID: to.Ptr("da6630fb-4286-4996-92a3-a43f5f26dd34"),
	// 				}},
	// 			},
	// 		}
}
Output:

func (*RecommendationMetadataClient) NewListPager added in v0.4.0

NewListPager - Gets the list of metadata entities.

Generated from API version 2020-01-01

  • options - RecommendationMetadataClientListOptions contains the optional parameters for the RecommendationMetadataClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListRecommendationMetadata.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewRecommendationMetadataClient().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.MetadataEntityListResult = armadvisor.MetadataEntityListResult{
		// 	Value: []*armadvisor.MetadataEntity{
		// 		{
		// 			Name: to.Ptr("recommendationType"),
		// 			Type: to.Ptr("Microsoft.Advisor/metadata"),
		// 			ID: to.Ptr("providers/Microsoft.Advisor/metadata/recommendationType"),
		// 			Properties: &armadvisor.MetadataEntityProperties{
		// 				ApplicableScenarios: []*armadvisor.Scenario{
		// 					to.Ptr(armadvisor.ScenarioAlerts)},
		// 					DependsOn: []*string{
		// 						to.Ptr("category"),
		// 						to.Ptr("impact")},
		// 						DisplayName: to.Ptr("Recommendation Type"),
		// 						SupportedValues: []*armadvisor.MetadataSupportedValueDetail{
		// 							{
		// 								DisplayName: to.Ptr("Upgrade your SKU or add more instances to ensure fault tolerance"),
		// 								ID: to.Ptr("6a2b1e70-bd4c-4163-86de-5243d7ac05ee"),
		// 							},
		// 							{
		// 								DisplayName: to.Ptr("Delete ExpressRoute circuits in the provider status of Not Provisioned"),
		// 								ID: to.Ptr("da6630fb-4286-4996-92a3-a43f5f26dd34"),
		// 						}},
		// 					},
		// 				},
		// 				{
		// 					Name: to.Ptr("recommendationCategory"),
		// 					Type: to.Ptr("Microsoft.Advisor/metadata"),
		// 					ID: to.Ptr("providers/Microsoft.Advisor/metadata/recommendationCategory"),
		// 					Properties: &armadvisor.MetadataEntityProperties{
		// 						ApplicableScenarios: []*armadvisor.Scenario{
		// 							to.Ptr(armadvisor.ScenarioAlerts)},
		// 							DisplayName: to.Ptr("Category"),
		// 							SupportedValues: []*armadvisor.MetadataSupportedValueDetail{
		// 								{
		// 									DisplayName: to.Ptr("Cost"),
		// 									ID: to.Ptr("Cost"),
		// 								},
		// 								{
		// 									DisplayName: to.Ptr("Performance"),
		// 									ID: to.Ptr("Performance"),
		// 							}},
		// 						},
		// 					},
		// 					{
		// 						Name: to.Ptr("recommendationImpact"),
		// 						Type: to.Ptr("Microsoft.Advisor/metadata"),
		// 						ID: to.Ptr("providers/Microsoft.Advisor/metadata/recommendationImpact"),
		// 						Properties: &armadvisor.MetadataEntityProperties{
		// 							DisplayName: to.Ptr("Impact"),
		// 							SupportedValues: []*armadvisor.MetadataSupportedValueDetail{
		// 								{
		// 									DisplayName: to.Ptr("High"),
		// 									ID: to.Ptr("High"),
		// 								},
		// 								{
		// 									DisplayName: to.Ptr("Medium"),
		// 									ID: to.Ptr("Medium"),
		// 								},
		// 								{
		// 									DisplayName: to.Ptr("Low"),
		// 									ID: to.Ptr("Low"),
		// 							}},
		// 						},
		// 				}},
		// 			}
	}
}
Output:

type RecommendationMetadataClientGetOptions added in v0.2.0

type RecommendationMetadataClientGetOptions struct {
}

RecommendationMetadataClientGetOptions contains the optional parameters for the RecommendationMetadataClient.Get method.

type RecommendationMetadataClientGetResponse added in v0.2.0

type RecommendationMetadataClientGetResponse struct {
	// The metadata entity contract.
	MetadataEntity
}

RecommendationMetadataClientGetResponse contains the response from method RecommendationMetadataClient.Get.

type RecommendationMetadataClientListOptions added in v0.2.0

type RecommendationMetadataClientListOptions struct {
}

RecommendationMetadataClientListOptions contains the optional parameters for the RecommendationMetadataClient.NewListPager method.

type RecommendationMetadataClientListResponse added in v0.2.0

type RecommendationMetadataClientListResponse struct {
	// The list of metadata entities
	MetadataEntityListResult
}

RecommendationMetadataClientListResponse contains the response from method RecommendationMetadataClient.NewListPager.

type RecommendationProperties

type RecommendationProperties struct {
	// The list of recommended actions to implement recommendation.
	Actions []map[string]any

	// The category of the recommendation.
	Category *Category

	// The detailed description of recommendation.
	Description *string

	// The recommendation metadata properties exposed to customer to provide additional information.
	ExposedMetadataProperties map[string]any

	// Extended properties
	ExtendedProperties map[string]*string

	// The business impact of the recommendation.
	Impact *Impact

	// The resource type identified by Advisor.
	ImpactedField *string

	// The resource identified by Advisor.
	ImpactedValue *string

	// The label of recommendation.
	Label *string

	// The most recent time that Advisor checked the validity of the recommendation.
	LastUpdated *time.Time

	// The link to learn more about recommendation and generation logic.
	LearnMoreLink *string

	// The recommendation metadata.
	Metadata map[string]any

	// The potential benefit of implementing recommendation.
	PotentialBenefits *string

	// The recommendation-type GUID.
	RecommendationTypeID *string

	// The automated way to apply recommendation.
	Remediation map[string]any

	// Metadata of resource that was assessed
	ResourceMetadata *ResourceMetadata

	// The potential risk of not implementing the recommendation.
	Risk *Risk

	// A summary of the recommendation.
	ShortDescription *ShortDescription

	// The list of snoozed and dismissed rules for the recommendation.
	SuppressionIDs []*string
}

RecommendationProperties - The properties of the recommendation.

func (RecommendationProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type RecommendationProperties.

func (*RecommendationProperties) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type RecommendationProperties.

type RecommendationsClient

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

RecommendationsClient contains the methods for the Recommendations group. Don't use this type directly, use NewRecommendationsClient() instead.

func NewRecommendationsClient

func NewRecommendationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecommendationsClient, error)

NewRecommendationsClient creates a new instance of RecommendationsClient with the specified values.

  • subscriptionID - The Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*RecommendationsClient) Generate

Generate - Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-01-01

  • options - RecommendationsClientGenerateOptions contains the optional parameters for the RecommendationsClient.Generate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GenerateRecommendations.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewRecommendationsClient().Generate(ctx, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*RecommendationsClient) Get

func (client *RecommendationsClient) Get(ctx context.Context, resourceURI string, recommendationID string, options *RecommendationsClientGetOptions) (RecommendationsClientGetResponse, error)

Get - Obtains details of a cached recommendation. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-01-01

  • resourceURI - The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies.
  • recommendationID - The recommendation ID.
  • options - RecommendationsClientGetOptions contains the optional parameters for the RecommendationsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetRecommendationDetail.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewRecommendationsClient().Get(ctx, "resourceUri", "recommendationId", 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.ResourceRecommendationBase = armadvisor.ResourceRecommendationBase{
	// 	Name: to.Ptr("recommendationId"),
	// 	Type: to.Ptr("Microsoft.Advisor/recommendations"),
	// 	ID: to.Ptr("/resourceUri/providers/Microsoft.Advisor/recommendations/recommendationId"),
	// 	Properties: &armadvisor.RecommendationProperties{
	// 		Description: to.Ptr("After enabling Soft Delete, deleted data transitions to a soft deleted state instead of being permanently deleted. When data is overwritten, a soft deleted snapshot is generated to save the state of the overwritten data. You can configure the amount of time soft deleted data is recoverable before it permanently expires."),
	// 		Actions: []map[string]any{
	// 			map[string]any{
	// 				"description": "Enable Soft Delete to protect blob data",
	// 				"actionType": "Document",
	// 				"caption": "Enable Soft Delete to protect blob data",
	// 				"link": "https://link1",
	// 				"metadata": map[string]any{
	// 					"id": "/subscriptions/subscriptionId",
	// 				},
	// 		}},
	// 		Category: to.Ptr(armadvisor.CategorySecurity),
	// 		Impact: to.Ptr(armadvisor.ImpactMedium),
	// 		ImpactedField: to.Ptr("Microsoft.Compute/virtualMachines"),
	// 		ImpactedValue: to.Ptr("armavset"),
	// 		Label: to.Ptr("Enable Soft Delete"),
	// 		LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-24T22:24:43.321Z"); return t}()),
	// 		LearnMoreLink: to.Ptr("https://link2"),
	// 		PotentialBenefits: to.Ptr("Save and recover your data when blobs or blob snapshots are accidentally overwritten or deleted"),
	// 		Remediation: map[string]any{
	// 			"httpMethod": "POST",
	// 			"uri": "uri",
	// 			"details": "link to document",
	// 		},
	// 		ResourceMetadata: &armadvisor.ResourceMetadata{
	// 			Action: map[string]any{
	// 				"description": "Enable Soft Delete to protect blob data",
	// 				"actionType": "Document",
	// 				"caption": "Enable Soft Delete to protect blob data",
	// 				"link": "https://link3",
	// 				"metadata": map[string]any{
	// 					"id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/xyz",
	// 				},
	// 			},
	// 			Plural: to.Ptr("Virtual machines"),
	// 			ResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/xyz"),
	// 			Singular: to.Ptr("Virtual machine"),
	// 			Source: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/xyz/providers/Microsoft.Security/assessments/assessmentGuid"),
	// 		},
	// 		Risk: to.Ptr(armadvisor.RiskWarning),
	// 		ShortDescription: &armadvisor.ShortDescription{
	// 			Problem: to.Ptr("Monitoring agent is not installed on your machines"),
	// 			Solution: to.Ptr("Monitoring agent should be installed on your machines"),
	// 		},
	// 	},
	// }
}
Output:

func (*RecommendationsClient) GetGenerateStatus

GetGenerateStatus - Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-01-01

  • operationID - The operation ID, which can be found from the Location field in the generate recommendation response header.
  • options - RecommendationsClientGetGenerateStatusOptions contains the optional parameters for the RecommendationsClient.GetGenerateStatus method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/EmptyResponse.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewRecommendationsClient().GetGenerateStatus(ctx, "operationGUID", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*RecommendationsClient) NewListPager added in v0.4.0

NewListPager - Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations.

Generated from API version 2020-01-01

  • options - RecommendationsClientListOptions contains the optional parameters for the RecommendationsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListRecommendations.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/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewRecommendationsClient().NewListPager(&armadvisor.RecommendationsClientListOptions{Filter: nil,
		Top:       to.Ptr[int32](10),
		SkipToken: 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.ResourceRecommendationBaseListResult = armadvisor.ResourceRecommendationBaseListResult{
		// 	Value: []*armadvisor.ResourceRecommendationBase{
		// 		{
		// 			Name: to.Ptr("recGUID1"),
		// 			Type: to.Ptr("Microsoft.Advisor/recommendations"),
		// 			ID: to.Ptr("/resourceUri/providers/Microsoft.Advisor/recommendations/recGUID1"),
		// 			Properties: &armadvisor.RecommendationProperties{
		// 				Description: to.Ptr("After enabling Soft Delete, deleted data transitions to a soft deleted state instead of being permanently deleted. When data is overwritten, a soft deleted snapshot is generated to save the state of the overwritten data. You can configure the amount of time soft deleted data is recoverable before it permanently expires."),
		// 				Actions: []map[string]any{
		// 					map[string]any{
		// 						"description": "Enable Soft Delete to protect blob data",
		// 						"actionType": "Document",
		// 						"caption": "Enable Soft Delete to protect blob data",
		// 						"link": "https://link1",
		// 						"metadata": map[string]any{
		// 							"id": "/subscriptions/subscriptionId",
		// 						},
		// 				}},
		// 				Category: to.Ptr(armadvisor.CategoryHighAvailability),
		// 				Impact: to.Ptr(armadvisor.ImpactMedium),
		// 				ImpactedField: to.Ptr("Microsoft.Compute/availabilitySets"),
		// 				ImpactedValue: to.Ptr("armavset"),
		// 				Label: to.Ptr("Enable Soft Delete"),
		// 				LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-24T22:24:43.321Z"); return t}()),
		// 				LearnMoreLink: to.Ptr("https://link2"),
		// 				PotentialBenefits: to.Ptr("Save and recover your data when blobs or blob snapshots are accidentally overwritten or deleted"),
		// 				Remediation: map[string]any{
		// 					"httpMethod": "POST",
		// 					"uri": "uri",
		// 					"details": "link to document",
		// 				},
		// 				ResourceMetadata: &armadvisor.ResourceMetadata{
		// 					Action: map[string]any{
		// 						"description": "Enable Soft Delete to protect blob data",
		// 						"actionType": "Document",
		// 						"caption": "Enable Soft Delete to protect blob data",
		// 						"link": "https://link3",
		// 						"metadata": map[string]any{
		// 							"id": "/subscriptions/subscriptionId",
		// 						},
		// 					},
		// 					Plural: to.Ptr("Availability sets"),
		// 					ResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/availabilitysets/abc"),
		// 					Singular: to.Ptr("Availability set"),
		// 				},
		// 				Risk: to.Ptr(armadvisor.RiskWarning),
		// 				ShortDescription: &armadvisor.ShortDescription{
		// 					Problem: to.Ptr("This availability set is not configured for fault tolerance"),
		// 					Solution: to.Ptr("To ensure high availability add one or more virtual machines to this availability set"),
		// 				},
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("recGUID2"),
		// 			Type: to.Ptr("Microsoft.Advisor/recommendations"),
		// 			ID: to.Ptr("/resourceUri/providers/Microsoft.Advisor/recommendations/recGUID2"),
		// 			Properties: &armadvisor.RecommendationProperties{
		// 				Description: to.Ptr("Monitoring agent should be installed on your machines."),
		// 				Actions: []map[string]any{
		// 					map[string]any{
		// 						"description": "Enable Soft Delete to protect blob data",
		// 						"actionType": "Document",
		// 						"caption": "Enable Soft Delete to protect blob data",
		// 						"link": "https://link1",
		// 						"metadata": map[string]any{
		// 							"id": "/subscriptions/subscriptionId",
		// 						},
		// 				}},
		// 				Category: to.Ptr(armadvisor.CategorySecurity),
		// 				Impact: to.Ptr(armadvisor.ImpactMedium),
		// 				ImpactedField: to.Ptr("Microsoft.Compute/virtualMachines"),
		// 				ImpactedValue: to.Ptr("armavset"),
		// 				Label: to.Ptr("Enable monitoring agent"),
		// 				LastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-02-24T22:24:43.321Z"); return t}()),
		// 				LearnMoreLink: to.Ptr("https://link2"),
		// 				PotentialBenefits: to.Ptr("Protect and monitor machine"),
		// 				ResourceMetadata: &armadvisor.ResourceMetadata{
		// 					Action: map[string]any{
		// 						"description": "Enable Soft Delete to protect blob data",
		// 						"actionType": "Document",
		// 						"caption": "Enable Soft Delete to protect blob data",
		// 						"link": "https://link3",
		// 						"metadata": map[string]any{
		// 							"id": "/subscriptions/subscriptionId",
		// 						},
		// 					},
		// 					Plural: to.Ptr("Virtual machines"),
		// 					ResourceID: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/xyz"),
		// 					Singular: to.Ptr("Virtual machine"),
		// 					Source: to.Ptr("/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.Compute/virtualMachines/xyz/providers/Microsoft.Security/assessments/assessmentGuid"),
		// 				},
		// 				Risk: to.Ptr(armadvisor.RiskWarning),
		// 				ShortDescription: &armadvisor.ShortDescription{
		// 					Problem: to.Ptr("Monitoring agent is not installed on your machines"),
		// 					Solution: to.Ptr("Monitoring agent should be installed on your machines"),
		// 				},
		// 			},
		// 	}},
		// }
	}
}
Output:

type RecommendationsClientGenerateOptions added in v0.2.0

type RecommendationsClientGenerateOptions struct {
}

RecommendationsClientGenerateOptions contains the optional parameters for the RecommendationsClient.Generate method.

type RecommendationsClientGenerateResponse added in v0.2.0

type RecommendationsClientGenerateResponse struct {
	// Location contains the information returned from the Location header response.
	Location *string

	// RetryAfter contains the information returned from the Retry-After header response.
	RetryAfter *string
}

RecommendationsClientGenerateResponse contains the response from method RecommendationsClient.Generate.

type RecommendationsClientGetGenerateStatusOptions added in v0.2.0

type RecommendationsClientGetGenerateStatusOptions struct {
}

RecommendationsClientGetGenerateStatusOptions contains the optional parameters for the RecommendationsClient.GetGenerateStatus method.

type RecommendationsClientGetGenerateStatusResponse added in v0.2.0

type RecommendationsClientGetGenerateStatusResponse struct {
}

RecommendationsClientGetGenerateStatusResponse contains the response from method RecommendationsClient.GetGenerateStatus.

type RecommendationsClientGetOptions added in v0.2.0

type RecommendationsClientGetOptions struct {
}

RecommendationsClientGetOptions contains the optional parameters for the RecommendationsClient.Get method.

type RecommendationsClientGetResponse added in v0.2.0

type RecommendationsClientGetResponse struct {
	// Advisor Recommendation.
	ResourceRecommendationBase
}

RecommendationsClientGetResponse contains the response from method RecommendationsClient.Get.

type RecommendationsClientListOptions added in v0.2.0

type RecommendationsClientListOptions struct {
	// The filter to apply to the recommendations.
	// Filter can be applied to properties ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', 'Category'] with operators
	// ['eq', 'and', 'or'].
	// Example:
	// - $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'
	Filter *string

	// The page-continuation token to use with a paged version of this API.
	SkipToken *string

	// The number of recommendations per page if a paged version of this API is being used.
	Top *int32
}

RecommendationsClientListOptions contains the optional parameters for the RecommendationsClient.NewListPager method.

type RecommendationsClientListResponse added in v0.2.0

type RecommendationsClientListResponse struct {
	// The list of Advisor recommendations.
	ResourceRecommendationBaseListResult
}

RecommendationsClientListResponse contains the response from method RecommendationsClient.NewListPager.

type Resource

type Resource struct {
	// READ-ONLY; The resource ID.
	ID *string

	// READ-ONLY; The name of the resource.
	Name *string

	// READ-ONLY; The type of the resource.
	Type *string
}

Resource - An Azure resource.

func (Resource) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type Resource.

func (*Resource) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Resource.

type ResourceMetadata

type ResourceMetadata struct {
	// The action to view resource.
	Action map[string]any

	// The plural user friendly name of resource type. eg: virtual machines
	Plural *string

	// Azure resource Id of the assessed resource
	ResourceID *string

	// The singular user friendly name of resource type. eg: virtual machine
	Singular *string

	// Source from which recommendation is generated
	Source *string
}

ResourceMetadata - Recommendation resource metadata

func (ResourceMetadata) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ResourceMetadata.

func (*ResourceMetadata) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceMetadata.

type ResourceRecommendationBase

type ResourceRecommendationBase struct {
	// The properties of the recommendation.
	Properties *RecommendationProperties

	// READ-ONLY; The resource ID.
	ID *string

	// READ-ONLY; The name of the resource.
	Name *string

	// READ-ONLY; The type of the resource.
	Type *string
}

ResourceRecommendationBase - Advisor Recommendation.

func (ResourceRecommendationBase) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type ResourceRecommendationBase.

func (*ResourceRecommendationBase) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceRecommendationBase.

type ResourceRecommendationBaseListResult

type ResourceRecommendationBaseListResult struct {
	// The link used to get the next page of recommendations.
	NextLink *string

	// The list of recommendations.
	Value []*ResourceRecommendationBase
}

ResourceRecommendationBaseListResult - The list of Advisor recommendations.

func (ResourceRecommendationBaseListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ResourceRecommendationBaseListResult.

func (*ResourceRecommendationBaseListResult) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ResourceRecommendationBaseListResult.

type Risk

type Risk string

Risk - The potential risk of not implementing the recommendation.

const (
	RiskError   Risk = "Error"
	RiskNone    Risk = "None"
	RiskWarning Risk = "Warning"
)

func PossibleRiskValues

func PossibleRiskValues() []Risk

PossibleRiskValues returns the possible values for the Risk const type.

type Scenario

type Scenario string
const (
	ScenarioAlerts Scenario = "Alerts"
)

func PossibleScenarioValues

func PossibleScenarioValues() []Scenario

PossibleScenarioValues returns the possible values for the Scenario const type.

type ShortDescription

type ShortDescription struct {
	// The issue or opportunity identified by the recommendation.
	Problem *string

	// The remediation action suggested by the recommendation.
	Solution *string
}

ShortDescription - A summary of the recommendation.

func (ShortDescription) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type ShortDescription.

func (*ShortDescription) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ShortDescription.

type SuppressionContract

type SuppressionContract struct {
	// The properties of the suppression.
	Properties *SuppressionProperties

	// READ-ONLY; The resource ID.
	ID *string

	// READ-ONLY; The name of the resource.
	Name *string

	// READ-ONLY; The type of the resource.
	Type *string
}

SuppressionContract - The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule.

func (SuppressionContract) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type SuppressionContract.

func (*SuppressionContract) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type SuppressionContract.

type SuppressionContractListResult

type SuppressionContractListResult struct {
	// The link used to get the next page of suppressions.
	NextLink *string

	// The list of suppressions.
	Value []*SuppressionContract
}

SuppressionContractListResult - The list of Advisor suppressions.

func (SuppressionContractListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SuppressionContractListResult.

func (*SuppressionContractListResult) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type SuppressionContractListResult.

type SuppressionProperties

type SuppressionProperties struct {
	// The GUID of the suppression.
	SuppressionID *string

	// The duration for which the suppression is valid.
	TTL *string

	// READ-ONLY; Gets or sets the expiration time stamp.
	ExpirationTimeStamp *time.Time
}

SuppressionProperties - The properties of the suppression.

func (SuppressionProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SuppressionProperties.

func (*SuppressionProperties) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SuppressionProperties.

type SuppressionsClient

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

SuppressionsClient contains the methods for the Suppressions group. Don't use this type directly, use NewSuppressionsClient() instead.

func NewSuppressionsClient

func NewSuppressionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SuppressionsClient, error)

NewSuppressionsClient creates a new instance of SuppressionsClient with the specified values.

  • subscriptionID - The Azure subscription ID.
  • credential - used to authorize requests. Usually a credential from azidentity.
  • options - pass nil to accept the default values.

func (*SuppressionsClient) Create

func (client *SuppressionsClient) Create(ctx context.Context, resourceURI string, recommendationID string, name string, suppressionContract SuppressionContract, options *SuppressionsClientCreateOptions) (SuppressionsClientCreateResponse, error)

Create - Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-01-01

  • resourceURI - The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies.
  • recommendationID - The recommendation ID.
  • name - The name of the suppression.
  • suppressionContract - The snoozed or dismissed attribute; for example, the snooze duration.
  • options - SuppressionsClientCreateOptions contains the optional parameters for the SuppressionsClient.Create method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateSuppression.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/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSuppressionsClient().Create(ctx, "resourceUri", "recommendationId", "suppressionName1", armadvisor.SuppressionContract{
		Properties: &armadvisor.SuppressionProperties{
			TTL: to.Ptr("07:00:00:00"),
		},
	}, 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.SuppressionContract = armadvisor.SuppressionContract{
	// 	Name: to.Ptr("suppressionName1"),
	// 	Type: to.Ptr("Microsoft.Advisor/suppressions"),
	// 	ID: to.Ptr("/resourceUri/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/suppressionName1"),
	// 	Properties: &armadvisor.SuppressionProperties{
	// 		SuppressionID: to.Ptr("suppressionId"),
	// 		TTL: to.Ptr("07:00:00:00"),
	// 	},
	// }
}
Output:

func (*SuppressionsClient) Delete

func (client *SuppressionsClient) Delete(ctx context.Context, resourceURI string, recommendationID string, name string, options *SuppressionsClientDeleteOptions) (SuppressionsClientDeleteResponse, error)

Delete - Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-01-01

  • resourceURI - The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies.
  • recommendationID - The recommendation ID.
  • name - The name of the suppression.
  • options - SuppressionsClientDeleteOptions contains the optional parameters for the SuppressionsClient.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/DeleteSuppression.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewSuppressionsClient().Delete(ctx, "resourceUri", "recommendationId", "suppressionName1", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*SuppressionsClient) Get

func (client *SuppressionsClient) Get(ctx context.Context, resourceURI string, recommendationID string, name string, options *SuppressionsClientGetOptions) (SuppressionsClientGetResponse, error)

Get - Obtains the details of a suppression. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2020-01-01

  • resourceURI - The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies.
  • recommendationID - The recommendation ID.
  • name - The name of the suppression.
  • options - SuppressionsClientGetOptions contains the optional parameters for the SuppressionsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetSuppressionDetail.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSuppressionsClient().Get(ctx, "resourceUri", "recommendationId", "suppressionName1", 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.SuppressionContract = armadvisor.SuppressionContract{
	// 	Name: to.Ptr("suppressionName1"),
	// 	Type: to.Ptr("Microsoft.Advisor/suppressions"),
	// 	ID: to.Ptr("/resourceUri/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/suppressionName1"),
	// 	Properties: &armadvisor.SuppressionProperties{
	// 		ExpirationTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-25T22:24:43.321Z"); return t}()),
	// 		SuppressionID: to.Ptr("suppressionId1"),
	// 		TTL: to.Ptr("7.00:00:00"),
	// 	},
	// }
}
Output:

func (*SuppressionsClient) NewListPager added in v0.4.0

NewListPager - Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression.

Generated from API version 2020-01-01

  • options - SuppressionsClientListOptions contains the optional parameters for the SuppressionsClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListSuppressions.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/advisor/armadvisor"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armadvisor.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewSuppressionsClient().NewListPager(&armadvisor.SuppressionsClientListOptions{Top: nil,
		SkipToken: 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.SuppressionContractListResult = armadvisor.SuppressionContractListResult{
		// 	Value: []*armadvisor.SuppressionContract{
		// 		{
		// 			Name: to.Ptr("suppressionName1"),
		// 			Type: to.Ptr("Microsoft.Advisor/suppressions"),
		// 			ID: to.Ptr("/resourceUri/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/suppressionName1"),
		// 			Properties: &armadvisor.SuppressionProperties{
		// 				ExpirationTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-24T22:24:43.321Z"); return t}()),
		// 				SuppressionID: to.Ptr("suppressionId1"),
		// 				TTL: to.Ptr("7.00:00:00"),
		// 			},
		// 		},
		// 		{
		// 			Name: to.Ptr("suppressionName2"),
		// 			Type: to.Ptr("Microsoft.Advisor/suppressions"),
		// 			ID: to.Ptr("/resourceUri/providers/Microsoft.Advisor/recommendations/recommendationId/suppressions/suppressionName2"),
		// 			Properties: &armadvisor.SuppressionProperties{
		// 				ExpirationTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-25T22:24:43.321Z"); return t}()),
		// 				SuppressionID: to.Ptr("suppressionId2"),
		// 				TTL: to.Ptr("7.00:00:00"),
		// 			},
		// 	}},
		// }
	}
}
Output:

type SuppressionsClientCreateOptions added in v0.2.0

type SuppressionsClientCreateOptions struct {
}

SuppressionsClientCreateOptions contains the optional parameters for the SuppressionsClient.Create method.

type SuppressionsClientCreateResponse added in v0.2.0

type SuppressionsClientCreateResponse struct {
	// The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule.
	SuppressionContract
}

SuppressionsClientCreateResponse contains the response from method SuppressionsClient.Create.

type SuppressionsClientDeleteOptions added in v0.2.0

type SuppressionsClientDeleteOptions struct {
}

SuppressionsClientDeleteOptions contains the optional parameters for the SuppressionsClient.Delete method.

type SuppressionsClientDeleteResponse added in v0.2.0

type SuppressionsClientDeleteResponse struct {
}

SuppressionsClientDeleteResponse contains the response from method SuppressionsClient.Delete.

type SuppressionsClientGetOptions added in v0.2.0

type SuppressionsClientGetOptions struct {
}

SuppressionsClientGetOptions contains the optional parameters for the SuppressionsClient.Get method.

type SuppressionsClientGetResponse added in v0.2.0

type SuppressionsClientGetResponse struct {
	// The details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with the rule.
	SuppressionContract
}

SuppressionsClientGetResponse contains the response from method SuppressionsClient.Get.

type SuppressionsClientListOptions added in v0.2.0

type SuppressionsClientListOptions struct {
	// The page-continuation token to use with a paged version of this API.
	SkipToken *string

	// The number of suppressions per page if a paged version of this API is being used.
	Top *int32
}

SuppressionsClientListOptions contains the optional parameters for the SuppressionsClient.NewListPager method.

type SuppressionsClientListResponse added in v0.2.0

type SuppressionsClientListResponse struct {
	// The list of Advisor suppressions.
	SuppressionContractListResult
}

SuppressionsClientListResponse contains the response from method SuppressionsClient.NewListPager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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