coreapihelpers

package
v0.0.0-...-faf7e9d Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRequestBody

func ApplyRequestBody(requestMethod string, body []byte, v any) error

ApplyRequestBody applies a JSON request body to the value pointed to by v. If the request method is PATCH, the request body is applied to v using JSON Merge Patch (RFC 7396) semantics. Otherwise the request body is unmarshalled directly to v.

func IsValidHostedClusterControlPlaneSize

func IsValidHostedClusterControlPlaneSize(s string) bool

IsValidHostedClusterControlPlaneSize reports whether s names a known tier.

func LeafTypeName

func LeafTypeName(rt azcorearm.ResourceType) string

LeafTypeName returns the trailing segment of an ARM ResourceType (the part after the last slash). Using it in the per-level helpers prevents callers from accidentally embedding the full `namespace/type/...` form twice in the same ID — see the original ToServiceProviderNodePoolResourceIDString bug.

func ListProvisioningStates

func ListProvisioningStates() iter.Seq[coreapi.ProvisioningState]

ListProvisioningStates returns an iterator that yields all recognized ProvisioningState values. This function is intended as a test aid.

func ListSubscriptionStates

func ListSubscriptionStates() iter.Seq[coreapi.SubscriptionState]

ListSubscriptionStates returns an iterator that yields all recognized SubscriptionState values. This function is intended as a test aid.

func ToClusterResourceID

func ToClusterResourceID(subscriptionName, resourceGroupName, clusterName string) (*azcorearm.ResourceID, error)

func ToClusterResourceIDString

func ToClusterResourceIDString(subscriptionName, resourceGroupName, clusterName string) string

func ToDenyAssignmentResourceID

func ToDenyAssignmentResourceID(subscriptionID, resourceGroupName, denyAssignmentName string) (*azcorearm.ResourceID, error)

func ToDenyAssignmentResourceIDString

func ToDenyAssignmentResourceIDString(subscriptionID, resourceGroupName, denyAssignmentName string) string

func ToExternalAuthResourceID

func ToExternalAuthResourceID(subscriptionName, resourceGroupName, clusterName, externalAuthName string) (*azcorearm.ResourceID, error)

func ToExternalAuthResourceIDString

func ToExternalAuthResourceIDString(subscriptionName, resourceGroupName, clusterName, externalAuthName string) string

func ToManagementClusterContentResourceIDString

func ToManagementClusterContentResourceIDString(subscriptionName, resourceGroupName, clusterName, managementClusterContentName string) string

func ToNodePoolResourceID

func ToNodePoolResourceID(subscriptionName, resourceGroupName, clusterName, nodePoolName string) (*azcorearm.ResourceID, error)

func ToNodePoolResourceIDString

func ToNodePoolResourceIDString(subscriptionName, resourceGroupName, clusterName, nodePoolName string) string

func ToOperationResourceIDString

func ToOperationResourceIDString(subscriptionName, operationName string) string

func ToResourceGroupResourceID

func ToResourceGroupResourceID(subscriptionID, resourceGroupName string) (*azcorearm.ResourceID, error)

func ToResourceGroupResourceIDString

func ToResourceGroupResourceIDString(subscriptionName, resourceGroupName string) string

func ToServiceProviderClusterResourceIDString

func ToServiceProviderClusterResourceIDString(subscriptionName, resourceGroupName, clusterName string) string

func ToServiceProviderNodePoolResourceIDString

func ToServiceProviderNodePoolResourceIDString(subscriptionName, resourceGroupName, clusterName, nodePoolName string) string

func ToSubscriptionResourceID

func ToSubscriptionResourceID(subscriptionName string) (*azcorearm.ResourceID, error)

func ToSubscriptionResourceIDString

func ToSubscriptionResourceIDString(subscriptionName string) string

func ToSystemAdminCredentialRequestResourceID

func ToSystemAdminCredentialRequestResourceID(subscriptionName, resourceGroupName, clusterName, credentialName string) (*azcorearm.ResourceID, error)

func ToSystemAdminCredentialRequestResourceIDString

func ToSystemAdminCredentialRequestResourceIDString(subscriptionName, resourceGroupName, clusterName, credentialName string) string

func ToSystemAdminCredentialRevocationResourceID

func ToSystemAdminCredentialRevocationResourceID(subscriptionName, resourceGroupName, clusterName, revocationName string) (*azcorearm.ResourceID, error)

func ToSystemAdminCredentialRevocationResourceIDString

func ToSystemAdminCredentialRevocationResourceIDString(subscriptionName, resourceGroupName, clusterName, revocationName string) string

func UnmarshalDeploymentPreflight

func UnmarshalDeploymentPreflight(data []byte) (*coreapi.DeploymentPreflight, error)

UnmarshalDeploymentPreflight unmarshals JSON-encoded data and returns either a DeploymentPreflight instance or an appropriate CloudError with a 200 OK HTTP status code.

func WriteCloudError

func WriteCloudError(w http.ResponseWriter, err *coreapi.CloudError)

WriteCloudError writes a CloudError to the given ResponseWriter

func WriteConflictError

func WriteConflictError(w http.ResponseWriter, resourceID *azcorearm.ResourceID, format string, a ...interface{})

WriteConflictError writes a conflict error to the given ResponseWriter

func WriteDeploymentPreflightResponse

func WriteDeploymentPreflightResponse(w http.ResponseWriter, preflightErrors []coreapi.CloudErrorBody)

WriteDeploymentPreflightResponse writes an appropriately structured response body to a deployment preflight request using the given error slice. An empty error slice indicates successful validation.

func WriteError

func WriteError(w http.ResponseWriter, statusCode int, code, target, format string, a ...interface{})

WriteError constructs and writes a CloudError to the given ResponseWriter

func WriteInternalServerError

func WriteInternalServerError(w http.ResponseWriter)

WriteInternalServerError writes an internal server error to the given ResponseWriter

func WriteInvalidRequestContentError

func WriteInvalidRequestContentError(w http.ResponseWriter, err error)

WriteInvalidRequestContentError writes an invalid request content error to the given ResponseWriter

func WriteJSONResponse

func WriteJSONResponse(writer http.ResponseWriter, statusCode int, body any) (int, error)

WriteJSONResponse writes a JSON response body to the http.ResponseWriter in the proper sequence: first setting Content-Type to "application/json", then setting the HTTP status code, and finally writing a JSON encoding of body.

The function accepts anything for the body argument that can be marshalled to JSON. One special case, however, is a byte slice. A byte slice will be written verbatim with the expectation that it was produced by Marshal.

func WriteResourceNotFoundError

func WriteResourceNotFoundError(w http.ResponseWriter, resourceID *azcorearm.ResourceID)

WriteResourceNotFoundError writes a nonexistent resource error to the given ResponseWriter

Types

This section is empty.

Jump to

Keyboard shortcuts

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