v1

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APIVersionParameterName is the query string parameter for the api version.
	APIVersionParameterName = "api-version"

	// SkipTokenParameterName is the query string parameter for the skip token which is used for pagination purposes.
	SkipTokenParameterName = "skipToken"

	// TopParameterName is an optional query parameter that defines the number of records requested by the client.
	TopParameterName = "top"
)

The below contants are the headers in request from ARM. https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-details.md#proxy-request-header-modifications

View Source
const (
	// MaxQueryItemCount represents the default value for the maximum number of records to be returned by the server.
	MaxQueryItemCount = 20

	// DefaultQueryItemCount represents the default value for the number of records to be returned by the server.
	DefaultQueryItemCount = 10

	// MinQueryItemCount represents the default value for the minimum number of records to be returned by the server.
	MinQueryItemCount = 5
)

The constants below define the default, max, and min values for the number of records to be returned by the server.

View Source
const (
	// Used for generic validation errors.
	CodeInvalid = "BadRequest"

	// Used for internal/unclassified failures.
	CodeInternal = "Internal"

	// Used when a dependency to carry out current operation is missing.
	CodeDependencyMissing = "DependencyMissing"

	// Used for CodeNotFound error.
	CodeNotFound = "NotFound"

	// Used for CodeConflict error.
	CodeConflict = "Conflict"

	// Used for CodeInvalidResourceType.
	CodeInvalidResourceType = "InvalidResourceType"

	// Used for CodeInvalidAuthenticationInfo.
	CodeInvalidAuthenticationInfo = "InvalidAuthenticationInfo"

	// Used for the cases when the precondition of a request fails.
	CodePreconditionFailed = "PreconditionFailed"

	// Used for CodeOperationCanceled.
	CodeOperationCanceled = "OperationCanceled"

	// Used for invalid api version parameter
	CodeInvalidApiVersionParameter = "InvalidApiVersionParameter"

	// Used for invalid request content.
	CodeInvalidRequestContent = "InvalidRequestContent"

	// Used for invalid object properties.
	CodeInvalidProperties = "InvalidProperties"

	// Used for invalid plane type.
	CodeInvalidPlaneType = "InvalidPlaneType"

	// Used for failed invalid spec api validation.
	CodeHTTPRequestPayloadAPISpecValidationFailed = "HttpRequestPayloadAPISpecValidationFailed"
)

See: https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/common-deployment-errors

We get to define our own codes and document them, these are just examples, but consistency doesn't hurt.

View Source
const (
	// DefaultRetryAfter is the default value in seconds for the Retry-After header. This value is used
	// to determine the polling frequency of the client for long-running operations. Consider setting
	// a smaller value like 5 seconds if your operations are expected to be fast.
	DefaultRetryAfter = "60"

	// DefaultRetryAfterDuration is the default value in time.Duration for the Retry-After header. This value is used
	// to determine the polling frequency of the client for long-running operations. Consider setting
	// a smaller value like 5 seconds if your operations are expected to be fast.
	DefaultRetryAfterDuration = 60 * time.Second
)
View Source
const (
	// LocationGlobal is the sentinel value for the location property in UCP.
	LocationGlobal = "global"
)
View Source
const (
	SubscriptionAPIVersion = "2.0"
)

Variables

View Source
var (
	// AcceptLanguageHeader is the standard http header used so that we don't have to pass in the http request.
	AcceptLanguageHeader = "Accept-Language"

	// HostHeader is the standard http header Host used to indicate the target host name.
	HostHeader = "Host"

	// RefererHeader is the full URI that the client connected to (which will be different than the RP URI, since it will have the public
	// hostname instead of the RP hostname). This value can be used in generating FQDN for Location headers or other requests since RPs
	// should not reference their endpoint name.
	RefererHeader = "Referer"

	// ContentTypeHeader is the standard http header Content-Type.
	ContentTypeHeader = "Content-Type"

	// CorrelationRequestIDHeader is the http header identifying a set of related operations that the request belongs to, in the form of a GUID.
	CorrelationRequestIDHeader = "X-Ms-Correlation-Request-Id"

	// ClientRequestIDHeader is the http header identifying the request, in the form of a GUID with no decoration.
	ClientRequestIDHeader = "X-Ms-Client-Request-Id"

	// ClientReturnClientRequestIDHeader indicates if a client-request-id should be included in the response. Default is false.
	ClientReturnClientRequestIDHeader = "X-Ms-Return-Client-Request-Id"

	// ClientApplicationIDHeader is the app Id of the client JWT making the request.
	ClientApplicationIDHeader = "X-Ms-Client-App-Id"

	// ClientObjectIDHeader is the object Id of the client JWT making the request. Not all users have object Id.
	ClientObjectIDHeader = "X-Ms-Client-Object-Id"

	// ClientPrincipalNameHeader is the principal name / UPN of the client JWT making the request.
	ClientPrincipalNameHeader = "X-Ms-Client-Principal-Name"

	// ClientPrincipalIDHeader is the principal Id of the client JWT making the request.
	ClientPrincipalIDHeader = "X-Ms-Client-Principal-Id"

	// HomeTenantIDHeader is the tenant id of the service principal backed by the identity
	HomeTenantIDHeader = "X-Ms-Home-Tenant-Id"

	// ClientTenantIDHeader is the tenant id of the client
	ClientTenantIDHeader = "X-Ms-Client-Tenant-Id"

	// ARMResourceSystemDataHeader is the http header to the provider on resource write and resource action calls in JSON format.
	// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#properties
	ARMResourceSystemDataHeader = "X-Ms-Arm-Resource-System-Data"

	// TraceparentHeader is W3C trace parent header.
	TraceparentHeader = "Traceparent"

	// IfMatch HTTP request header makes a request conditional. The resource is returned only if the
	// condition (tag or wildcard in this case)in the If-Match is met.
	// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#etags-for-resources
	IfMatch = http.CanonicalHeaderKey("If-Match")

	// IfNoneMatch HTTP request header also makes a request conditional. The resource is returned only
	// if the condition (tag or wildcard in this case) in the If-None-Match is not met.
	// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#etags-for-resources
	IfNoneMatch = http.CanonicalHeaderKey("If-None-Match")
)
View Source
var (
	ErrUnsupportedAPIVersion = errors.New("unsupported api-version")
	// ErrInvalidModelConversion is the error when converting model is invalid.
	ErrInvalidModelConversion = errors.New("invalid model conversion")
)
View Source
var (
	// ErrInvalidOperationType represents the error for invalid operation type string.
	ErrInvalidOperationType = errors.New("failed to parse operation type")
)
View Source
var (
	// ErrTopQueryParamOutOfBounds represents the error of top query parameter being out of defined bounds.
	ErrTopQueryParamOutOfBounds = errors.New("top query parameter is not within the limits")
)
View Source
var (

	// HostingConfigContextKey is the context key for hosting configuration.
	HostingConfigContextKey = &contextKey{"hostingConfig"}
)

Functions

func ParsePathBase

func ParsePathBase(path string) string

ParsePathBase takes in a string and returns a string representing the base path of the string if it contains either "/planes/" or "/subscriptions/", otherwise it returns an empty string.

func UnmarshalTimeString

func UnmarshalTimeString(ts string) *time.Time

UnmarshalTimeString unmarshals a string representation of a time in RFC3339 format into a time.Time object.

func WithARMRequestContext

func WithARMRequestContext(ctx context.Context, armctx *ARMRequestContext) context.Context

WithARMRequestContext adds the ARMRequestContext to the context and returns the new context.

Types

type ARMRequestContext

type ARMRequestContext struct {
	// ResourceID represents arm resource ID extracted from resource id.
	ResourceID resources.ID

	// ClientRequestID represents the client request id from arm request.
	ClientRequestID string
	// CorrelationID represents the request corrleation id from arm request.
	CorrelationID string
	// OperationID represents the unique id per operation, which will be used as async operation id later.
	OperationID uuid.UUID
	// OperationType represents the type of the operation.
	OperationType OperationType
	// Traceparent represents W3C trace prarent header for distributed tracing.
	Traceparent string

	// HomeTenantID represents the tenant id of the service principal.
	HomeTenantID string
	// ClientTenantID represents the tenant id of the client.
	ClientTenantID string

	// The properties of the client identities.
	ClientApplicationID string
	ClientObjectID      string
	ClientPrincipalName string
	ClientPrincipalID   string

	// APIVersion represents api-version of incoming arm request.
	APIVersion string
	// AcceptLanguage represents the supported language of the arm request.
	AcceptLanguage string
	// ClientReferer represents the URI the client connected to.
	ClientReferer string
	// UserAgent represents the user agent name of the arm request.
	UserAgent string
	// RawSystemMetadata is the raw system metadata from arm request. SystemData() returns unmarshalled system metadata
	RawSystemMetadata string
	// Location represents the location of the resource.
	Location string

	// IfMatch receives "*" or an ETag - No support for multiple ETags for now
	IfMatch string
	// IfNoneMatch receives "*" or an ETag - No support for multiple ETags for now
	IfNoneMatch string

	// SkipToken
	SkipToken string
	// Top is the maximum number of records to be returned by the server. The validation will be handled downstream.
	Top int

	// HTTPMethod represents the original method.
	HTTPMethod string
	// OriginalURL represents the original URL of the request.
	OriginalURL url.URL
}

ARMRequestContext represents the service context including proxy request header values.

func ARMRequestContextFromContext

func ARMRequestContextFromContext(ctx context.Context) *ARMRequestContext

ARMRequestContextFromContext retrieves an ARMRequestContext from a given context. Panic if the context does not contain an ARMRequestContext.

func FromARMRequest

func FromARMRequest(r *http.Request, pathBase, location string) (*ARMRequestContext, error)

FromARMRequest extracts proxy request headers from http.Request.

func (ARMRequestContext) SystemData

func (rc ARMRequestContext) SystemData() *SystemData

SystemData returns unmarshalled RawSystemMetaData. It parses the RawSystemMetadata field of the ARMRequestContext struct and returns a SystemData struct, returning an empty SystemData struct if an error occurs during the parsing.

type AsyncOperationStatus

type AsyncOperationStatus struct {
	// Id represents the async operation id.
	ID string `json:"id,omitempty"`

	// Name represents the async operation name and is usually set to the async operation id.
	Name string `json:"name,omitempty"`

	// Status represents the provisioning state of the resource.
	Status ProvisioningState `json:"status,omitempty"`

	// StartTime represents the async operation start time.
	StartTime time.Time `json:"startTime,omitempty"`

	// EndTime represents the async operation end time.
	EndTime *time.Time `json:"endTime,omitempty"`

	// Error represents the error occurred during provisioning.
	Error *ErrorDetails `json:"error,omitempty"`
}

AsyncOperationStatus represents an OperationStatus resource.

type BaseResource

type BaseResource struct {
	TrackedResource
	InternalMetadata

	// SystemData is the systemdata which includes creation/modified dates.
	SystemData SystemData `json:"systemData,omitempty"`
}

BaseResource represents common resource properties used for all resources.

func (*BaseResource) GetBaseResource

func (b *BaseResource) GetBaseResource() *BaseResource

GetBaseResource gets internal base resource.

func (*BaseResource) GetSystemData

func (b *BaseResource) GetSystemData() *SystemData

GetSystemdata gets systemdata.

func (*BaseResource) ProvisioningState

func (b *BaseResource) ProvisioningState() ProvisioningState

ProvisioningState gets the provisioning state.

func (*BaseResource) ResourceTypeName

func (b *BaseResource) ResourceTypeName() string

ResourceTypeName returns resource type name.

func (*BaseResource) SetProvisioningState

func (b *BaseResource) SetProvisioningState(state ProvisioningState)

SetProvisioningState sets the privisioning state of the resource.

func (*BaseResource) UpdateMetadata

func (b *BaseResource) UpdateMetadata(ctx *ARMRequestContext, oldResource *BaseResource)

UpdateMetadata updates the default metadata with new request context and metadata in old resource.

type ConvertToAPIModel

type ConvertToAPIModel[T any] func(model *T, version string) (VersionedModelInterface, error)

ConvertToAPIModel is the function to convert data model to version model.

type ConvertToDataModel

type ConvertToDataModel[T any] func(content []byte, version string) (*T, error)

ConvertToDataModel is the function to convert to data model.

type DataModelInterface

type DataModelInterface interface {
	// ResourceTypeName returns the resource type name.
	ResourceTypeName() string
}

TODO: Remove DataModelInterface when we migrate Controller to Operation base struct for controller DataModelInterface is the interface for version agnostic datamodel.

type ErrClientRP

type ErrClientRP struct {
	Code    string
	Message string
}

func NewClientErrInvalidRequest

func NewClientErrInvalidRequest(message string) *ErrClientRP

NewClientErrInvalidRequest creates a new ErrClientRP error with a given message and sets the code to CodeInvalid.

func (*ErrClientRP) Error

func (r *ErrClientRP) Error() string

Error returns an error string describing the error code and message.

func (*ErrClientRP) Is

func (e *ErrClientRP) Is(target error) bool

Is checks if the target error is the type of ErrClientRP and returns true if it is the same error type.

type ErrModelConversion

type ErrModelConversion struct {
	PropertyName string
	ValidValue   string
}

ErrModelConversion represents an invalid property error.

func (*ErrModelConversion) Error

func (e *ErrModelConversion) Error() string

Error returns an error string describing the property name and valid value.

func (*ErrModelConversion) Is

func (e *ErrModelConversion) Is(target error) bool

Is checks if the target error is of type ErrModelConversion.

type ErrorAdditionalInfo

type ErrorAdditionalInfo struct {
	Type string         `json:"type"`
	Info map[string]any `json:"info"`
}

ErrorAdditionalInfo represents arbitrary additional information as part of an error as defined by the ARM API.

type ErrorDetails

type ErrorDetails struct {
	Code           string                `json:"code"`
	Message        string                `json:"message"`
	Target         string                `json:"target,omitempty"`
	AdditionalInfo []ErrorAdditionalInfo `json:"additionalInfo,omitempty"`
	Details        []ErrorDetails        `json:"details,omitempty"`
}

ErrorDetails represents an error as defined by the ARM API.

func (ErrorDetails) Error

func (e ErrorDetails) Error() string

Error returns error message in ErrorDetails to implement error interface.

type ErrorResponse

type ErrorResponse struct {
	Error ErrorDetails `json:"error"`
}

ErrorResponse represents an error HTTP response as defined by the ARM API.

type FeatureState

type FeatureState string

FeatureState represents the state of a feature for certain subscription

const (
	// FeatureRegistered means the feature is registered to a certain subscription
	FeatureRegistered FeatureState = "Registered"
	// FeatureUnregistered means the feature is unregistered to a certain subscription
	FeatureUnregistered FeatureState = "Unregistered"
)

type InternalMetadata

type InternalMetadata struct {
	// TenantID is the tenant id of the resource.
	TenantID string `json:"tenantId"`
	// CreatedAPIVersion is an api-version used when creating this model.
	CreatedAPIVersion string `json:"createdApiVersion"`
	// UpdatedAPIVersion is an api-version used when updating this model.
	UpdatedAPIVersion string `json:"updatedApiVersion,omitempty"`
	// AsyncProvisioningState is the provisioning state for async operation.
	AsyncProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
}

InternalMetadata represents internal DataModel specific metadata.

type Operation

type Operation struct {
	Name         string                      `json:"name"`
	Display      *OperationDisplayProperties `json:"display"`
	Origin       string                      `json:"origin,omitempty"`
	IsDataAction bool                        `json:"isDataAction"`
}

Operation represents the struct which contains properties of an operation. https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/proxy-api-reference.md#exposing-available-operations

type OperationDisplayProperties

type OperationDisplayProperties struct {
	Description string `json:"description"`
	Operation   string `json:"operation"`
	Provider    string `json:"provider"`
	Resource    string `json:"resource"`
}

OperationDisplayProperties represents the struct which contains the display properties of an operation.

type OperationMethod

type OperationMethod string

OperationMethod is the ARM operation of resource.

const (
	// Predefined Operation methods.
	OperationPlaneScopeList   OperationMethod = "LISTPLANESCOPE"
	OperationList             OperationMethod = "LIST"
	OperationGet              OperationMethod = "GET"
	OperationPut              OperationMethod = "PUT"
	OperationPatch            OperationMethod = "PATCH"
	OperationDelete           OperationMethod = "DELETE"
	OperationPutSubscriptions OperationMethod = "PUTSUBSCRIPTIONS"
	OperationPost             OperationMethod = "POST"

	// OperationGetImperative is used for non-idempotent GET operations.
	OperationGetImperative OperationMethod = "GETIMPERATIVE"

	// OperationPutImperative is used for non-idempotent PUT operations.
	OperationPutImperative OperationMethod = "PUTIMPERATIVE"

	// OperationDeleteImperative is used for non-idempotent DELETE operations.
	OperationDeleteImperative OperationMethod = "DELETEIMPERATIVE"

	// OperationProxy is used for controllers that proxy the underlying request without classifying the type of operation.
	OperationProxy OperationMethod = "PROXY"

	Separator = "|"
)

func (OperationMethod) HTTPMethod

func (o OperationMethod) HTTPMethod() string

HTTPMethod returns HTTP method corresponding to the given OperationMethod, or POST if no corresponding method is found.

type OperationType

type OperationType struct {
	Type   string
	Method OperationMethod
}

OperationType represents the operation type which includes resource type name and its method. OperationType is used as a route name in the frontend API server router. Each valid ARM RPC call should have its own operation type name. For Asynchronous API, the frontend API server queues the async operation request with this operation type. AsyncRequestProcessWorker parses the operation type from the message and run the corresponding async operation controller.

func ParseOperationType

func ParseOperationType(s string) (OperationType, bool)

ParseOperationType parses OperationType from string.

func (OperationType) String

func (o OperationType) String() string

String returns the operation type string.

type PaginatedList

type PaginatedList struct {
	Value    []any  `json:"value"`
	NextLink string `json:"nextLink,omitempty"`
}

PaginatedList represents the object for resource list pagination.

type ProvisioningState

type ProvisioningState string

ProvisioningState is the state of resource.

const (
	ProvisioningStateNone         ProvisioningState = "None"
	ProvisioningStateUpdating     ProvisioningState = "Updating"
	ProvisioningStateDeleting     ProvisioningState = "Deleting"
	ProvisioningStateAccepted     ProvisioningState = "Accepted"
	ProvisioningStateSucceeded    ProvisioningState = "Succeeded"
	ProvisioningStateProvisioning ProvisioningState = "Provisioning"
	ProvisioningStateProvisioned  ProvisioningState = "Provisioned"
	ProvisioningStateFailed       ProvisioningState = "Failed"
	ProvisioningStateCanceled     ProvisioningState = "Canceled"
	ProvisioningStateUndefined    ProvisioningState = "Undefined"
)

func (ProvisioningState) IsTerminal

func (state ProvisioningState) IsTerminal() bool

IsTerminal returns true if given Provisioning State is in a terminal state.

type ResourceDataModel

type ResourceDataModel interface {
	DataModelInterface
	// GetSystemData gets SystemData from the resource.
	GetSystemData() *SystemData
	// GetBaseResource gets BaseResource from the resource.
	GetBaseResource() *BaseResource
	// ProvisioningState gets the provisioning state of the resource.
	ProvisioningState() ProvisioningState
	// SetProvisioningState sets the provisioning state of the resource.
	SetProvisioningState(state ProvisioningState)
	// UpdateMetadata updates and populates metadata to the resource.
	UpdateMetadata(ctx *ARMRequestContext, oldResource *BaseResource)
}

ResourceDataModel represents the datamodel with helper methods.

type Subscription

type Subscription struct {
	State            SubscriptionState       `json:"state"`
	RegistrationDate string                  `json:"registrationDate"`
	Properties       *SubscriptionProperties `json:"properties"`
}

Subscriptions data model https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/subscription-lifecycle-api-reference.md Sample json data in ./testdata directory

type SubscriptionAccountOwner

type SubscriptionAccountOwner struct {
	PUID  string `json:"puid,omitempty"`
	Email string `json:"email,omitempty"`
}

type SubscriptionAdditionalProperties

type SubscriptionAdditionalProperties struct {
	ResourceProviderProperties string                         `json:"resourceProviderProperties,omitempty"`
	BillingProperties          *SubscriptionbillingProperties `json:"billingProperties,omitempty"`
	Promotions                 []*SubscriptionPromotions      `json:"promotions,omitempty"`
}

type SubscriptionBillingAccount

type SubscriptionBillingAccount struct {
	ID string `json:"id,omitempty"`
}

type SubscriptionManagedTenants

type SubscriptionManagedTenants struct {
	TenantID string `json:"tenantId,omitempty"`
}

type SubscriptionPromotions

type SubscriptionPromotions struct {
	Category    string `json:"category,omitempty"`
	EndDateTime string `json:"endDateTime,omitempty"`
}

type SubscriptionProperties

type SubscriptionProperties struct {
	TenantID             string                            `json:"tenantId,omitempty"`
	LocationPlacementID  string                            `json:"locationPlacementId,omitempty"`
	QuotaID              string                            `json:"quotaId,omitempty"`
	AccountOwner         *SubscriptionAccountOwner         `json:"accountOwner,omitempty"`
	RegisteredFeatures   []*SubscriptionRegisteredFeatures `json:"registeredFeatures,omitempty"`
	ManagedByTenants     []*SubscriptionManagedTenants     `json:"managedByTenants,omitempty"`
	AdditionalProperties *SubscriptionAdditionalProperties `json:"additionalProperties"`
}

type SubscriptionRegisteredFeatures

type SubscriptionRegisteredFeatures struct {
	Name  string       `json:"name,omitempty"`
	State FeatureState `json:"state,omitempty"`
}

type SubscriptionState

type SubscriptionState string

SubscriptionState represents the state of the subscription

const (
	// Registered means the subscription is entitled to use the namespace
	Registered SubscriptionState = "Registered"
	// Unregistered means the subscription is not entitled to use the namespace
	Unregistered SubscriptionState = "Unregistered"
	// Warned means the subscription has been warned
	Warned SubscriptionState = "Warned"
	// Suspended means the subscription has been suspended from the system
	Suspended SubscriptionState = "Suspended"
	// Deleted means the subscription has been deleted
	Deleted SubscriptionState = "Deleted"
)

type SubscriptionZoneMappings

type SubscriptionZoneMappings struct {
	LogicalZone  string `json:"logicalZone,omitempty"`
	PhysicalZone string `json:"physicalZone,omitempty"`
}

type SubscriptionbillingProperties

type SubscriptionbillingProperties struct {
	ChannelType    string                      `json:"channelType,omitempty"`
	PaymentType    string                      `json:"paymentType,omitempty"`
	WorkloadType   string                      `json:"workloadType,omitempty"`
	BillingType    string                      `json:"billingType,omitempty"`
	Tier           string                      `json:"tier,omitempty"`
	BillingAccount *SubscriptionBillingAccount `json:"billingAccount,omitempty"`
}

type SystemData

type SystemData struct {
	// CreatedBy is a string identifier for the identity that created the resource.
	CreatedBy string `json:"createdBy,omitempty"`
	// CreatedByType is the type of identity that created the resource: user, application, managedIdentity.
	CreatedByType string `json:"createdByType,omitempty"`
	// CreatedAt is the timestamp of resource creation (UTC).
	CreatedAt string `json:"createdAt,omitempty"`
	// LastModifiedBy is a string identifier for the identity that last modified the resource.
	LastModifiedBy string `json:"lastModifiedBy,omitempty"`
	// LastModifiedBy is the type of identity that last modified the resource: user, application, managedIdentity
	LastModifiedByType string `json:"lastModifiedByType,omitempty"`
	// LastModifiedBy is the timestamp of resource last modification (UTC).
	LastModifiedAt string `json:"lastModifiedAt,omitempty"`
}

SystemData is the readonly metadata pertaining to creation and last modification of the resource. https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources

func UpdateSystemData

func UpdateSystemData(old *SystemData, new *SystemData) SystemData

UpdateSystemData updates the existing SystemData object with the new SystemData object, filling in any missing fields from the old object and backfilling the CreatedAt, CreatedBy, and CreatedByType fields if they are not present in the new object. If either the old or new objects are nil, they are replaced with empty SystemData objects.

type TrackedResource

type TrackedResource struct {
	// ID is the fully qualified resource ID for the resource.
	ID string `json:"id"`
	// Name is the resource name.
	Name string `json:"name"`
	// Type is the resource type.
	Type string `json:"type"`
	// Location is the geo-location where resource is located.
	Location string `json:"location"`
	// Tags is the resource tags.
	Tags map[string]string `json:"tags,omitempty"`
}

TrackedResource represents the common tracked resource.

type VersionedModelInterface

type VersionedModelInterface interface {
	// ConvertFrom converts version agnostic datamodel to versioned model.
	ConvertFrom(src DataModelInterface) error

	// ConvertTo converts versioned model to version agnostic datamodel.
	ConvertTo() (DataModelInterface, error)
}

VersionedModelInterface is the interface for versioned models.

Jump to

Keyboard shortcuts

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