armselfhelp

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 14 Imported by: 0

README

Azure Selfhelp Module for Go

PkgGoDev

The armselfhelp module provides operations for working with Azure Selfhelp.

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

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp

Authorization

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

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 Selfhelp 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 ActionType

type ActionType string

ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.

const (
	ActionTypeInternal ActionType = "Internal"
)

func PossibleActionTypeValues

func PossibleActionTypeValues() []ActionType

PossibleActionTypeValues returns the possible values for the ActionType const type.

type CheckNameAvailabilityRequest

type CheckNameAvailabilityRequest struct {
	// The name of the resource for which availability needs to be checked.
	Name *string

	// The resource type.
	Type *string
}

CheckNameAvailabilityRequest - The check availability request body.

func (CheckNameAvailabilityRequest) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityRequest.

func (*CheckNameAvailabilityRequest) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityRequest.

type CheckNameAvailabilityResponse

type CheckNameAvailabilityResponse struct {
	// Gets an error message explaining the 'reason' value with more details. This field is returned iif nameAvailable is false.
	Message *string

	// Returns true or false depending on the availability of the name
	NameAvailable *bool

	// Reason for why value is not available. This field is returned if nameAvailable is false.
	Reason *string
}

CheckNameAvailabilityResponse - Response for whether the requested resource name is available or not.

func (CheckNameAvailabilityResponse) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResponse.

func (*CheckNameAvailabilityResponse) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResponse.

type ClientFactory

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

func NewClientFactory(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.

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

func (*ClientFactory) NewDiagnosticsClient

func (c *ClientFactory) NewDiagnosticsClient() *DiagnosticsClient

NewDiagnosticsClient creates a new instance of DiagnosticsClient.

func (*ClientFactory) NewDiscoverySolutionClient

func (c *ClientFactory) NewDiscoverySolutionClient() *DiscoverySolutionClient

NewDiscoverySolutionClient creates a new instance of DiscoverySolutionClient.

func (*ClientFactory) NewOperationsClient

func (c *ClientFactory) NewOperationsClient() *OperationsClient

NewOperationsClient creates a new instance of OperationsClient.

type CreatedByType

type CreatedByType string

CreatedByType - The type of identity that created the resource.

const (
	CreatedByTypeApplication     CreatedByType = "Application"
	CreatedByTypeKey             CreatedByType = "Key"
	CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity"
	CreatedByTypeUser            CreatedByType = "User"
)

func PossibleCreatedByTypeValues

func PossibleCreatedByTypeValues() []CreatedByType

PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type.

type Diagnostic

type Diagnostic struct {
	// Error definition.
	Error *Error

	// The problems (if any) detected by this insight.
	Insights []*Insight

	// Solution Id
	SolutionID *string

	// Denotes the status of the diagnostic resource.
	Status *Status
}

Diagnostic - Properties returned with in an insight.

func (Diagnostic) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Diagnostic.

func (*Diagnostic) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Diagnostic.

type DiagnosticInvocation

type DiagnosticInvocation struct {
	// Additional parameters required to invoke the solutionId.
	AdditionalParameters map[string]*string

	// Solution Id to invoke.
	SolutionID *string
}

DiagnosticInvocation - Solution Invocation with additional params needed for invocation.

func (DiagnosticInvocation) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type DiagnosticInvocation.

func (*DiagnosticInvocation) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticInvocation.

type DiagnosticResource

type DiagnosticResource struct {
	// Diagnostic Resource properties.
	Properties *DiagnosticResourceProperties

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

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

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

DiagnosticResource - Diagnostic resource

func (DiagnosticResource) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type DiagnosticResource.

func (*DiagnosticResource) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticResource.

type DiagnosticResourceProperties

type DiagnosticResourceProperties struct {
	// Global parameters that can be passed to all solutionIds.
	GlobalParameters map[string]*string

	// SolutionIds that are needed to be invoked.
	Insights []*DiagnosticInvocation

	// READ-ONLY; Diagnostic Request Accepted time.
	AcceptedAt *string

	// READ-ONLY; Array of Diagnostics.
	Diagnostics []*Diagnostic

	// READ-ONLY; Status of diagnostic provisioning.
	ProvisioningState *ProvisioningState
}

DiagnosticResourceProperties - Diagnostic resource properties.

func (DiagnosticResourceProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type DiagnosticResourceProperties.

func (*DiagnosticResourceProperties) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticResourceProperties.

type DiagnosticsClient

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

DiagnosticsClient contains the methods for the Diagnostics group. Don't use this type directly, use NewDiagnosticsClient() instead.

func NewDiagnosticsClient

func NewDiagnosticsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DiagnosticsClient, error)

NewDiagnosticsClient creates a new instance of DiagnosticsClient with the specified values.

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

func (*DiagnosticsClient) BeginCreate

func (client *DiagnosticsClient) BeginCreate(ctx context.Context, scope string, diagnosticsResourceName string, diagnosticResourceRequest DiagnosticResource, options *DiagnosticsClientBeginCreateOptions) (*runtime.Poller[DiagnosticsClientCreateResponse], error)

BeginCreate - Diagnostics tells you precisely the root cause of the issue and how to address it. You can get diagnostics once you discover and identify the relevant solution for your Azure issue. You can create diagnostics using the ‘solutionId’ from Solution Discovery API response and ‘additionalParameters’ Note: ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-06-01

  • scope - This is an extension resource provider and only resource level extension is supported at the moment.
  • diagnosticsResourceName - Unique resource name for insight resources
  • diagnosticResourceRequest - The required request body for this insightResource invocation.
  • options - DiagnosticsClientBeginCreateOptions contains the optional parameters for the DiagnosticsClient.BeginCreate method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/CreateDiagnosticForKeyVaultResource.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armselfhelp.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewDiagnosticsClient().BeginCreate(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", "VMNotWorkingInsight", armselfhelp.DiagnosticResource{}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	res, err := poller.PollUntilDone(ctx, nil)
	if err != nil {
		log.Fatalf("failed to pull the result: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.DiagnosticResource = armselfhelp.DiagnosticResource{
	// 	Name: to.Ptr("Microsoft.Help/diagnostics"),
	// 	Type: to.Ptr("VMNotWorkingInsight"),
	// 	ID: to.Ptr("subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/diagnostics/VMNotWorkingInsight"),
	// 	Properties: &armselfhelp.DiagnosticResourceProperties{
	// 		AcceptedAt: to.Ptr("2023-03-10T03:04:40Z"),
	// 		Diagnostics: []*armselfhelp.Diagnostic{
	// 			{
	// 				Error: &armselfhelp.Error{
	// 					Code: to.Ptr("errorCode"),
	// 					Message: to.Ptr("errorMessage"),
	// 				},
	// 				Insights: []*armselfhelp.Insight{
	// 					{
	// 						ID: to.Ptr("InsightArticleId"),
	// 						ImportanceLevel: to.Ptr(armselfhelp.ImportanceLevelCritical),
	// 						Results: to.Ptr("Article Content"),
	// 						Title: to.Ptr("An example title for an Insight"),
	// 				}},
	// 				SolutionID: to.Ptr("sampleSolutionId"),
	// 				Status: to.Ptr(armselfhelp.StatusSucceeded),
	// 		}},
	// 		ProvisioningState: to.Ptr(armselfhelp.ProvisioningStateSucceeded),
	// 	},
	// }
}
Output:

func (*DiagnosticsClient) CheckNameAvailability

CheckNameAvailability - This API is used to check the uniqueness of a resource name used for a diagnostic check. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-06-01

  • scope - This is an extension resource provider and only resource level extension is supported at the moment.
  • options - DiagnosticsClientCheckNameAvailabilityOptions contains the optional parameters for the DiagnosticsClient.CheckNameAvailability method.
Example (ExampleWhenNameIsAvailableForADiagnosticResource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/CheckNameAvailabilityForDiagnosticWhenNameIsAvailable.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/selfhelp/armselfhelp"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armselfhelp.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiagnosticsClient().CheckNameAvailability(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", &armselfhelp.DiagnosticsClientCheckNameAvailabilityOptions{CheckNameAvailabilityRequest: &armselfhelp.CheckNameAvailabilityRequest{
		Name: to.Ptr("sampleName"),
		Type: to.Ptr("Microsoft.Help/diagnostics"),
	},
	})
	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.CheckNameAvailabilityResponse = armselfhelp.CheckNameAvailabilityResponse{
	// 	NameAvailable: to.Ptr(true),
	// }
}
Output:

Example (ExampleWhenNameIsNotAvailableForADiagnosticResource)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/CheckNameAvailabilityForDiagnosticWhenNameIsNotAvailable.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/selfhelp/armselfhelp"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armselfhelp.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiagnosticsClient().CheckNameAvailability(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6", &armselfhelp.DiagnosticsClientCheckNameAvailabilityOptions{CheckNameAvailabilityRequest: &armselfhelp.CheckNameAvailabilityRequest{
		Name: to.Ptr("sampleName"),
		Type: to.Ptr("Microsoft.Help/diagnostics"),
	},
	})
	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.CheckNameAvailabilityResponse = armselfhelp.CheckNameAvailabilityResponse{
	// 	Message: to.Ptr("Name not available"),
	// 	NameAvailable: to.Ptr(false),
	// 	Reason: to.Ptr("Name is already in use"),
	// }
}
Output:

func (*DiagnosticsClient) Get

func (client *DiagnosticsClient) Get(ctx context.Context, scope string, diagnosticsResourceName string, options *DiagnosticsClientGetOptions) (DiagnosticsClientGetResponse, error)

Get - Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2023-06-01

  • scope - This is an extension resource provider and only resource level extension is supported at the moment.
  • diagnosticsResourceName - Unique resource name for insight resources
  • options - DiagnosticsClientGetOptions contains the optional parameters for the DiagnosticsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/GetDiagnosticForKeyVaultResource.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armselfhelp.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewDiagnosticsClient().Get(ctx, "subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", "VMNotWorkingInsight", 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.DiagnosticResource = armselfhelp.DiagnosticResource{
	// 	Name: to.Ptr("Microsoft.Help/diagnostics"),
	// 	Type: to.Ptr("VMNotWorkingInsight"),
	// 	ID: to.Ptr("subscriptions/mySubscription/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/diagnostics/VMNotWorkingInsight"),
	// 	Properties: &armselfhelp.DiagnosticResourceProperties{
	// 		AcceptedAt: to.Ptr("2023-03-10T03:04:40Z"),
	// 		Diagnostics: []*armselfhelp.Diagnostic{
	// 			{
	// 				Error: &armselfhelp.Error{
	// 					Code: to.Ptr("errorCode"),
	// 					Message: to.Ptr("errorMessage"),
	// 				},
	// 				Insights: []*armselfhelp.Insight{
	// 					{
	// 						ID: to.Ptr("InsightArticleId"),
	// 						ImportanceLevel: to.Ptr(armselfhelp.ImportanceLevelCritical),
	// 						Results: to.Ptr("Article Content"),
	// 						Title: to.Ptr("An example title for an Insight"),
	// 				}},
	// 				SolutionID: to.Ptr("sampleSolutionId"),
	// 				Status: to.Ptr(armselfhelp.StatusSucceeded),
	// 		}},
	// 		ProvisioningState: to.Ptr(armselfhelp.ProvisioningStateSucceeded),
	// 	},
	// }
}
Output:

type DiagnosticsClientBeginCreateOptions

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

DiagnosticsClientBeginCreateOptions contains the optional parameters for the DiagnosticsClient.BeginCreate method.

type DiagnosticsClientCheckNameAvailabilityOptions

type DiagnosticsClientCheckNameAvailabilityOptions struct {
	// The required parameters for availability check.
	CheckNameAvailabilityRequest *CheckNameAvailabilityRequest
}

DiagnosticsClientCheckNameAvailabilityOptions contains the optional parameters for the DiagnosticsClient.CheckNameAvailability method.

type DiagnosticsClientCheckNameAvailabilityResponse

type DiagnosticsClientCheckNameAvailabilityResponse struct {
	// Response for whether the requested resource name is available or not.
	CheckNameAvailabilityResponse
}

DiagnosticsClientCheckNameAvailabilityResponse contains the response from method DiagnosticsClient.CheckNameAvailability.

type DiagnosticsClientCreateResponse

type DiagnosticsClientCreateResponse struct {
	// Diagnostic resource
	DiagnosticResource
}

DiagnosticsClientCreateResponse contains the response from method DiagnosticsClient.BeginCreate.

type DiagnosticsClientGetOptions

type DiagnosticsClientGetOptions struct {
}

DiagnosticsClientGetOptions contains the optional parameters for the DiagnosticsClient.Get method.

type DiagnosticsClientGetResponse

type DiagnosticsClientGetResponse struct {
	// Diagnostic resource
	DiagnosticResource
}

DiagnosticsClientGetResponse contains the response from method DiagnosticsClient.Get.

type DiscoveryResponse

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

	// The list of solution metadata.
	Value []*SolutionMetadataResource
}

DiscoveryResponse - Discovery response.

func (DiscoveryResponse) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type DiscoveryResponse.

func (*DiscoveryResponse) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type DiscoveryResponse.

type DiscoverySolutionClient

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

DiscoverySolutionClient contains the methods for the DiscoverySolution group. Don't use this type directly, use NewDiscoverySolutionClient() instead.

func NewDiscoverySolutionClient

func NewDiscoverySolutionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DiscoverySolutionClient, error)

NewDiscoverySolutionClient creates a new instance of DiscoverySolutionClient with the specified values.

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

func (*DiscoverySolutionClient) NewListPager

NewListPager - Solutions Discovery is the initial point of entry within Help API, which helps you identify the relevant solutions for your Azure issue. You can discover solutions using resourceUri OR resourceUri + problemClassificationId. We will do our best in returning relevant diagnostics for your Azure issue. Get the problemClassificationId(s) using this reference [https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP]. Note: ‘requiredParameterSets’ from Solutions Discovery API response must be passed via ‘additionalParameters’ as an input to Diagnostics API.

Generated from API version 2023-06-01

  • scope - This is an extension resource provider and only resource level extension is supported at the moment.
  • options - DiscoverySolutionClientListOptions contains the optional parameters for the DiscoverySolutionClient.NewListPager method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/ListDiscoverySolutionsForKeyVaultResource.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armselfhelp.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewDiscoverySolutionClient().NewListPager("subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read", &armselfhelp.DiscoverySolutionClientListOptions{Filter: 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.DiscoveryResponse = armselfhelp.DiscoveryResponse{
		// 	Value: []*armselfhelp.SolutionMetadataResource{
		// 		{
		// 			Name: to.Ptr("SampleSolutionId1"),
		// 			Type: to.Ptr("Microsoft.Help/discoverySolutions"),
		// 			ID: to.Ptr("subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/discoverySolutions/SampleSolutionId1"),
		// 			Properties: &armselfhelp.SolutionMetadataProperties{
		// 				Description: to.Ptr("This is a diagnostic"),
		// 				RequiredParameterSets: [][]*string{
		// 					[]*string{
		// 						to.Ptr("ResourceUri")}},
		// 						SolutionID: to.Ptr("SampleSolutionId1"),
		// 						SolutionType: to.Ptr("Diagnostics"),
		// 					},
		// 				},
		// 				{
		// 					Name: to.Ptr("SampleSolutionId2"),
		// 					Type: to.Ptr("Microsoft.Help/discoverySolutions"),
		// 					ID: to.Ptr("subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/discoverySolutions/SampleSolutionId2"),
		// 					Properties: &armselfhelp.SolutionMetadataProperties{
		// 						Description: to.Ptr("This is a diagnostic"),
		// 						RequiredParameterSets: [][]*string{
		// 							[]*string{
		// 								to.Ptr("ResourceUri")}},
		// 								SolutionID: to.Ptr("SampleSolutionId2"),
		// 								SolutionType: to.Ptr("Diagnostics"),
		// 							},
		// 						},
		// 						{
		// 							Name: to.Ptr("SampleSolutionId3"),
		// 							Type: to.Ptr("Microsoft.Help/discoverySolutions"),
		// 							ID: to.Ptr("subscriptions/0d0fcd2e-c4fd-4349-8497-200edb3923c6/resourcegroups/myresourceGroup/providers/Microsoft.KeyVault/vaults/test-keyvault-non-read/providers/Microsoft.Help/discoverySolutions/SampleSolutionId3"),
		// 							Properties: &armselfhelp.SolutionMetadataProperties{
		// 								Description: to.Ptr("This is a diagnostic"),
		// 								RequiredParameterSets: [][]*string{
		// 									[]*string{
		// 										to.Ptr("ResourceUri")}},
		// 										SolutionID: to.Ptr("SampleSolutionId3"),
		// 										SolutionType: to.Ptr("Diagnostics"),
		// 									},
		// 							}},
		// 						}
	}
}
Output:

type DiscoverySolutionClientListOptions

type DiscoverySolutionClientListOptions struct {
	// Can be used to filter solutionIds by 'ProblemClassificationId'. The filter supports only 'and' and 'eq' operators. Example:
	// $filter=ProblemClassificationId eq '1ddda5b4-cf6c-4d4f-91ad-bc38ab0e811e'
	// and ProblemClassificationId eq '0a9673c2-7af6-4e19-90d3-4ee2461076d9'.
	Filter *string

	// Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element,
	// the value of the nextLink element will include a skiptoken parameter that
	// specifies a starting point to use for subsequent calls.
	Skiptoken *string
}

DiscoverySolutionClientListOptions contains the optional parameters for the DiscoverySolutionClient.NewListPager method.

type DiscoverySolutionClientListResponse

type DiscoverySolutionClientListResponse struct {
	// Discovery response.
	DiscoveryResponse
}

DiscoverySolutionClientListResponse contains the response from method DiscoverySolutionClient.NewListPager.

type Error

type Error struct {
	// An array of additional nested error response info objects, as described by this contract.
	Details []*Error

	// READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code.
	Code *string

	// READ-ONLY; Description of the error.
	Message *string

	// READ-ONLY; Service specific error type which serves as additional context for the error herein.
	Type *string
}

Error definition.

func (Error) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Error.

func (*Error) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Error.

type ImportanceLevel

type ImportanceLevel string

ImportanceLevel - Importance level of the insight.

const (
	// ImportanceLevelCritical - A critical insight has been found after running the diagnostic.
	ImportanceLevelCritical ImportanceLevel = "Critical"
	// ImportanceLevelInformation - An information insight has been found after running the diagnostic.
	ImportanceLevelInformation ImportanceLevel = "Information"
	// ImportanceLevelWarning - A warning insight has been found after running the diagnostic.
	ImportanceLevelWarning ImportanceLevel = "Warning"
)

func PossibleImportanceLevelValues

func PossibleImportanceLevelValues() []ImportanceLevel

PossibleImportanceLevelValues returns the possible values for the ImportanceLevel const type.

type Insight

type Insight struct {
	// Article id.
	ID *string

	// Importance level of the insight.
	ImportanceLevel *ImportanceLevel

	// Detailed result content.
	Results *string

	// This insight's title.
	Title *string
}

Insight - Detailed insights(s) obtained via the invocation of an insight diagnostic troubleshooter.

func (Insight) MarshalJSON

func (i Insight) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type Insight.

func (*Insight) UnmarshalJSON

func (i *Insight) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type Insight.

type Operation

type Operation struct {
	// Localized display information for this particular operation.
	Display *OperationDisplay

	// READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.
	ActionType *ActionType

	// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane
	// operations.
	IsDataAction *bool

	// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write",
	// "Microsoft.Compute/virtualMachines/capture/action"
	Name *string

	// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default
	// value is "user,system"
	Origin *Origin
}

Operation - Details of a REST API operation, returned from the Resource Provider Operations API

func (Operation) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type Operation.

func (*Operation) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type Operation.

type OperationDisplay

type OperationDisplay struct {
	// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views.
	Description *string

	// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual
	// Machine", "Restart Virtual Machine".
	Operation *string

	// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft
	// Compute".
	Provider *string

	// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job
	// Schedule Collections".
	Resource *string
}

OperationDisplay - Localized display information for this particular operation.

func (OperationDisplay) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OperationDisplay.

func (*OperationDisplay) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay.

type OperationListResult

type OperationListResult struct {
	// READ-ONLY; URL to get the next set of operation list results (if there are any).
	NextLink *string

	// READ-ONLY; List of operations supported by the resource provider
	Value []*Operation
}

OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.

func (OperationListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type OperationListResult.

func (*OperationListResult) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult.

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

NewListPager - Returns list of operations.

Generated from API version 2023-06-01

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

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/help/resource-manager/Microsoft.Help/stable/2023-06-01/examples/ListOperations.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/selfhelp/armselfhelp"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armselfhelp.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewOperationsClient().NewListPager(nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page.OperationListResult = armselfhelp.OperationListResult{
		// 	Value: []*armselfhelp.Operation{
		// 		{
		// 			Name: to.Ptr("Microsoft.Help/diagnostics/read"),
		// 			Display: &armselfhelp.OperationDisplay{
		// 				Description: to.Ptr("Created and Reads a diagnostic resource to troubleshoot an issue with a resource."),
		// 				Operation: to.Ptr("Create/Read a Diagnostic"),
		// 				Provider: to.Ptr("Microsoft.Diagnostics"),
		// 				Resource: to.Ptr("Diagnostics"),
		// 			},
		// 			IsDataAction: to.Ptr(false),
		// 		},
		// 		{
		// 			Name: to.Ptr("Microsoft.Help/discoverySolutions/read"),
		// 			Display: &armselfhelp.OperationDisplay{
		// 				Description: to.Ptr("Returns list of solutions based on ResourceType or ProblemClassficationId"),
		// 				Operation: to.Ptr("List of available solutions."),
		// 				Provider: to.Ptr("Microsoft.Help"),
		// 				Resource: to.Ptr("DiscoverySolutions"),
		// 			},
		// 			IsDataAction: to.Ptr(false),
		// 	}},
		// }
	}
}
Output:

type OperationsClientListOptions

type OperationsClientListOptions struct {
}

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

type OperationsClientListResponse

type OperationsClientListResponse struct {
	// A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results.
	OperationListResult
}

OperationsClientListResponse contains the response from method OperationsClient.NewListPager.

type Origin

type Origin string

Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system"

const (
	OriginSystem     Origin = "system"
	OriginUser       Origin = "user"
	OriginUserSystem Origin = "user,system"
)

func PossibleOriginValues

func PossibleOriginValues() []Origin

PossibleOriginValues returns the possible values for the Origin const type.

type ProvisioningState

type ProvisioningState string

ProvisioningState - Status of diagnostic provisioning.

const (
	// ProvisioningStateCanceled - When Diagnostic request gets canceled.
	ProvisioningStateCanceled ProvisioningState = "Canceled"
	// ProvisioningStateFailed - All Diagnostics failed to run.
	ProvisioningStateFailed ProvisioningState = "Failed"
	// ProvisioningStatePartialComplete - Some Diagnostics are still running or failed.
	ProvisioningStatePartialComplete ProvisioningState = "PartialComplete"
	// ProvisioningStateSucceeded - All Diagnostics in the Batch succeeded.
	ProvisioningStateSucceeded ProvisioningState = "Succeeded"
)

func PossibleProvisioningStateValues

func PossibleProvisioningStateValues() []ProvisioningState

PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type.

type SolutionMetadataProperties

type SolutionMetadataProperties struct {
	// A detailed description of solution.
	Description *string

	// Required parameters for invoking this particular solution.
	RequiredParameterSets [][]*string

	// Solution Id.
	SolutionID *string

	// Solution Type.
	SolutionType *string
}

SolutionMetadataProperties - Diagnostic solution metadata.

func (SolutionMetadataProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SolutionMetadataProperties.

func (*SolutionMetadataProperties) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SolutionMetadataProperties.

type SolutionMetadataResource

type SolutionMetadataResource struct {
	// Solution metadata Resource properties.
	Properties *SolutionMetadataProperties

	// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
	ID *string

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

	// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information.
	SystemData *SystemData

	// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
	Type *string
}

SolutionMetadataResource - Solution Metadata resource

func (SolutionMetadataResource) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SolutionMetadataResource.

func (*SolutionMetadataResource) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SolutionMetadataResource.

type Status

type Status string

Status - Denotes the status of the diagnostic resource.

const (
	// StatusFailed - Diagnostic creation failed.
	StatusFailed Status = "Failed"
	// StatusMissingInputs - Request is missing required inputs to run.
	StatusMissingInputs Status = "MissingInputs"
	// StatusRunning - Diagnostic is still running.
	StatusRunning Status = "Running"
	// StatusSucceeded - Diagnostic creation succeeded.
	StatusSucceeded Status = "Succeeded"
	// StatusTimeout - Diagnostic was timed out.
	StatusTimeout Status = "Timeout"
)

func PossibleStatusValues

func PossibleStatusValues() []Status

PossibleStatusValues returns the possible values for the Status const type.

type SystemData

type SystemData struct {
	// The timestamp of resource creation (UTC).
	CreatedAt *time.Time

	// The identity that created the resource.
	CreatedBy *string

	// The type of identity that created the resource.
	CreatedByType *CreatedByType

	// The timestamp of resource last modification (UTC)
	LastModifiedAt *time.Time

	// The identity that last modified the resource.
	LastModifiedBy *string

	// The type of identity that last modified the resource.
	LastModifiedByType *CreatedByType
}

SystemData - Metadata pertaining to creation and last modification of the resource.

func (SystemData) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SystemData.

func (*SystemData) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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