| garciadeblas | 83775ba | 2025-07-23 18:35:24 +0200 | [diff] [blame] | 1 | ####################################################################################### |
| 2 | # Copyright ETSI Contributors and Others. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 13 | # implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | ####################################################################################### |
| 17 | |
| 18 | # Meta-module of helper functions to manage, transform and generate specifications of Kubernetes resources. |
| 19 | # This meta-module comprises all the modules of the OSM's SDK for App Modelling. |
| 20 | |
| 21 | |
| 22 | # Import submodules |
| 23 | export module ./keypair.nu |
| 24 | export module ./concatenate.nu |
| 25 | export module ./convert.nu |
| 26 | export module ./generator.nu |
| 27 | export module ./patch.nu |
| 28 | export module ./jsonpatch.nu |
| 29 | export module ./strategicmergepatch.nu |
| 30 | export module ./overlaypatch.nu |
| 31 | |
| 32 | |
| 33 | # Convert input string to a safe name for Kubernetes resources |
| 34 | export def "safe resource name" [input: string]: [ |
| 35 | nothing -> string |
| 36 | ] { |
| 37 | $input |
| 38 | | str downcase |
| 39 | | str replace -a './' '' |
| 40 | | str replace -a '.' '-' |
| 41 | | str replace -a '/' '-' |
| 42 | | str replace -a '_' '-' |
| 43 | | str replace -a ' ' '-' |
| 44 | | str replace -a ':' '-' |
| 45 | } |
| 46 | |
| 47 | export alias safe_name = safe resource name |