Documentation
¶
Index ¶
- Constants
- Variables
- func AddCreateCommonFlags(cmd *cobra.Command) *cobra.Command
- func AddUpdateCommonFlags(cmd *cobra.Command) *cobra.Command
- func AuthorizationScheme(ep *serviceendpoint.ServiceEndpoint) string
- func DecodeContent(raw []byte, encodingName string) ([]byte, error)
- func DescribeInput(path string) string
- func EnsureProjectReferenceIncluded(refs *[]serviceendpoint.ServiceEndpointProjectReference, ...)
- func FindServiceEndpoint(ctx util.CmdContext, client serviceendpoint.Client, project, identifier string) (*serviceendpoint.ServiceEndpoint, error)
- func FormatProjectReference(refs *[]serviceendpoint.ServiceEndpointProjectReference) string
- func GetServiceEndpointTypes(cmdCtx util.CmdContext, organization string) ([]serviceendpoint.ServiceEndpointType, error)
- func NormalizeEncoding(value string) (string, error)
- func Output(ctx util.CmdContext, endpoint *serviceendpoint.ServiceEndpoint, ...) error
- func ReadServiceEndpointFromFile(stdin io.ReadCloser, path, encoding string) (*serviceendpoint.ServiceEndpoint, error)
- func RedactSecrets(ep *serviceendpoint.ServiceEndpoint)
- func ResolveProjectReference(ctx util.CmdContext, scope *util.Scope) (*serviceendpoint.ProjectReference, error)
- func RunTypedCreate(cmd *cobra.Command, args []string, cfg EndpointTypeConfigurer) error
- func RunTypedUpdate(cmd *cobra.Command, args []string, cfg EndpointTypeConfigurer) error
- func SetAllPipelinesAccessToEndpoint(cmdCtx util.CmdContext, organization string, projectID uuid.UUID, ...) error
- func TestConnection(cmdCtx util.CmdContext, client serviceendpoint.Client, ...) error
- func ValidateEndpointAgainstMetadata(cmdCtx util.CmdContext, organization string, ...) error
- func ValidateEndpointPayload(endpoint *serviceendpoint.ServiceEndpoint, requireIdentityFields bool) error
- func WaitForReady(ctx context.Context, client serviceendpoint.Client, project string, ...) (*serviceendpoint.ServiceEndpoint, error)
- type CleanupFunc
- type EndpointTypeConfigurer
Constants ¶
const (
// EndpointResourceType is the Azure DevOps pipeline permission resource type for service connections.
EndpointResourceType = "endpoint"
)
Variables ¶
var EncodingAliases = map[string]string{
"utf-8": "utf-8",
"utf8": "utf-8",
"ascii": "ascii",
"utf-16be": "utf-16be",
"utf16be": "utf-16be",
"utf-16le": "utf-16le",
"utf16le": "utf-16le",
}
var ErrEndpointNotFound = errors.New("service endpoint not found")
ErrEndpointNotFound indicates that the requested service endpoint could not be located in the target project.
var ServiceEndpointJSONFields = []string{
"administratorsGroup",
"authorization",
"createdBy",
"data",
"description",
"groupScopeId",
"id",
"isReady",
"isShared",
"name",
"operationStatus",
"owner",
"readersGroup",
"serviceEndpointProjectReferences",
"type",
"url",
}
ServiceEndpointJSONFields defines the list of fields exposed for JSON output by service-endpoint commands.
Functions ¶
func AddCreateCommonFlags ¶ added in v0.7.0
AddCreateCommonFlags registers the common flags on a create command.
func AddUpdateCommonFlags ¶ added in v0.7.0
AddUpdateCommonFlags registers the common flags on an update command.
func AuthorizationScheme ¶ added in v0.7.0
func AuthorizationScheme(ep *serviceendpoint.ServiceEndpoint) string
AuthorizationScheme returns the authorization scheme of the service endpoint or an empty string if not available.
func DecodeContent ¶ added in v0.7.0
func DescribeInput ¶ added in v0.7.0
func EnsureProjectReferenceIncluded ¶ added in v0.7.0
func EnsureProjectReferenceIncluded(refs *[]serviceendpoint.ServiceEndpointProjectReference, current *serviceendpoint.ProjectReference)
EnsureProjectReferenceIncluded ensures that the given list of project references includes an entry for the current project.
Matching logic: 1. If IDs are available, matches by ID. 2. Fallback: matches by name (case-insensitive).
If the list is empty/nil, it is initialized with the current project. If the current project is not found, it is appended.
func FindServiceEndpoint ¶
func FindServiceEndpoint(ctx util.CmdContext, client serviceendpoint.Client, project, identifier string) (*serviceendpoint.ServiceEndpoint, error)
FindServiceEndpoint resolves a service endpoint by ID or name within a project. It returns the endpoint, a flag indicating whether the resolution used the name lookup path, or ErrEndpointNotFound when nothing matched.
func FormatProjectReference ¶ added in v0.7.0
func FormatProjectReference(refs *[]serviceendpoint.ServiceEndpointProjectReference) string
FormatProjectReference formats a list of service endpoint project references into a single string for display.
func GetServiceEndpointTypes ¶ added in v0.7.0
func GetServiceEndpointTypes(cmdCtx util.CmdContext, organization string) ([]serviceendpoint.ServiceEndpointType, error)
GetServiceEndpointTypes fetches service endpoint types for an organization and caches them for the duration of the command process. It uses the vendored Azure DevOps SDK.
func NormalizeEncoding ¶ added in v0.7.0
func Output ¶ added in v0.7.0
func Output(ctx util.CmdContext, endpoint *serviceendpoint.ServiceEndpoint, exporter util.Exporter) error
Output renders the service endpoint details to the output stream. If an exporter is provided, it writes the endpoint using the exporter. Otherwise, it uses the shared template to render the endpoint details.
func ReadServiceEndpointFromFile ¶ added in v0.7.0
func ReadServiceEndpointFromFile(stdin io.ReadCloser, path, encoding string) (*serviceendpoint.ServiceEndpoint, error)
ReadServiceEndpointFromFile reads, decodes, and parses a service endpoint from a file or stdin. It performs baseline validation (checks for empty fields if present) but does not require all fields.
func RedactSecrets ¶ added in v0.7.0
func RedactSecrets(ep *serviceendpoint.ServiceEndpoint)
RedactSecrets masks sensitive authorization parameters in the service endpoint.
func ResolveProjectReference ¶
func ResolveProjectReference(ctx util.CmdContext, scope *util.Scope) (*serviceendpoint.ProjectReference, error)
ResolveProjectReference fetches the project metadata required to attach service endpoints to a project. It returns a ProjectReference that includes the stable storage key (ID) and display name.
func RunTypedCreate ¶ added in v0.7.0
func RunTypedCreate(cmd *cobra.Command, args []string, cfg EndpointTypeConfigurer) error
RunTypedCreate centralizes creation flow for typed service endpoint commands.
func RunTypedUpdate ¶ added in v0.7.0
func RunTypedUpdate(cmd *cobra.Command, args []string, cfg EndpointTypeConfigurer) error
RunTypedUpdate centralizes update flow for typed service endpoint commands.
func SetAllPipelinesAccessToEndpoint ¶ added in v0.7.0
func SetAllPipelinesAccessToEndpoint( cmdCtx util.CmdContext, organization string, projectID uuid.UUID, endpointID uuid.UUID, authorized bool, cleanup CleanupFunc, ) error
SetAllPipelinesAccessToEndpoint sets the access permission for all pipelines in the specified project to use the service endpoint.
func TestConnection ¶ added in v0.7.0
func TestConnection(cmdCtx util.CmdContext, client serviceendpoint.Client, organization, project string, ep *serviceendpoint.ServiceEndpoint, timeout time.Duration) error
TestConnection executes the endpoint type's TestConnection data source when available. It polls until the data source reports StatusCode == "ok" or timeout/context cancel.
func ValidateEndpointAgainstMetadata ¶ added in v0.7.0
func ValidateEndpointAgainstMetadata(cmdCtx util.CmdContext, organization string, endpoint *serviceendpoint.ServiceEndpoint) error
ValidateEndpointAgainstMetadata validates that the given endpoint's Type and Authorization.Scheme and Parameters match the live metadata for the organization.
func ValidateEndpointPayload ¶ added in v0.7.0
func ValidateEndpointPayload(endpoint *serviceendpoint.ServiceEndpoint, requireIdentityFields bool) error
ValidateEndpointPayload validates the service endpoint payload.
Baseline validation (always performed): - Trims whitespace from Name, Type, and Url if they are present. - Returns an error if Name, Type, or Url are present but empty (or whitespace only).
Strict validation (requireIdentityFields = true): - Requires Name, Type, and Url to be present (non-nil).
func WaitForReady ¶ added in v0.7.0
func WaitForReady(ctx context.Context, client serviceendpoint.Client, project string, ep *serviceendpoint.ServiceEndpoint, timeout time.Duration) (*serviceendpoint.ServiceEndpoint, error)
WaitForReady polls GetServiceEndpointDetails until IsReady==true or a terminal failed state is detected in OperationStatus, or context/timeout occurs.
Types ¶
type CleanupFunc ¶
type CleanupFunc func() error
CleanupFunc allows callers to provide optional rollback logic when granting permissions fails.
type EndpointTypeConfigurer ¶ added in v0.7.0
type EndpointTypeConfigurer interface {
CommandContext() util.CmdContext
TypeName() string
Configure(endpoint *serviceendpoint.ServiceEndpoint) error
}
EndpointTypeConfigurer populates type-specific parts of a service endpoint.