armstorageimportexport

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: MIT Imports: 17 Imported by: 1

README

Azure Storage Import/Export Module for Go

PkgGoDev

The armstorageimportexport module provides operations for working with Azure Storage Import/Export.

Source code

Getting started

Prerequisites

Install the package

This project uses Go modules for versioning and dependency management.

Install the Azure Storage Import/Export module:

go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport

Authorization

When creating a client, you will need to provide a credential for authenticating with Azure Storage Import/Export. The azidentity module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more.

cred, err := azidentity.NewDefaultAzureCredential(nil)

For more information on authentication, please see the documentation for azidentity at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity.

Clients

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

client, err := armstorageimportexport.NewJobsClient(<subscription ID>, cred, nil)

You can use ClientOptions in package github.com/Azure/azure-sdk-for-go/sdk/azcore/arm to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for azcore at pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore.

options := arm.ClientOptions {
    ClientOptions: azcore.ClientOptions {
        Cloud: cloud.AzureChina,
    },
}
client, err := armstorageimportexport.NewJobsClient(<subscription ID>, cred, &options)

Provide Feedback

If you encounter bugs or have suggestions, please open an issue and assign the Storage Import/Export 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 BitLockerKeysClient

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

BitLockerKeysClient contains the methods for the BitLockerKeys group. Don't use this type directly, use NewBitLockerKeysClient() instead.

func NewBitLockerKeysClient

func NewBitLockerKeysClient(subscriptionID string, acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BitLockerKeysClient, error)

NewBitLockerKeysClient creates a new instance of BitLockerKeysClient with the specified values. subscriptionID - The subscription ID for the Azure user. acceptLanguage - Specifies the preferred language for the response. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*BitLockerKeysClient) NewListPager added in v0.4.0

func (client *BitLockerKeysClient) NewListPager(jobName string, resourceGroupName string, options *BitLockerKeysClientListOptions) *runtime.Pager[BitLockerKeysClientListResponse]

NewListPager - Returns the BitLocker Keys for all drives in the specified job. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 jobName - The name of the import/export job. resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. options - BitLockerKeysClientListOptions contains the optional parameters for the BitLockerKeysClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListBitLockerKeys.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armstorageimportexport.NewBitLockerKeysClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
		nil, cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager("myJob",
		"myResourceGroup",
		nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

type BitLockerKeysClientListOptions added in v0.2.0

type BitLockerKeysClientListOptions struct {
}

BitLockerKeysClientListOptions contains the optional parameters for the BitLockerKeysClient.List method.

type BitLockerKeysClientListResponse added in v0.2.0

type BitLockerKeysClientListResponse struct {
	GetBitLockerKeysResponse
}

BitLockerKeysClientListResponse contains the response from method BitLockerKeysClient.List.

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 DeliveryPackageInformation

type DeliveryPackageInformation struct {
	// REQUIRED; The name of the carrier that is used to ship the import or export drives.
	CarrierName *string `json:"carrierName,omitempty"`

	// REQUIRED; The tracking number of the package.
	TrackingNumber *string `json:"trackingNumber,omitempty"`

	// The number of drives included in the package.
	DriveCount *int64 `json:"driveCount,omitempty"`

	// The date when the package is shipped.
	ShipDate *string `json:"shipDate,omitempty"`
}

DeliveryPackageInformation - Contains information about the delivery package being shipped by the customer to the Microsoft data center.

type DriveBitLockerKey

type DriveBitLockerKey struct {
	// BitLocker recovery key or password
	BitLockerKey *string `json:"bitLockerKey,omitempty"`

	// Drive ID
	DriveID *string `json:"driveId,omitempty"`
}

DriveBitLockerKey - BitLocker recovery key or password to the specified drive

type DriveState

type DriveState string

DriveState - The drive's current state.

const (
	DriveStateCompleted         DriveState = "Completed"
	DriveStateCompletedMoreInfo DriveState = "CompletedMoreInfo"
	DriveStateNeverReceived     DriveState = "NeverReceived"
	DriveStateReceived          DriveState = "Received"
	DriveStateShippedBack       DriveState = "ShippedBack"
	DriveStateSpecified         DriveState = "Specified"
	DriveStateTransferring      DriveState = "Transferring"
)

func PossibleDriveStateValues

func PossibleDriveStateValues() []DriveState

PossibleDriveStateValues returns the possible values for the DriveState const type.

type DriveStatus

type DriveStatus struct {
	// The BitLocker key used to encrypt the drive.
	BitLockerKey *string `json:"bitLockerKey,omitempty"`

	// Bytes successfully transferred for the drive.
	BytesSucceeded *int64 `json:"bytesSucceeded,omitempty"`

	// Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring
	// state.
	CopyStatus *string `json:"copyStatus,omitempty"`

	// The drive header hash value.
	DriveHeaderHash *string `json:"driveHeaderHash,omitempty"`

	// The drive's hardware serial number, without spaces.
	DriveID *string `json:"driveId,omitempty"`

	// A URI that points to the blob containing the error log for the data transfer operation.
	ErrorLogURI *string `json:"errorLogUri,omitempty"`

	// The relative path of the manifest file on the drive.
	ManifestFile *string `json:"manifestFile,omitempty"`

	// The Base16-encoded MD5 hash of the manifest file on the drive.
	ManifestHash *string `json:"manifestHash,omitempty"`

	// A URI that points to the blob containing the drive manifest file.
	ManifestURI *string `json:"manifestUri,omitempty"`

	// Percentage completed for the drive.
	PercentComplete *int64 `json:"percentComplete,omitempty"`

	// The drive's current state.
	State *DriveState `json:"state,omitempty"`

	// A URI that points to the blob containing the verbose log for the data transfer operation.
	VerboseLogURI *string `json:"verboseLogUri,omitempty"`
}

DriveStatus - Provides information about the drive's status

type EncryptionKekType

type EncryptionKekType string

EncryptionKekType - The type of kek encryption key

const (
	EncryptionKekTypeCustomerManaged  EncryptionKekType = "CustomerManaged"
	EncryptionKekTypeMicrosoftManaged EncryptionKekType = "MicrosoftManaged"
)

func PossibleEncryptionKekTypeValues

func PossibleEncryptionKekTypeValues() []EncryptionKekType

PossibleEncryptionKekTypeValues returns the possible values for the EncryptionKekType const type.

type EncryptionKeyDetails

type EncryptionKeyDetails struct {
	// The type of kek encryption key
	KekType *EncryptionKekType `json:"kekType,omitempty"`

	// Specifies the url for kek encryption key.
	KekURL *string `json:"kekUrl,omitempty"`

	// Specifies the keyvault resource id for kek encryption key.
	KekVaultResourceID *string `json:"kekVaultResourceID,omitempty"`
}

EncryptionKeyDetails - Specifies the encryption key properties

type ErrorResponse

type ErrorResponse struct {
	// Describes the error information.
	Error *ErrorResponseError `json:"error,omitempty"`
}

ErrorResponse - Response when errors occurred

type ErrorResponseError

type ErrorResponseError struct {
	// Provides information about the error code.
	Code *string `json:"code,omitempty"`

	// Describes the error details if present.
	Details []*ErrorResponseErrorDetailsItem `json:"details,omitempty"`

	// Inner error object if present.
	Innererror interface{} `json:"innererror,omitempty"`

	// Provides information about the error message.
	Message *string `json:"message,omitempty"`

	// Provides information about the error target.
	Target *string `json:"target,omitempty"`
}

ErrorResponseError - Describes the error information.

type ErrorResponseErrorDetailsItem

type ErrorResponseErrorDetailsItem struct {
	// Provides information about the error code.
	Code *string `json:"code,omitempty"`

	// Provides information about the error message.
	Message *string `json:"message,omitempty"`

	// Provides information about the error target.
	Target *string `json:"target,omitempty"`
}

type Export

type Export struct {
	// A list of the blobs to be exported.
	BlobList *ExportBlobList `json:"blobList,omitempty"`

	// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning
	// with the container name. If the blob is in root container, the URI must begin
	// with $root.
	BlobListBlobPath *string `json:"blobListBlobPath,omitempty"`
}

Export - A property containing information about the blobs to be exported for an export job. This property is required for export jobs, but must not be specified for import jobs.

type ExportBlobList

type ExportBlobList struct {
	// A collection of blob-path strings.
	BlobPath []*string `json:"blobPath,omitempty"`

	// A collection of blob-prefix strings.
	BlobPathPrefix []*string `json:"blobPathPrefix,omitempty"`
}

ExportBlobList - A list of the blobs to be exported.

func (ExportBlobList) MarshalJSON

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

MarshalJSON implements the json.Marshaller interface for type ExportBlobList.

type GetBitLockerKeysResponse

type GetBitLockerKeysResponse struct {
	// drive status
	Value []*DriveBitLockerKey `json:"value,omitempty"`
}

GetBitLockerKeysResponse - GetBitLockerKeys response

type IdentityDetails

type IdentityDetails struct {
	// The type of identity
	Type *IdentityType `json:"type,omitempty"`

	// READ-ONLY; Specifies the principal id for the identity for the job.
	PrincipalID *string `json:"principalId,omitempty" azure:"ro"`

	// READ-ONLY; Specifies the tenant id for the identity for the job.
	TenantID *string `json:"tenantId,omitempty" azure:"ro"`
}

IdentityDetails - Specifies the identity properties.

type IdentityType

type IdentityType string

IdentityType - The type of identity

const (
	IdentityTypeNone           IdentityType = "None"
	IdentityTypeSystemAssigned IdentityType = "SystemAssigned"
	IdentityTypeUserAssigned   IdentityType = "UserAssigned"
)

func PossibleIdentityTypeValues

func PossibleIdentityTypeValues() []IdentityType

PossibleIdentityTypeValues returns the possible values for the IdentityType const type.

type JobDetails

type JobDetails struct {
	// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs.
	BackupDriveManifest *bool `json:"backupDriveManifest,omitempty"`

	// Indicates whether a request has been submitted to cancel the job.
	CancelRequested *bool `json:"cancelRequested,omitempty"`

	// Contains information about the package being shipped by the customer to the Microsoft data center.
	DeliveryPackage *DeliveryPackageInformation `json:"deliveryPackage,omitempty"`

	// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored.
	DiagnosticsPath *string `json:"diagnosticsPath,omitempty"`

	// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified
	// for export jobs.
	DriveList []*DriveStatus `json:"driveList,omitempty"`

	// Contains information about the encryption key.
	EncryptionKey *EncryptionKeyDetails `json:"encryptionKey,omitempty"`

	// A property containing information about the blobs to be exported for an export job. This property is included for export
	// jobs only.
	Export *Export `json:"export,omitempty"`

	// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive
	// space. If all blobs were exported successfully, then this element is not
	// included in the response.
	IncompleteBlobListURI *string `json:"incompleteBlobListUri,omitempty"`

	// The type of job
	JobType *string `json:"jobType,omitempty"`

	// Default value is Error. Indicates whether error logging or verbose logging will be enabled.
	LogLevel *string `json:"logLevel,omitempty"`

	// Overall percentage completed for the job.
	PercentComplete *int64 `json:"percentComplete,omitempty"`

	// Specifies the provisioning state of the job.
	ProvisioningState *string `json:"provisioningState,omitempty"`

	// Specifies the return address information for the job.
	ReturnAddress *ReturnAddress `json:"returnAddress,omitempty"`

	// Contains information about the package being shipped from the Microsoft data center to the customer to return the drives.
	// The format is the same as the deliveryPackage property above. This property is
	// not included if the drives have not yet been returned.
	ReturnPackage *PackageInformation `json:"returnPackage,omitempty"`

	// Specifies the return carrier and customer's account with the carrier.
	ReturnShipping *ReturnShipping `json:"returnShipping,omitempty"`

	// Contains information about the Microsoft datacenter to which the drives should be shipped.
	ShippingInformation *ShippingInformation `json:"shippingInformation,omitempty"`

	// Current state of the job.
	State *string `json:"state,omitempty"`

	// The resource identifier of the storage account where data will be imported to or exported from.
	StorageAccountID *string `json:"storageAccountId,omitempty"`
}

JobDetails - Specifies the job properties

func (JobDetails) MarshalJSON

func (j JobDetails) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type JobDetails.

type JobResponse

type JobResponse struct {
	// Specifies the job identity details
	Identity *IdentityDetails `json:"identity,omitempty"`

	// Specifies the Azure location where the job is created.
	Location *string `json:"location,omitempty"`

	// Specifies the job properties
	Properties *JobDetails `json:"properties,omitempty"`

	// Specifies the tags that are assigned to the job.
	Tags interface{} `json:"tags,omitempty"`

	// READ-ONLY; Specifies the resource identifier of the job.
	ID *string `json:"id,omitempty" azure:"ro"`

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

	// READ-ONLY; SystemData of ImportExport Jobs.
	SystemData *SystemData `json:"systemData,omitempty" azure:"ro"`

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

JobResponse - Contains the job information.

type JobsClient

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

JobsClient contains the methods for the Jobs group. Don't use this type directly, use NewJobsClient() instead.

func NewJobsClient

func NewJobsClient(subscriptionID string, acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobsClient, error)

NewJobsClient creates a new instance of JobsClient with the specified values. subscriptionID - The subscription ID for the Azure user. acceptLanguage - Specifies the preferred language for the response. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*JobsClient) Create

func (client *JobsClient) Create(ctx context.Context, jobName string, resourceGroupName string, body PutJobParameters, options *JobsClientCreateOptions) (JobsClientCreateResponse, error)

Create - Creates a new job or updates an existing job in the specified subscription. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 jobName - The name of the import/export job. resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. body - The parameters used for creating the job options - JobsClientCreateOptions contains the optional parameters for the JobsClient.Create method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/CreateExportJob.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/storageimportexport/armstorageimportexport"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
		nil, cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Create(ctx,
		"myExportJob",
		"myResourceGroup",
		armstorageimportexport.PutJobParameters{
			Location: to.Ptr("West US"),
			Properties: &armstorageimportexport.JobDetails{
				BackupDriveManifest: to.Ptr(true),
				DiagnosticsPath:     to.Ptr("waimportexport"),
				Export: &armstorageimportexport.Export{
					BlobList: &armstorageimportexport.ExportBlobList{
						BlobPathPrefix: []*string{
							to.Ptr("/")},
					},
				},
				JobType:  to.Ptr("Export"),
				LogLevel: to.Ptr("Verbose"),
				ReturnAddress: &armstorageimportexport.ReturnAddress{
					City:            to.Ptr("Redmond"),
					CountryOrRegion: to.Ptr("USA"),
					Email:           to.Ptr("Test@contoso.com"),
					Phone:           to.Ptr("4250000000"),
					PostalCode:      to.Ptr("98007"),
					RecipientName:   to.Ptr("Test"),
					StateOrProvince: to.Ptr("wa"),
					StreetAddress1:  to.Ptr("Street1"),
					StreetAddress2:  to.Ptr("street2"),
				},
				ReturnShipping: &armstorageimportexport.ReturnShipping{
					CarrierAccountNumber: to.Ptr("989ffff"),
					CarrierName:          to.Ptr("FedEx"),
				},
				StorageAccountID: to.Ptr("/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.ClassicStorage/storageAccounts/test"),
			},
		},
		&armstorageimportexport.JobsClientCreateOptions{ClientTenantID: nil})
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*JobsClient) Delete

func (client *JobsClient) Delete(ctx context.Context, jobName string, resourceGroupName string, options *JobsClientDeleteOptions) (JobsClientDeleteResponse, error)

Delete - Deletes an existing job. Only jobs in the Creating or Completed states can be deleted. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 jobName - The name of the import/export job. resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. options - JobsClientDeleteOptions contains the optional parameters for the JobsClient.Delete method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/DeleteJob.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
		nil, cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	_, err = client.Delete(ctx,
		"myJob",
		"myResourceGroup",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
}
Output:

func (*JobsClient) Get

func (client *JobsClient) Get(ctx context.Context, jobName string, resourceGroupName string, options *JobsClientGetOptions) (JobsClientGetResponse, error)

Get - Gets information about an existing job. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 jobName - The name of the import/export job. resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. options - JobsClientGetOptions contains the optional parameters for the JobsClient.Get method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/GetExportJob.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
		nil, cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"myJob",
		"myResourceGroup",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*JobsClient) NewListByResourceGroupPager added in v0.4.0

func (client *JobsClient) NewListByResourceGroupPager(resourceGroupName string, options *JobsClientListByResourceGroupOptions) *runtime.Pager[JobsClientListByResourceGroupResponse]

NewListByResourceGroupPager - Returns all active and completed jobs in a resource group. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. options - JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.ListByResourceGroup method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListJobsInResourceGroup.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
		nil, cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListByResourceGroupPager("myResourceGroup",
		&armstorageimportexport.JobsClientListByResourceGroupOptions{Top: nil,
			Filter: nil,
		})
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*JobsClient) NewListBySubscriptionPager added in v0.4.0

NewListBySubscriptionPager - Returns all active and completed jobs in a subscription. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 options - JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.ListBySubscription method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListJobsInSubscription.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
		nil, cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListBySubscriptionPager(&armstorageimportexport.JobsClientListBySubscriptionOptions{Top: nil,
		Filter: nil,
	})
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

func (*JobsClient) Update

func (client *JobsClient) Update(ctx context.Context, jobName string, resourceGroupName string, body UpdateJobParameters, options *JobsClientUpdateOptions) (JobsClientUpdateResponse, error)

Update - Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing job. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 jobName - The name of the import/export job. resourceGroupName - The resource group name uniquely identifies the resource group within the user subscription. body - The parameters to update in the job options - JobsClientUpdateOptions contains the optional parameters for the JobsClient.Update method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/UpdateExportJob.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/storageimportexport/armstorageimportexport"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armstorageimportexport.NewJobsClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
		nil, cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Update(ctx,
		"myExportJob",
		"myResourceGroup",
		armstorageimportexport.UpdateJobParameters{
			Properties: &armstorageimportexport.UpdateJobParametersProperties{
				BackupDriveManifest: to.Ptr(true),
				LogLevel:            to.Ptr("Verbose"),
				State:               to.Ptr(""),
			},
		},
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

type JobsClientCreateOptions added in v0.2.0

type JobsClientCreateOptions struct {
	// The tenant ID of the client making the request.
	ClientTenantID *string
}

JobsClientCreateOptions contains the optional parameters for the JobsClient.Create method.

type JobsClientCreateResponse added in v0.2.0

type JobsClientCreateResponse struct {
	JobResponse
}

JobsClientCreateResponse contains the response from method JobsClient.Create.

type JobsClientDeleteOptions added in v0.2.0

type JobsClientDeleteOptions struct {
}

JobsClientDeleteOptions contains the optional parameters for the JobsClient.Delete method.

type JobsClientDeleteResponse added in v0.2.0

type JobsClientDeleteResponse struct {
}

JobsClientDeleteResponse contains the response from method JobsClient.Delete.

type JobsClientGetOptions added in v0.2.0

type JobsClientGetOptions struct {
}

JobsClientGetOptions contains the optional parameters for the JobsClient.Get method.

type JobsClientGetResponse added in v0.2.0

type JobsClientGetResponse struct {
	JobResponse
}

JobsClientGetResponse contains the response from method JobsClient.Get.

type JobsClientListByResourceGroupOptions added in v0.2.0

type JobsClientListByResourceGroupOptions struct {
	// Can be used to restrict the results to certain conditions.
	Filter *string
	// An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100.
	Top *int64
}

JobsClientListByResourceGroupOptions contains the optional parameters for the JobsClient.ListByResourceGroup method.

type JobsClientListByResourceGroupResponse added in v0.2.0

type JobsClientListByResourceGroupResponse struct {
	ListJobsResponse
}

JobsClientListByResourceGroupResponse contains the response from method JobsClient.ListByResourceGroup.

type JobsClientListBySubscriptionOptions added in v0.2.0

type JobsClientListBySubscriptionOptions struct {
	// Can be used to restrict the results to certain conditions.
	Filter *string
	// An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100.
	Top *int64
}

JobsClientListBySubscriptionOptions contains the optional parameters for the JobsClient.ListBySubscription method.

type JobsClientListBySubscriptionResponse added in v0.2.0

type JobsClientListBySubscriptionResponse struct {
	ListJobsResponse
}

JobsClientListBySubscriptionResponse contains the response from method JobsClient.ListBySubscription.

type JobsClientUpdateOptions added in v0.2.0

type JobsClientUpdateOptions struct {
}

JobsClientUpdateOptions contains the optional parameters for the JobsClient.Update method.

type JobsClientUpdateResponse added in v0.2.0

type JobsClientUpdateResponse struct {
	JobResponse
}

JobsClientUpdateResponse contains the response from method JobsClient.Update.

type ListJobsResponse

type ListJobsResponse struct {
	// link to next batch of jobs
	NextLink *string `json:"nextLink,omitempty"`

	// Job list
	Value []*JobResponse `json:"value,omitempty"`
}

ListJobsResponse - List jobs response

type ListOperationsResponse

type ListOperationsResponse struct {
	// operations
	Value []*Operation `json:"value,omitempty"`
}

ListOperationsResponse - List operations response

type Location

type Location struct {
	// Specifies the resource identifier of the location.
	ID *string `json:"id,omitempty"`

	// Specifies the name of the location. Use List Locations to get all supported locations.
	Name *string `json:"name,omitempty"`

	// location properties
	Properties *LocationProperties `json:"properties,omitempty"`

	// Specifies the type of the location.
	Type *string `json:"type,omitempty"`
}

Location - Provides information about an Azure data center location.

type LocationProperties

type LocationProperties struct {
	// Additional shipping information for customer, specific to datacenter to which customer should send their disks.
	AdditionalShippingInformation *string `json:"additionalShippingInformation,omitempty"`

	// A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If
	// the current location is active, it will be part of the list. If it is
	// temporarily closed due to maintenance, this list may contain other locations.
	AlternateLocations []*string `json:"alternateLocations,omitempty"`

	// The city name to use when shipping the drives to the Azure data center.
	City *string `json:"city,omitempty"`

	// The country or region to use when shipping the drives to the Azure data center.
	CountryOrRegion *string `json:"countryOrRegion,omitempty"`

	// The phone number for the Azure data center.
	Phone *string `json:"phone,omitempty"`

	// The postal code to use when shipping the drives to the Azure data center.
	PostalCode *string `json:"postalCode,omitempty"`

	// The recipient name to use when shipping the drives to the Azure data center.
	RecipientName *string `json:"recipientName,omitempty"`

	// The state or province to use when shipping the drives to the Azure data center.
	StateOrProvince *string `json:"stateOrProvince,omitempty"`

	// The first line of the street address to use when shipping the drives to the Azure data center.
	StreetAddress1 *string `json:"streetAddress1,omitempty"`

	// The second line of the street address to use when shipping the drives to the Azure data center.
	StreetAddress2 *string `json:"streetAddress2,omitempty"`

	// A list of carriers that are supported at this location.
	SupportedCarriers []*string `json:"supportedCarriers,omitempty"`
}

LocationProperties - location properties

type LocationsClient

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

LocationsClient contains the methods for the Locations group. Don't use this type directly, use NewLocationsClient() instead.

func NewLocationsClient

func NewLocationsClient(acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error)

NewLocationsClient creates a new instance of LocationsClient with the specified values. acceptLanguage - Specifies the preferred language for the response. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*LocationsClient) Get

Get - Returns the details about a location to which you can ship the disks associated with an import or export job. A location is an Azure region. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 locationName - The name of the location. For example, West US or westus. options - LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/GetLocation.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armstorageimportexport.NewLocationsClient(nil, cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := client.Get(ctx,
		"West US",
		nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// TODO: use response item
	_ = res
}
Output:

func (*LocationsClient) NewListPager added in v0.4.0

NewListPager - Returns a list of locations to which you can ship the disks associated with an import or export job. A location is a Microsoft data center region. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 options - LocationsClientListOptions contains the optional parameters for the LocationsClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-01/examples/ListLocations.json

package main

import (
	"context"
	"log"

	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storageimportexport/armstorageimportexport"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armstorageimportexport.NewLocationsClient(nil, cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager(nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

type LocationsClientGetOptions added in v0.2.0

type LocationsClientGetOptions struct {
}

LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method.

type LocationsClientGetResponse added in v0.2.0

type LocationsClientGetResponse struct {
	Location
}

LocationsClientGetResponse contains the response from method LocationsClient.Get.

type LocationsClientListOptions added in v0.2.0

type LocationsClientListOptions struct {
}

LocationsClientListOptions contains the optional parameters for the LocationsClient.List method.

type LocationsClientListResponse added in v0.2.0

type LocationsClientListResponse struct {
	LocationsResponse
}

LocationsClientListResponse contains the response from method LocationsClient.List.

type LocationsResponse

type LocationsResponse struct {
	// locations
	Value []*Location `json:"value,omitempty"`
}

LocationsResponse - Locations response

type Operation

type Operation struct {
	// REQUIRED; operation display properties
	Display *OperationDisplay `json:"display,omitempty"`

	// REQUIRED; Name of the operation.
	Name *string `json:"name,omitempty"`
}

Operation - Describes a supported operation by the Storage Import/Export job API.

type OperationDisplay

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

	// The display name of the operation.
	Operation *string `json:"operation,omitempty"`

	// The resource provider name to which the operation belongs.
	Provider *string `json:"provider,omitempty"`

	// The name of the resource to which the operation belongs.
	Resource *string `json:"resource,omitempty"`
}

OperationDisplay - operation display properties

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(acceptLanguage *string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error)

NewOperationsClient creates a new instance of OperationsClient with the specified values. acceptLanguage - Specifies the preferred language for the response. credential - used to authorize requests. Usually a credential from azidentity. options - pass nil to accept the default values.

func (*OperationsClient) NewListPager added in v0.4.0

NewListPager - Returns the list of operations supported by the import/export resource provider. If the operation fails it returns an *azcore.ResponseError type. Generated from API version 2021-01-01 options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method.

Example

Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/storageimportexport/resource-manager/Microsoft.ImportExport/preview/2021-01-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/storageimportexport/armstorageimportexport"
)

func main() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	client, err := armstorageimportexport.NewOperationsClient(nil, cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := client.NewListPager(nil)
	for pager.More() {
		nextResult, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range nextResult.Value {
			// TODO: use page item
			_ = v
		}
	}
}
Output:

type OperationsClientListOptions added in v0.2.0

type OperationsClientListOptions struct {
}

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

type OperationsClientListResponse added in v0.2.0

type OperationsClientListResponse struct {
	ListOperationsResponse
}

OperationsClientListResponse contains the response from method OperationsClient.List.

type PackageInformation

type PackageInformation struct {
	// REQUIRED; The name of the carrier that is used to ship the import or export drives.
	CarrierName *string `json:"carrierName,omitempty"`

	// REQUIRED; The number of drives included in the package.
	DriveCount *int64 `json:"driveCount,omitempty"`

	// REQUIRED; The date when the package is shipped.
	ShipDate *string `json:"shipDate,omitempty"`

	// REQUIRED; The tracking number of the package.
	TrackingNumber *string `json:"trackingNumber,omitempty"`
}

PackageInformation - Contains information about the package being shipped by the customer to the Microsoft data center.

type PutJobParameters

type PutJobParameters struct {
	// Specifies the supported Azure location where the job should be created
	Location *string `json:"location,omitempty"`

	// Specifies the job properties
	Properties *JobDetails `json:"properties,omitempty"`

	// Specifies the tags that will be assigned to the job.
	Tags interface{} `json:"tags,omitempty"`
}

PutJobParameters - Put Job parameters

type ReturnAddress

type ReturnAddress struct {
	// REQUIRED; The city name to use when returning the drives.
	City *string `json:"city,omitempty"`

	// REQUIRED; The country or region to use when returning the drives.
	CountryOrRegion *string `json:"countryOrRegion,omitempty"`

	// REQUIRED; Email address of the recipient of the returned drives.
	Email *string `json:"email,omitempty"`

	// REQUIRED; Phone number of the recipient of the returned drives.
	Phone *string `json:"phone,omitempty"`

	// REQUIRED; The postal code to use when returning the drives.
	PostalCode *string `json:"postalCode,omitempty"`

	// REQUIRED; The name of the recipient who will receive the hard drives when they are returned.
	RecipientName *string `json:"recipientName,omitempty"`

	// REQUIRED; The first line of the street address to use when returning the drives.
	StreetAddress1 *string `json:"streetAddress1,omitempty"`

	// The state or province to use when returning the drives.
	StateOrProvince *string `json:"stateOrProvince,omitempty"`

	// The second line of the street address to use when returning the drives.
	StreetAddress2 *string `json:"streetAddress2,omitempty"`
}

ReturnAddress - Specifies the return address information for the job.

type ReturnShipping

type ReturnShipping struct {
	// REQUIRED; The customer's account number with the carrier.
	CarrierAccountNumber *string `json:"carrierAccountNumber,omitempty"`

	// REQUIRED; The carrier's name.
	CarrierName *string `json:"carrierName,omitempty"`
}

ReturnShipping - Specifies the return carrier and customer's account with the carrier.

type ShippingInformation

type ShippingInformation struct {
	// The city name to use when returning the drives.
	City *string `json:"city,omitempty"`

	// The country or region to use when returning the drives.
	CountryOrRegion *string `json:"countryOrRegion,omitempty"`

	// Phone number of the recipient of the returned drives.
	Phone *string `json:"phone,omitempty"`

	// The postal code to use when returning the drives.
	PostalCode *string `json:"postalCode,omitempty"`

	// The name of the recipient who will receive the hard drives when they are returned.
	RecipientName *string `json:"recipientName,omitempty"`

	// The state or province to use when returning the drives.
	StateOrProvince *string `json:"stateOrProvince,omitempty"`

	// The first line of the street address to use when returning the drives.
	StreetAddress1 *string `json:"streetAddress1,omitempty"`

	// The second line of the street address to use when returning the drives.
	StreetAddress2 *string `json:"streetAddress2,omitempty"`

	// READ-ONLY; Additional shipping information for customer, specific to datacenter to which customer should send their disks.
	AdditionalInformation *string `json:"additionalInformation,omitempty" azure:"ro"`
}

ShippingInformation - Contains information about the Microsoft datacenter to which the drives should be shipped.

type SystemData

type SystemData struct {
	// The timestamp of resource creation (UTC).
	CreatedAt *time.Time `json:"createdAt,omitempty"`

	// The identity that created the resource.
	CreatedBy *string `json:"createdBy,omitempty"`

	// The type of identity that created the resource.
	CreatedByType *CreatedByType `json:"createdByType,omitempty"`

	// The timestamp of resource last modification (UTC)
	LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"`

	// The identity that last modified the resource.
	LastModifiedBy *string `json:"lastModifiedBy,omitempty"`

	// The type of identity that last modified the resource.
	LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"`
}

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

func (*SystemData) UnmarshalJSON

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

UnmarshalJSON implements the json.Unmarshaller interface for type SystemData.

type UpdateJobParameters

type UpdateJobParameters struct {
	// Specifies the properties of a UpdateJob.
	Properties *UpdateJobParametersProperties `json:"properties,omitempty"`

	// Specifies the tags that will be assigned to the job
	Tags interface{} `json:"tags,omitempty"`
}

UpdateJobParameters - Update Job parameters

func (UpdateJobParameters) MarshalJSON

func (u UpdateJobParameters) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type UpdateJobParameters.

type UpdateJobParametersProperties

type UpdateJobParametersProperties struct {
	// Indicates whether the manifest files on the drives should be copied to block blobs.
	BackupDriveManifest *bool `json:"backupDriveManifest,omitempty"`

	// If specified, the value must be true. The service will attempt to cancel the job.
	CancelRequested *bool `json:"cancelRequested,omitempty"`

	// Contains information about the package being shipped by the customer to the Microsoft data center.
	DeliveryPackage *DeliveryPackageInformation `json:"deliveryPackage,omitempty"`

	// List of drives that comprise the job.
	DriveList []*DriveStatus `json:"driveList,omitempty"`

	// Indicates whether error logging or verbose logging is enabled.
	LogLevel *string `json:"logLevel,omitempty"`

	// Specifies the return address information for the job.
	ReturnAddress *ReturnAddress `json:"returnAddress,omitempty"`

	// Specifies the return carrier and customer's account with the carrier.
	ReturnShipping *ReturnShipping `json:"returnShipping,omitempty"`

	// If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped.
	// The ReturnAddress and DeliveryPackage properties must have been set
	// either in this request or in a previous request, otherwise the request will fail.
	State *string `json:"state,omitempty"`
}

UpdateJobParametersProperties - Specifies the properties of a UpdateJob.

func (UpdateJobParametersProperties) MarshalJSON

func (u UpdateJobParametersProperties) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface for type UpdateJobParametersProperties.

Jump to

Keyboard shortcuts

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