armdataboundaries

package module
v0.0.0-...-45adee8 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 14 Imported by: 0

README

Azure Data Boundary Module for Go

The armdataboundaries module provides operations for working with Azure Data Boundary.

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 Data Boundary module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databoundaries/armdataboundaries

Authorization

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

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 Data Boundary 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 Client

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

Client contains the methods for the DataBoundaries group. Don't use this type directly, use NewClient() instead.

func NewClient

func NewClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error)

NewClient creates a new instance of Client with the specified values.

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

func (*Client) GetScope

func (client *Client) GetScope(ctx context.Context, scope string, defaultParam DefaultName, options *ClientGetScopeOptions) (ClientGetScopeResponse, error)

GetScope - Get data boundary at specified scope If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-01

  • scope - The scope at which the operation is performed.
  • defaultParam - Default string modeled as parameter for auto generation to work correctly.
  • options - ClientGetScopeOptions contains the optional parameters for the Client.GetScope method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d426a4238db8dcd4da1c03c2c380fa27628093e7/specification/resources/resource-manager/Microsoft.Resources/stable/2024-08-01/examples/GetScopedDataBoundary.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databoundaries/armdataboundaries"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdataboundaries.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().GetScope(ctx, "subscriptions/11111111-1111-1111-1111-111111111111/resourcegroups/my-resource-group", armdataboundaries.DefaultNameDefault, 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.DataBoundaryDefinition = armdataboundaries.DataBoundaryDefinition{
	// 	Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/providers/Microsoft.Resources/dataBoundaries/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armdataboundaries.DataBoundaryProperties{
	// 		DataBoundary: to.Ptr(armdataboundaries.DataBoundaryEU),
	// 		ProvisioningState: to.Ptr(armdataboundaries.ProvisioningStateSucceeded),
	// 	},
	// }
}
Output:

func (*Client) GetTenant

func (client *Client) GetTenant(ctx context.Context, defaultParam DefaultName, options *ClientGetTenantOptions) (ClientGetTenantResponse, error)

GetTenant - Get data boundary of tenant. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-01

  • defaultParam - Default string modeled as parameter for auto generation to work correctly.
  • options - ClientGetTenantOptions contains the optional parameters for the Client.GetTenant method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d426a4238db8dcd4da1c03c2c380fa27628093e7/specification/resources/resource-manager/Microsoft.Resources/stable/2024-08-01/examples/GetTenantDataBoundary.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databoundaries/armdataboundaries"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdataboundaries.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().GetTenant(ctx, armdataboundaries.DefaultNameDefault, 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.DataBoundaryDefinition = armdataboundaries.DataBoundaryDefinition{
	// 	Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/providers/Microsoft.Resources/dataBoundaries/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armdataboundaries.DataBoundaryProperties{
	// 		DataBoundary: to.Ptr(armdataboundaries.DataBoundaryEU),
	// 		ProvisioningState: to.Ptr(armdataboundaries.ProvisioningStateSucceeded),
	// 	},
	// }
}
Output:

func (*Client) Put

func (client *Client) Put(ctx context.Context, defaultParam DefaultName, dataBoundaryDefinition DataBoundaryDefinition, options *ClientPutOptions) (ClientPutResponse, error)

Put - Opt-in tenant to data boundary. If the operation fails it returns an *azcore.ResponseError type.

Generated from API version 2024-08-01

  • defaultParam - Default string modeled as parameter for auto generation to work correctly.
  • dataBoundaryDefinition - The data boundary to opt the tenant to.
  • options - ClientPutOptions contains the optional parameters for the Client.Put method.
Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d426a4238db8dcd4da1c03c2c380fa27628093e7/specification/resources/resource-manager/Microsoft.Resources/stable/2024-08-01/examples/PutDataBoundary.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/databoundaries/armdataboundaries"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdataboundaries.NewClientFactory(cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewClient().Put(ctx, armdataboundaries.DefaultNameDefault, armdataboundaries.DataBoundaryDefinition{
		Properties: &armdataboundaries.DataBoundaryProperties{
			DataBoundary: to.Ptr(armdataboundaries.DataBoundaryEU),
		},
	}, 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.DataBoundaryDefinition = armdataboundaries.DataBoundaryDefinition{
	// 	Name: to.Ptr("00000000-0000-0000-0000-000000000000"),
	// 	ID: to.Ptr("/providers/Microsoft.Resources/dataBoundaries/00000000-0000-0000-0000-000000000000"),
	// 	Properties: &armdataboundaries.DataBoundaryProperties{
	// 		DataBoundary: to.Ptr(armdataboundaries.DataBoundaryEU),
	// 		ProvisioningState: to.Ptr(armdataboundaries.ProvisioningStateSucceeded),
	// 	},
	// }
}
Output:

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) NewClient

func (c *ClientFactory) NewClient() *Client

NewClient creates a new instance of Client.

type ClientGetScopeOptions

type ClientGetScopeOptions struct {
}

ClientGetScopeOptions contains the optional parameters for the Client.GetScope method.

type ClientGetScopeResponse

type ClientGetScopeResponse struct {
	// A data boundary definition.
	DataBoundaryDefinition
}

ClientGetScopeResponse contains the response from method Client.GetScope.

type ClientGetTenantOptions

type ClientGetTenantOptions struct {
}

ClientGetTenantOptions contains the optional parameters for the Client.GetTenant method.

type ClientGetTenantResponse

type ClientGetTenantResponse struct {
	// A data boundary definition.
	DataBoundaryDefinition
}

ClientGetTenantResponse contains the response from method Client.GetTenant.

type ClientPutOptions

type ClientPutOptions struct {
}

ClientPutOptions contains the optional parameters for the Client.Put method.

type ClientPutResponse

type ClientPutResponse struct {
	// A data boundary definition.
	DataBoundaryDefinition
}

ClientPutResponse contains the response from method Client.Put.

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 DataBoundary

type DataBoundary string

DataBoundary - The data boundary definition.

const (
	DataBoundaryEU         DataBoundary = "EU"
	DataBoundaryGlobal     DataBoundary = "Global"
	DataBoundaryNotDefined DataBoundary = "NotDefined"
)

func PossibleDataBoundaryValues

func PossibleDataBoundaryValues() []DataBoundary

PossibleDataBoundaryValues returns the possible values for the DataBoundary const type.

type DataBoundaryDefinition

type DataBoundaryDefinition struct {
	// Data boundary properties
	Properties *DataBoundaryProperties

	// READ-ONLY; Fully qualified resource ID for the resource. E.g. "/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
}

DataBoundaryDefinition - A data boundary definition.

func (DataBoundaryDefinition) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type DataBoundaryDefinition.

func (*DataBoundaryDefinition) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type DataBoundaryDefinition.

type DataBoundaryProperties

type DataBoundaryProperties struct {
	// The data boundary definition.
	DataBoundary *DataBoundary

	// READ-ONLY; Denotes the state of provisioning.
	ProvisioningState *ProvisioningState
}

DataBoundaryProperties - Data boundary properties

func (DataBoundaryProperties) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type DataBoundaryProperties.

func (*DataBoundaryProperties) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type DataBoundaryProperties.

type DefaultName

type DefaultName string
const (
	DefaultNameDefault DefaultName = "default"
)

func PossibleDefaultNameValues

func PossibleDefaultNameValues() []DefaultName

PossibleDefaultNameValues returns the possible values for the DefaultName const type.

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 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 - Denotes the state of provisioning.

const (
	ProvisioningStateAccepted  ProvisioningState = "Accepted"
	ProvisioningStateCanceled  ProvisioningState = "Canceled"
	ProvisioningStateCreating  ProvisioningState = "Creating"
	ProvisioningStateFailed    ProvisioningState = "Failed"
	ProvisioningStateRunning   ProvisioningState = "Running"
	ProvisioningStateSucceeded ProvisioningState = "Succeeded"
	ProvisioningStateUpdating  ProvisioningState = "Updating"
)

func PossibleProvisioningStateValues

func PossibleProvisioningStateValues() []ProvisioningState

PossibleProvisioningStateValues returns the possible values for the ProvisioningState 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