refs

package
v2.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2025 MongoDB Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMatchingPropertySelector = errors.New("no matching property selector found to set value")

ErrNoMatchingPropertySelector when no property selectors matched the value

Functions

func CollapseAll

func CollapseAll(mappings []*Mapping, main client.Object, deps []client.Object, req map[string]any) error

CollapseAll takes a list of mappings and collapses the ones found in the given request unstructured object. The SDK request must map to the main typed

object and deps are other kubernetes objects related with such main object

func ExpandAll

func ExpandAll(mappings []*Mapping, main client.Object, deps []client.Object, cr map[string]any) ([]client.Object, error)

ExpandAll takes a list of mappings and expands the ones found in the given CR unstructured object. CR corresponds to the main typed object and deps are other kubernetes objects related with such main object

Types

type KubeMapping

type KubeMapping struct {
	NameSelector      string   `json:"nameSelector"`
	PropertySelectors []string `json:"propertySelectors"`
	Properties        []string `json:"properties"`
	Type              KubeType `json:"type"`
}

type KubeType

type KubeType struct {
	Kind     string `json:"kind"`
	Group    string `json:"group,omitempty"`
	Resource string `json:"resource"`
	Version  string `json:"version"`
}

type Mapping

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

Mapping encodes a reference mapping consisting of two extensions, a x-kubernetes-mapping and a x-openapi-mapping

func FindMappings

func FindMappings(schema *openapi3.Schema, path []string) ([]*Mapping, error)

FindMappings lists all reference mappings from the given schema at a path

func NewMapping

func NewMapping(path []string, propertyName string, kubeMapping KubeMapping, openAPIMapping OpenAPIMapping) *Mapping

NewMapping creates a reference mapping from its basic information: path, property name, kubernetes and openapi extension mappings

type OpenAPIMapping

type OpenAPIMapping struct {
	Property string `json:"property"`
	Type     string `json:"type"`
}

Jump to

Keyboard shortcuts

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