armadvisor

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 17 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

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.

Clients

Azure Advisor modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential.

client,err := armadvisor.NewSuppressionsClient(<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,
    },
}
client, err := armadvisor.NewSuppressionsClient(<subscription ID>, cred, &options)

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 `json:"code,omitempty"`

	// Gets or sets the string that describes the error in detail and provides debugging information.
	Message *string `json:"message,omitempty"`
}

ARMErrorResponseBody - ARM error response body.

type ArmErrorResponse

type ArmErrorResponse struct {
	// ARM error response body.
	Error *ARMErrorResponseBody `json:"error,omitempty"`
}

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 ConfigData

type ConfigData struct {
	// The Advisor configuration data structure.
	Properties *ConfigDataProperties `json:"properties,omitempty"`

	// READ-ONLY; The resource ID.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The name of the resource.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The type of the resource.
	Type *string `json:"type,omitempty" azure:"ro"`
}

ConfigData - The Advisor configuration data structure.

type ConfigDataProperties

type ConfigDataProperties struct {
	// Advisor digest configuration. Valid only for subscriptions
	Digests []*DigestConfig `json:"digests,omitempty"`

	// Exclude the resource from Advisor evaluations. Valid values: False (default) or True.
	Exclude *bool `json:"exclude,omitempty"`

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

ConfigDataProperties - Configuration data properties

func (ConfigDataProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ConfigDataProperties.

type ConfigurationListResult

type ConfigurationListResult struct {
	// The link used to get the next page of configurations.
	NextLink *string `json:"nextLink,omitempty"`

	// The list of configurations.
	Value []*ConfigData `json:"value,omitempty"`
}

ConfigurationListResult - The list of Advisor configurations.

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.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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()
	client, err := armadvisor.NewConfigurationsClient("subscriptionId", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.CreateInResourceGroup(ctx,
		armadvisor.ConfigurationNameDefault,
		"resourceGroup",
		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)
	}
	// TODO: use response item
	_ = res
}
Output:

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/tree/main/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()
	client, err := armadvisor.NewConfigurationsClient("subscriptionId", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.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)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*ConfigurationsClient) NewListByResourceGroupPager added in v0.4.0

NewListByResourceGroupPager - Retrieve Azure Advisor configurations. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-01-01 resourceGroup - The name of the Azure resource group. options - ConfigurationsClientListByResourceGroupOptions contains the optional parameters for the ConfigurationsClient.ListByResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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()
	client, err := armadvisor.NewConfigurationsClient("subscriptionId", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListByResourceGroupPager("resourceGroup",
		nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*ConfigurationsClient) NewListBySubscriptionPager added in v0.4.0

NewListBySubscriptionPager - Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-01-01 options - ConfigurationsClientListBySubscriptionOptions contains the optional parameters for the ConfigurationsClient.ListBySubscription method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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()
	client, err := armadvisor.NewConfigurationsClient("subscriptionId", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListBySubscriptionPager(nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
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 {
	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 {
	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.ListByResourceGroup method.

type ConfigurationsClientListByResourceGroupResponse added in v0.2.0

type ConfigurationsClientListByResourceGroupResponse struct {
	ConfigurationListResult
}

ConfigurationsClientListByResourceGroupResponse contains the response from method ConfigurationsClient.ListByResourceGroup.

type ConfigurationsClientListBySubscriptionOptions added in v0.2.0

type ConfigurationsClientListBySubscriptionOptions struct {
}

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

type ConfigurationsClientListBySubscriptionResponse added in v0.2.0

type ConfigurationsClientListBySubscriptionResponse struct {
	ConfigurationListResult
}

ConfigurationsClientListBySubscriptionResponse contains the response from method ConfigurationsClient.ListBySubscription.

type DigestConfig

type DigestConfig struct {
	// Action group resource id used by digest.
	ActionGroupResourceID *string `json:"actionGroupResourceId,omitempty"`

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

	// Frequency that digest will be triggered, in days. Value must be between 7 and 30 days inclusive.
	Frequency *int32 `json:"frequency,omitempty"`

	// 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 `json:"language,omitempty"`

	// Name of digest configuration. Value is case-insensitive and must be unique within a subscription.
	Name *string `json:"name,omitempty"`

	// State of digest configuration.
	State *DigestConfigState `json:"state,omitempty"`
}

DigestConfig - Advisor Digest configuration entity

func (DigestConfig) MarshalJSON

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

MarshalJSON implements the json.Marshaller 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 `json:"id,omitempty"`

	// The name of the metadata entity.
	Name *string `json:"name,omitempty"`

	// The metadata entity properties.
	Properties *MetadataEntityProperties `json:"properties,omitempty"`

	// The type of the metadata entity.
	Type *string `json:"type,omitempty"`
}

MetadataEntity - The metadata entity contract.

type MetadataEntityListResult

type MetadataEntityListResult struct {
	// The link used to get the next page of metadata.
	NextLink *string `json:"nextLink,omitempty"`

	// The list of metadata entities.
	Value []*MetadataEntity `json:"value,omitempty"`
}

MetadataEntityListResult - The list of metadata entities

type MetadataEntityProperties

type MetadataEntityProperties struct {
	// The list of scenarios applicable to this metadata entity.
	ApplicableScenarios []*Scenario `json:"applicableScenarios,omitempty"`

	// The list of keys on which this entity depends on.
	DependsOn []*string `json:"dependsOn,omitempty"`

	// The display name.
	DisplayName *string `json:"displayName,omitempty"`

	// The list of supported values.
	SupportedValues []*MetadataSupportedValueDetail `json:"supportedValues,omitempty"`
}

MetadataEntityProperties - The metadata entity properties

type MetadataSupportedValueDetail

type MetadataSupportedValueDetail struct {
	// The display name.
	DisplayName *string `json:"displayName,omitempty"`

	// The id.
	ID *string `json:"id,omitempty"`
}

MetadataSupportedValueDetail - The metadata supported value detail.

type OperationDisplayInfo

type OperationDisplayInfo struct {
	// The description of the operation.
	Description *string `json:"description,omitempty"`

	// The action that users can perform, based on their permission level.
	Operation *string `json:"operation,omitempty"`

	// Service provider: Microsoft Advisor.
	Provider *string `json:"provider,omitempty"`

	// Resource on which the operation is performed.
	Resource *string `json:"resource,omitempty"`
}

OperationDisplayInfo - The operation supported by Advisor.

type OperationEntity

type OperationEntity struct {
	// The operation supported by Advisor.
	Display *OperationDisplayInfo `json:"display,omitempty"`

	// Operation name: {provider}/{resource}/{operation}.
	Name *string `json:"name,omitempty"`
}

OperationEntity - The operation supported by Advisor.

type OperationEntityListResult

type OperationEntityListResult struct {
	// The link used to get the next page of operations.
	NextLink *string `json:"nextLink,omitempty"`

	// The list of operations.
	Value []*OperationEntity `json:"value,omitempty"`
}

OperationEntityListResult - The list of Advisor operations.

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. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-01-01 options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method.

type OperationsClientListOptions added in v0.2.0

type OperationsClientListOptions struct {
}

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

type OperationsClientListResponse added in v0.2.0

type OperationsClientListResponse struct {
	OperationEntityListResult
}

OperationsClientListResponse contains the response from method OperationsClient.List.

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/tree/main/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()
	client, err := armadvisor.NewRecommendationMetadataClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"types",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*RecommendationMetadataClient) NewListPager added in v0.4.0

NewListPager - Gets the list of metadata entities. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-01-01 options - RecommendationMetadataClientListOptions contains the optional parameters for the RecommendationMetadataClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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()
	client, err := armadvisor.NewRecommendationMetadataClient(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager(nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
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 {
	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.List method.

type RecommendationMetadataClientListResponse added in v0.2.0

type RecommendationMetadataClientListResponse struct {
	MetadataEntityListResult
}

RecommendationMetadataClientListResponse contains the response from method RecommendationMetadataClient.List.

type RecommendationProperties

type RecommendationProperties struct {
	// The list of recommended actions to implement recommendation.
	Actions []map[string]interface{} `json:"actions,omitempty"`

	// The category of the recommendation.
	Category *Category `json:"category,omitempty"`

	// The detailed description of recommendation.
	Description *string `json:"description,omitempty"`

	// The recommendation metadata properties exposed to customer to provide additional information.
	ExposedMetadataProperties map[string]interface{} `json:"exposedMetadataProperties,omitempty"`

	// Extended properties
	ExtendedProperties map[string]*string `json:"extendedProperties,omitempty"`

	// The business impact of the recommendation.
	Impact *Impact `json:"impact,omitempty"`

	// The resource type identified by Advisor.
	ImpactedField *string `json:"impactedField,omitempty"`

	// The resource identified by Advisor.
	ImpactedValue *string `json:"impactedValue,omitempty"`

	// The label of recommendation.
	Label *string `json:"label,omitempty"`

	// The most recent time that Advisor checked the validity of the recommendation.
	LastUpdated *time.Time `json:"lastUpdated,omitempty"`

	// The link to learn more about recommendation and generation logic.
	LearnMoreLink *string `json:"learnMoreLink,omitempty"`

	// The recommendation metadata.
	Metadata map[string]interface{} `json:"metadata,omitempty"`

	// The potential benefit of implementing recommendation.
	PotentialBenefits *string `json:"potentialBenefits,omitempty"`

	// The recommendation-type GUID.
	RecommendationTypeID *string `json:"recommendationTypeId,omitempty"`

	// The automated way to apply recommendation.
	Remediation map[string]interface{} `json:"remediation,omitempty"`

	// Metadata of resource that was assessed
	ResourceMetadata *ResourceMetadata `json:"resourceMetadata,omitempty"`

	// The potential risk of not implementing the recommendation.
	Risk *Risk `json:"risk,omitempty"`

	// A summary of the recommendation.
	ShortDescription *ShortDescription `json:"shortDescription,omitempty"`

	// The list of snoozed and dismissed rules for the recommendation.
	SuppressionIDs []*string `json:"suppressionIds,omitempty"`
}

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/tree/main/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()
	client, err := armadvisor.NewRecommendationsClient("subscriptionId", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = client.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/tree/main/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()
	client, err := armadvisor.NewRecommendationsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"resourceUri",
		"recommendationId",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
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/tree/main/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()
	client, err := armadvisor.NewRecommendationsClient("subscriptionId", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = client.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. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-01-01 options - RecommendationsClientListOptions contains the optional parameters for the RecommendationsClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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()
	client, err := armadvisor.NewRecommendationsClient("subscriptionId", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager(&armadvisor.RecommendationsClientListOptions{Filter: nil,
		Top:       to.Ptr[int32](10),
		SkipToken: nil,
	})
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
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 {
	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.List method.

type RecommendationsClientListResponse added in v0.2.0

type RecommendationsClientListResponse struct {
	ResourceRecommendationBaseListResult
}

RecommendationsClientListResponse contains the response from method RecommendationsClient.List.

type Resource

type Resource struct {
	// READ-ONLY; The resource ID.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The name of the resource.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The type of the resource.
	Type *string `json:"type,omitempty" azure:"ro"`
}

Resource - An Azure resource.

type ResourceMetadata

type ResourceMetadata struct {
	// The action to view resource.
	Action map[string]interface{} `json:"action,omitempty"`

	// The plural user friendly name of resource type. eg: virtual machines
	Plural *string `json:"plural,omitempty"`

	// Azure resource Id of the assessed resource
	ResourceID *string `json:"resourceId,omitempty"`

	// The singular user friendly name of resource type. eg: virtual machine
	Singular *string `json:"singular,omitempty"`

	// Source from which recommendation is generated
	Source *string `json:"source,omitempty"`
}

ResourceMetadata - Recommendation resource metadata

func (ResourceMetadata) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ResourceMetadata.

type ResourceRecommendationBase

type ResourceRecommendationBase struct {
	// The properties of the recommendation.
	Properties *RecommendationProperties `json:"properties,omitempty"`

	// READ-ONLY; The resource ID.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The name of the resource.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The type of the resource.
	Type *string `json:"type,omitempty" azure:"ro"`
}

ResourceRecommendationBase - Advisor Recommendation.

type ResourceRecommendationBaseListResult

type ResourceRecommendationBaseListResult struct {
	// The link used to get the next page of recommendations.
	NextLink *string `json:"nextLink,omitempty"`

	// The list of recommendations.
	Value []*ResourceRecommendationBase `json:"value,omitempty"`
}

ResourceRecommendationBaseListResult - The list of Advisor recommendations.

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 `json:"problem,omitempty"`

	// The remediation action suggested by the recommendation.
	Solution *string `json:"solution,omitempty"`
}

ShortDescription - A summary of the recommendation.

type SuppressionContract

type SuppressionContract struct {
	// The properties of the suppression.
	Properties *SuppressionProperties `json:"properties,omitempty"`

	// READ-ONLY; The resource ID.
	ID *string `json:"id,omitempty" azure:"ro"`

	// READ-ONLY; The name of the resource.
	Name *string `json:"name,omitempty" azure:"ro"`

	// READ-ONLY; The type of the resource.
	Type *string `json:"type,omitempty" azure:"ro"`
}

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

type SuppressionContractListResult

type SuppressionContractListResult struct {
	// The link used to get the next page of suppressions.
	NextLink *string `json:"nextLink,omitempty"`

	// The list of suppressions.
	Value []*SuppressionContract `json:"value,omitempty"`
}

SuppressionContractListResult - The list of Advisor suppressions.

type SuppressionProperties

type SuppressionProperties struct {
	// The GUID of the suppression.
	SuppressionID *string `json:"suppressionId,omitempty"`

	// The duration for which the suppression is valid.
	TTL *string `json:"ttl,omitempty"`

	// READ-ONLY; Gets or sets the expiration time stamp.
	ExpirationTimeStamp *time.Time `json:"expirationTimeStamp,omitempty" azure:"ro"`
}

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/tree/main/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()
	client, err := armadvisor.NewSuppressionsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.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)
	}
	// TODO: use response item
	_ = res
}
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/tree/main/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()
	client, err := armadvisor.NewSuppressionsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = client.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/tree/main/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()
	client, err := armadvisor.NewSuppressionsClient("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"resourceUri",
		"recommendationId",
		"suppressionName1",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
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. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2020-01-01 options - SuppressionsClientListOptions contains the optional parameters for the SuppressionsClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/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()
	client, err := armadvisor.NewSuppressionsClient("subscriptionId1", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager(&armadvisor.SuppressionsClientListOptions{Top: nil,
		SkipToken: nil,
	})
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
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 {
	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 {
	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.List method.

type SuppressionsClientListResponse added in v0.2.0

type SuppressionsClientListResponse struct {
	SuppressionContractListResult
}

SuppressionsClientListResponse contains the response from method SuppressionsClient.List.

Jump to

Keyboard shortcuts

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