armserialconsole

package module
v1.2.0 Latest Latest
Warning

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

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

README

Azure Serial Console Module for Go

PkgGoDev

The armserialconsole module provides operations for working with Azure Serial Console.

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 Serial Console module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole

Authorization

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

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 Serial Console label.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientFactory added in v1.1.0

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

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

func NewClientFactory added in v1.1.0

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

NewClientFactory creates a new instance of ClientFactory with the specified values. The parameter values will be propagated to any client created from this factory.

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

func (*ClientFactory) NewMicrosoftSerialConsoleClient added in v1.1.0

func (c *ClientFactory) NewMicrosoftSerialConsoleClient() *MicrosoftSerialConsoleClient

NewMicrosoftSerialConsoleClient creates a new instance of MicrosoftSerialConsoleClient.

func (*ClientFactory) NewSerialPortsClient added in v1.1.0

func (c *ClientFactory) NewSerialPortsClient() *SerialPortsClient

NewSerialPortsClient creates a new instance of SerialPortsClient.

type DisableSerialConsoleResult

type DisableSerialConsoleResult struct {
	// Whether or not Serial Console is disabled.
	Disabled *bool
}

DisableSerialConsoleResult - Returns whether or not Serial Console is disabled.

func (DisableSerialConsoleResult) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type DisableSerialConsoleResult.

func (*DisableSerialConsoleResult) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type DisableSerialConsoleResult.

type EnableSerialConsoleResult

type EnableSerialConsoleResult struct {
	// Whether or not Serial Console is disabled (enabled).
	Disabled *bool
}

EnableSerialConsoleResult - Returns whether or not Serial Console is disabled (enabled).

func (EnableSerialConsoleResult) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type EnableSerialConsoleResult.

func (*EnableSerialConsoleResult) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type EnableSerialConsoleResult.

type GetSerialConsoleSubscriptionNotFound

type GetSerialConsoleSubscriptionNotFound struct {
	// Error code
	Code *string

	// Subscription not found message
	Message *string
}

GetSerialConsoleSubscriptionNotFound - Error saying that the provided subscription could not be found

func (GetSerialConsoleSubscriptionNotFound) MarshalJSON added in v1.1.0

func (g GetSerialConsoleSubscriptionNotFound) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type GetSerialConsoleSubscriptionNotFound.

func (*GetSerialConsoleSubscriptionNotFound) UnmarshalJSON added in v1.1.0

func (g *GetSerialConsoleSubscriptionNotFound) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaller interface for type GetSerialConsoleSubscriptionNotFound.

type MicrosoftSerialConsoleClient

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

MicrosoftSerialConsoleClient contains the methods for the MicrosoftSerialConsoleClient group. Don't use this type directly, use NewMicrosoftSerialConsoleClient() instead.

func NewMicrosoftSerialConsoleClient

func NewMicrosoftSerialConsoleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MicrosoftSerialConsoleClient, error)

NewMicrosoftSerialConsoleClient creates a new instance of MicrosoftSerialConsoleClient with the specified values.

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

func (*MicrosoftSerialConsoleClient) DisableConsole

DisableConsole - Disables the Serial Console service for all VMs and VM scale sets in the provided subscription If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • defaultParam - Default parameter. Leave the value as "default".
  • options - MicrosoftSerialConsoleClientDisableConsoleOptions contains the optional parameters for the MicrosoftSerialConsoleClient.DisableConsole method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/DisableConsoleExamples.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewMicrosoftSerialConsoleClient().DisableConsole(ctx, "default", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Value = armserialconsole.DisableSerialConsoleResult{
	// 	Disabled: to.Ptr(true),
	// }
}
Output:

func (*MicrosoftSerialConsoleClient) EnableConsole

EnableConsole - Enables the Serial Console service for all VMs and VM scale sets in the provided subscription If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • defaultParam - Default parameter. Leave the value as "default".
  • options - MicrosoftSerialConsoleClientEnableConsoleOptions contains the optional parameters for the MicrosoftSerialConsoleClient.EnableConsole method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/EnableConsoleExamples.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewMicrosoftSerialConsoleClient().EnableConsole(ctx, "default", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Value = armserialconsole.EnableSerialConsoleResult{
	// 	Disabled: to.Ptr(false),
	// }
}
Output:

func (*MicrosoftSerialConsoleClient) GetConsoleStatus

GetConsoleStatus - Gets whether or not Serial Console is disabled for a given subscription If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • defaultParam - Default parameter. Leave the value as "default".
  • options - MicrosoftSerialConsoleClientGetConsoleStatusOptions contains the optional parameters for the MicrosoftSerialConsoleClient.GetConsoleStatus method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/SerialConsoleStatus.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewMicrosoftSerialConsoleClient().GetConsoleStatus(ctx, "default", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res.Value = armserialconsole.Status{
	// 	Disabled: to.Ptr(true),
	// }
}
Output:

func (*MicrosoftSerialConsoleClient) ListOperations

ListOperations - Gets a list of Serial Console API operations. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • options - MicrosoftSerialConsoleClientListOperationsOptions contains the optional parameters for the MicrosoftSerialConsoleClient.ListOperations method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/GetOperationsExample.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewMicrosoftSerialConsoleClient().ListOperations(ctx, 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.Operations = armserialconsole.Operations{
	// 	Value: []*armserialconsole.OperationsValueItem{
	// 		{
	// 			Name: to.Ptr("Microsoft.SerialConsole/consoleServices/read"),
	// 			Display: &armserialconsole.OperationsValueItemDisplay{
	// 				Description: to.Ptr("Retrieves the current subscription state"),
	// 				Operation: to.Ptr("Default"),
	// 				Provider: to.Ptr("Microsoft.SerialConsole"),
	// 				Resource: to.Ptr("Serial Console instance"),
	// 			},
	// 			IsDataAction: to.Ptr("false"),
	// 		},
	// 		{
	// 			Name: to.Ptr("Microsoft.SerialConsole/consoleServices/disableConsole/action"),
	// 			Display: &armserialconsole.OperationsValueItemDisplay{
	// 				Description: to.Ptr("Disable Serial Console for a subscription"),
	// 				Operation: to.Ptr("Disable Console"),
	// 				Provider: to.Ptr("Microsoft.SerialConsole"),
	// 				Resource: to.Ptr("Serial Console instance"),
	// 			},
	// 			IsDataAction: to.Ptr("false"),
	// 		},
	// 		{
	// 			Name: to.Ptr("Microsoft.SerialConsole/consoleServices/enableConsole/action"),
	// 			Display: &armserialconsole.OperationsValueItemDisplay{
	// 				Description: to.Ptr("Enable Serial Console for a subscription"),
	// 				Operation: to.Ptr("Enable Console"),
	// 				Provider: to.Ptr("Microsoft.SerialConsole"),
	// 				Resource: to.Ptr("Serial Console instance"),
	// 			},
	// 			IsDataAction: to.Ptr("false"),
	// 	}},
	// }
}
Output:

type MicrosoftSerialConsoleClientDisableConsoleOptions

type MicrosoftSerialConsoleClientDisableConsoleOptions struct {
}

MicrosoftSerialConsoleClientDisableConsoleOptions contains the optional parameters for the MicrosoftSerialConsoleClient.DisableConsole method.

type MicrosoftSerialConsoleClientDisableConsoleResponse

type MicrosoftSerialConsoleClientDisableConsoleResponse struct {
	// Possible types are DisableSerialConsoleResult, GetSerialConsoleSubscriptionNotFound
	Value any
}

MicrosoftSerialConsoleClientDisableConsoleResponse contains the response from method MicrosoftSerialConsoleClient.DisableConsole.

type MicrosoftSerialConsoleClientEnableConsoleOptions

type MicrosoftSerialConsoleClientEnableConsoleOptions struct {
}

MicrosoftSerialConsoleClientEnableConsoleOptions contains the optional parameters for the MicrosoftSerialConsoleClient.EnableConsole method.

type MicrosoftSerialConsoleClientEnableConsoleResponse

type MicrosoftSerialConsoleClientEnableConsoleResponse struct {
	// Possible types are EnableSerialConsoleResult, GetSerialConsoleSubscriptionNotFound
	Value any
}

MicrosoftSerialConsoleClientEnableConsoleResponse contains the response from method MicrosoftSerialConsoleClient.EnableConsole.

type MicrosoftSerialConsoleClientGetConsoleStatusOptions

type MicrosoftSerialConsoleClientGetConsoleStatusOptions struct {
}

MicrosoftSerialConsoleClientGetConsoleStatusOptions contains the optional parameters for the MicrosoftSerialConsoleClient.GetConsoleStatus method.

type MicrosoftSerialConsoleClientGetConsoleStatusResponse

type MicrosoftSerialConsoleClientGetConsoleStatusResponse struct {
	// Possible types are Status, GetSerialConsoleSubscriptionNotFound
	Value any
}

MicrosoftSerialConsoleClientGetConsoleStatusResponse contains the response from method MicrosoftSerialConsoleClient.GetConsoleStatus.

type MicrosoftSerialConsoleClientListOperationsOptions

type MicrosoftSerialConsoleClientListOperationsOptions struct {
}

MicrosoftSerialConsoleClientListOperationsOptions contains the optional parameters for the MicrosoftSerialConsoleClient.ListOperations method.

type MicrosoftSerialConsoleClientListOperationsResponse

type MicrosoftSerialConsoleClientListOperationsResponse struct {
	// Serial Console operations
	Operations
}

MicrosoftSerialConsoleClientListOperationsResponse contains the response from method MicrosoftSerialConsoleClient.ListOperations.

type Operations added in v0.2.0

type Operations struct {
	// A list of Serial Console operations
	Value []*OperationsValueItem
}

Operations - Serial Console operations

func (Operations) MarshalJSON added in v0.2.0

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

MarshalJSON implements the json.Marshaller interface for type Operations.

func (*Operations) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Operations.

type OperationsValueItem added in v0.2.0

type OperationsValueItem struct {
	Display      *OperationsValueItemDisplay
	IsDataAction *string
	Name         *string
}

func (OperationsValueItem) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type OperationsValueItem.

func (*OperationsValueItem) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationsValueItem.

type OperationsValueItemDisplay added in v0.2.0

type OperationsValueItemDisplay struct {
	Description *string
	Operation   *string
	Provider    *string
	Resource    *string
}

func (OperationsValueItemDisplay) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type OperationsValueItemDisplay.

func (*OperationsValueItemDisplay) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type OperationsValueItemDisplay.

type ProxyResource

type ProxyResource struct {
	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

ProxyResource - The resource model definition for a ARM proxy resource. It will have everything other than required location and tags

func (ProxyResource) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type ProxyResource.

func (*ProxyResource) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource.

type Resource

type Resource struct {
	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

Resource - The Resource model definition.

func (Resource) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type Resource.

func (*Resource) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Resource.

type SerialPort

type SerialPort struct {
	// The properties of the serial port.
	Properties *SerialPortProperties

	// READ-ONLY; Resource Id
	ID *string

	// READ-ONLY; Resource name
	Name *string

	// READ-ONLY; Resource type
	Type *string
}

SerialPort - Represents the serial port of the parent resource.

func (SerialPort) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type SerialPort.

func (*SerialPort) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type SerialPort.

type SerialPortConnectResult

type SerialPortConnectResult struct {
	// Connection string to the serial port of the resource.
	ConnectionString *string
}

SerialPortConnectResult - Returns a connection string to the serial port of the resource.

func (SerialPortConnectResult) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type SerialPortConnectResult.

func (*SerialPortConnectResult) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type SerialPortConnectResult.

type SerialPortListResult

type SerialPortListResult struct {
	// The list of serial ports.
	Value []*SerialPort
}

SerialPortListResult - The list serial ports operation response.

func (SerialPortListResult) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type SerialPortListResult.

func (*SerialPortListResult) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type SerialPortListResult.

type SerialPortProperties

type SerialPortProperties struct {
	// Specifies whether the port is enabled for a serial console connection.
	State *SerialPortState
}

SerialPortProperties - The properties of the serial port.

func (SerialPortProperties) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type SerialPortProperties.

func (*SerialPortProperties) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type SerialPortProperties.

type SerialPortState

type SerialPortState string

SerialPortState - Specifies whether the port is enabled for a serial console connection.

const (
	SerialPortStateDisabled SerialPortState = "disabled"
	SerialPortStateEnabled  SerialPortState = "enabled"
)

func PossibleSerialPortStateValues

func PossibleSerialPortStateValues() []SerialPortState

PossibleSerialPortStateValues returns the possible values for the SerialPortState const type.

type SerialPortsClient

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

SerialPortsClient contains the methods for the SerialPorts group. Don't use this type directly, use NewSerialPortsClient() instead.

func NewSerialPortsClient

func NewSerialPortsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SerialPortsClient, error)

NewSerialPortsClient creates a new instance of SerialPortsClient with the specified values.

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

func (*SerialPortsClient) Connect

func (client *SerialPortsClient) Connect(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourceType string, parentResource string, serialPort string, options *SerialPortsClientConnectOptions) (SerialPortsClientConnectResponse, error)

Connect - Connect to serial port of the target resource If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • resourceProviderNamespace - The namespace of the resource provider.
  • parentResourceType - The resource type of the parent resource. For example: 'virtualMachines' or 'virtualMachineScaleSets'
  • parentResource - The resource name, or subordinate path, for the parent of the serial port. For example: the name of the virtual machine.
  • serialPort - The name of the serial port to connect to.
  • options - SerialPortsClientConnectOptions contains the optional parameters for the SerialPortsClient.Connect method.
Example (ConnectToAScaleSetInstanceSerialPort)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/SerialPortConnectVMSS.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSerialPortsClient().Connect(ctx, "myResourceGroup", "Microsoft.Compute", "virtualMachineScaleSets", "myscaleset/virtualMachines/2", "0", 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.SerialPortConnectResult = armserialconsole.SerialPortConnectResult{
	// 	ConnectionString: to.Ptr("wss://eastus.gateway.serialconsole.azure.com/n/connector/{containerid}/sessions/{sessionId}/client"),
	// }
}
Output:

Example (ConnectToAVirtualMachineSerialPort)

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/SerialPortConnectVM.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSerialPortsClient().Connect(ctx, "myResourceGroup", "Microsoft.Compute", "virtualMachines", "myVM", "0", 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.SerialPortConnectResult = armserialconsole.SerialPortConnectResult{
	// 	ConnectionString: to.Ptr("wss://eastus.gateway.serialconsole.azure.com/n/connector/{containerid}/sessions/{sessionId}/client"),
	// }
}
Output:

func (*SerialPortsClient) Create

func (client *SerialPortsClient) Create(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourceType string, parentResource string, serialPort string, parameters SerialPort, options *SerialPortsClientCreateOptions) (SerialPortsClientCreateResponse, error)

Create - Creates or updates a serial port If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • resourceProviderNamespace - The namespace of the resource provider.
  • parentResourceType - The resource type of the parent resource. For example: 'virtualMachines' or 'virtualMachineScaleSets'
  • parentResource - The resource name, or subordinate path, for the parent of the serial port. For example: the name of the virtual machine.
  • serialPort - The name of the serial port to create.
  • parameters - Parameters supplied to create the serial port.
  • options - SerialPortsClientCreateOptions contains the optional parameters for the SerialPortsClient.Create method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/CreateSerialPort.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/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewSerialPortsClient().Create(ctx, "myResourceGroup", "Microsoft.Compute", "virtualMachines", "myVM", "0", armserialconsole.SerialPort{
		Properties: &armserialconsole.SerialPortProperties{
			State: to.Ptr(armserialconsole.SerialPortStateEnabled),
		},
	}, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*SerialPortsClient) Delete

func (client *SerialPortsClient) Delete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourceType string, parentResource string, serialPort string, options *SerialPortsClientDeleteOptions) (SerialPortsClientDeleteResponse, error)

Delete - Deletes a serial port If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • resourceProviderNamespace - The namespace of the resource provider.
  • parentResourceType - The resource type of the parent resource. For example: 'virtualMachines' or 'virtualMachineScaleSets'
  • parentResource - The resource name, or subordinate path, for the parent of the serial port. For example: the name of the virtual machine.
  • serialPort - The name of the serial port to delete.
  • options - SerialPortsClientDeleteOptions contains the optional parameters for the SerialPortsClient.Delete method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/DeleteSerialPort.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = clientFactory.NewSerialPortsClient().Delete(ctx, "myResourceGroup", "Microsoft.Compute", "virtualMachines", "myVM", "0", nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*SerialPortsClient) Get

func (client *SerialPortsClient) Get(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourceType string, parentResource string, serialPort string, options *SerialPortsClientGetOptions) (SerialPortsClientGetResponse, error)

Get - Gets the configured settings for a serial port If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • resourceProviderNamespace - The namespace of the resource provider.
  • parentResourceType - The resource type of the parent resource. For example: 'virtualMachines' or 'virtualMachineScaleSets'
  • parentResource - The resource name, or subordinate path, for the parent of the serial port. For example: the name of the virtual machine.
  • serialPort - The name of the serial port to connect to.
  • options - SerialPortsClientGetOptions contains the optional parameters for the SerialPortsClient.Get method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/GetSerialPort.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSerialPortsClient().Get(ctx, "myResourceGroup", "Microsoft.Compute", "virtualMachines", "myVM", "0", 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.SerialPort = armserialconsole.SerialPort{
	// 	Name: to.Ptr("0"),
	// 	Type: to.Ptr("Microsoft.SerialConsole/serialPorts"),
	// 	ID: to.Ptr("/subscriptions/00000000-00000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/providers/Microsoft.SerialConsole/serialPorts/0"),
	// 	Properties: &armserialconsole.SerialPortProperties{
	// 		State: to.Ptr(armserialconsole.SerialPortStateEnabled),
	// 	},
	// }
}
Output:

func (*SerialPortsClient) List

func (client *SerialPortsClient) List(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourceType string, parentResource string, options *SerialPortsClientListOptions) (SerialPortsClientListResponse, error)

List - Lists all of the configured serial ports for a parent resource If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • resourceGroupName - The name of the resource group.
  • resourceProviderNamespace - The namespace of the resource provider.
  • parentResourceType - The resource type of the parent resource. For example: 'virtualMachines' or 'virtualMachineScaleSets'
  • parentResource - The resource name, or subordinate path, for the parent of the serial port. For example: the name of the virtual machine.
  • options - SerialPortsClientListOptions contains the optional parameters for the SerialPortsClient.List method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/ListSerialPort.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSerialPortsClient().List(ctx, "myResourceGroup", "Microsoft.Compute", "virtualMachines", "myVM", 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.SerialPortListResult = armserialconsole.SerialPortListResult{
	// 	Value: []*armserialconsole.SerialPort{
	// 		{
	// 			Name: to.Ptr("0"),
	// 			Type: to.Ptr("Microsoft.SerialConsole/serialPorts"),
	// 			ID: to.Ptr("/subscriptions/00000000-00000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/providers/Microsoft.SerialConsole/serialPorts/0"),
	// 			Properties: &armserialconsole.SerialPortProperties{
	// 				State: to.Ptr(armserialconsole.SerialPortStateEnabled),
	// 			},
	// 	}},
	// }
}
Output:

func (*SerialPortsClient) ListBySubscriptions

ListBySubscriptions - Handles requests to list all SerialPort resources in a subscription. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2018-05-01

  • options - SerialPortsClientListBySubscriptionsOptions contains the optional parameters for the SerialPortsClient.ListBySubscriptions method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/serialconsole/resource-manager/Microsoft.SerialConsole/stable/2018-05-01/examples/ListSerialPortSubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/serialconsole/armserialconsole"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armserialconsole.NewClientFactory("<subscription-id>", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSerialPortsClient().ListBySubscriptions(ctx, 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.SerialPortListResult = armserialconsole.SerialPortListResult{
	// 	Value: []*armserialconsole.SerialPort{
	// 		{
	// 			Name: to.Ptr("0"),
	// 			Type: to.Ptr("Microsoft.SerialConsole/serialPorts"),
	// 			ID: to.Ptr("/subscriptions/00000000-00000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM/providers/Microsoft.SerialConsole/serialPorts/0"),
	// 			Properties: &armserialconsole.SerialPortProperties{
	// 				State: to.Ptr(armserialconsole.SerialPortStateEnabled),
	// 			},
	// 	}},
	// }
}
Output:

type SerialPortsClientConnectOptions added in v0.2.0

type SerialPortsClientConnectOptions struct {
}

SerialPortsClientConnectOptions contains the optional parameters for the SerialPortsClient.Connect method.

type SerialPortsClientConnectResponse added in v0.2.0

type SerialPortsClientConnectResponse struct {
	// Returns a connection string to the serial port of the resource.
	SerialPortConnectResult
}

SerialPortsClientConnectResponse contains the response from method SerialPortsClient.Connect.

type SerialPortsClientCreateOptions added in v0.2.0

type SerialPortsClientCreateOptions struct {
}

SerialPortsClientCreateOptions contains the optional parameters for the SerialPortsClient.Create method.

type SerialPortsClientCreateResponse added in v0.2.0

type SerialPortsClientCreateResponse struct {
	// Represents the serial port of the parent resource.
	SerialPort
}

SerialPortsClientCreateResponse contains the response from method SerialPortsClient.Create.

type SerialPortsClientDeleteOptions added in v0.2.0

type SerialPortsClientDeleteOptions struct {
}

SerialPortsClientDeleteOptions contains the optional parameters for the SerialPortsClient.Delete method.

type SerialPortsClientDeleteResponse added in v0.2.0

type SerialPortsClientDeleteResponse struct {
}

SerialPortsClientDeleteResponse contains the response from method SerialPortsClient.Delete.

type SerialPortsClientGetOptions added in v0.2.0

type SerialPortsClientGetOptions struct {
}

SerialPortsClientGetOptions contains the optional parameters for the SerialPortsClient.Get method.

type SerialPortsClientGetResponse added in v0.2.0

type SerialPortsClientGetResponse struct {
	// Represents the serial port of the parent resource.
	SerialPort
}

SerialPortsClientGetResponse contains the response from method SerialPortsClient.Get.

type SerialPortsClientListBySubscriptionsOptions added in v0.2.0

type SerialPortsClientListBySubscriptionsOptions struct {
}

SerialPortsClientListBySubscriptionsOptions contains the optional parameters for the SerialPortsClient.ListBySubscriptions method.

type SerialPortsClientListBySubscriptionsResponse added in v0.2.0

type SerialPortsClientListBySubscriptionsResponse struct {
	// The list serial ports operation response.
	SerialPortListResult
}

SerialPortsClientListBySubscriptionsResponse contains the response from method SerialPortsClient.ListBySubscriptions.

type SerialPortsClientListOptions added in v0.2.0

type SerialPortsClientListOptions struct {
}

SerialPortsClientListOptions contains the optional parameters for the SerialPortsClient.List method.

type SerialPortsClientListResponse added in v0.2.0

type SerialPortsClientListResponse struct {
	// The list serial ports operation response.
	SerialPortListResult
}

SerialPortsClientListResponse contains the response from method SerialPortsClient.List.

type Status added in v0.2.0

type Status struct {
	// Whether or not Serial Console is disabled.
	Disabled *bool
}

Status - Returns whether or not Serial Console is disabled.

func (Status) MarshalJSON added in v1.1.0

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

MarshalJSON implements the json.Marshaller interface for type Status.

func (*Status) UnmarshalJSON added in v1.1.0

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

UnmarshalJSON implements the json.Unmarshaller interface for type Status.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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