Skip to content

Commit 0658e9e

Browse files
committed
feat: add UpperCamelCase aliases for remaining access and input types
Add UpperCamelCase type aliases for all access methods and input types that were missing after open-component-model#1881. This completes the type notation alignment per ocm-project#962 and ocm-spec#141. Access methods: GitHub/v1, NPM/v1, Wget/v1, Git/v1alpha1, Maven/v1 Input types: Git, Maven, NPM, Wget, Binary, Docker, DockerMulti, Spiff, OCIArtifact On-behalf-of: Gerald Morrison (SAP) <gerald.morrison@sap.com> Signed-off-by: Gerald Morrison (SAP) <gerald.morrison@sap.com>
1 parent 618eb20 commit 0658e9e

13 files changed

Lines changed: 528 additions & 6 deletions

File tree

api/ocm/extensions/accessmethods/git/method.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ import (
2121
const (
2222
Type = "git"
2323
TypeV1Alpha1 = Type + runtime.VersionSeparator + "v1alpha1"
24+
25+
UpperType = "Git"
26+
UpperTypeV1Alpha1 = UpperType + runtime.VersionSeparator + "v1alpha1"
2427
)
2528

2629
func init() {
2730
// If we remove the default registration, also the docs are gone.
2831
// so we leave the default registration in.
2932
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](Type, accspeccpi.WithDescription(usage)))
3033
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](TypeV1Alpha1, accspeccpi.WithFormatSpec(formatV1), accspeccpi.WithConfigHandler(ConfigHandler())))
34+
35+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperType))
36+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperTypeV1Alpha1))
3137
}
3238

3339
// AccessSpec describes the access for a GitHub registry.

api/ocm/extensions/accessmethods/github/method.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ import (
3030
const (
3131
Type = "gitHub"
3232
TypeV1 = Type + runtime.VersionSeparator + "v1"
33+
34+
UpperType = "GitHub"
35+
UpperTypeV1 = UpperType + runtime.VersionSeparator + "v1"
3336
)
3437

3538
const (
@@ -44,10 +47,13 @@ func init() {
4447
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](TypeV1, accspeccpi.WithFormatSpec(formatV1), accspeccpi.WithConfigHandler(ConfigHandler())))
4548
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](LegacyType))
4649
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](LegacyTypeV1))
50+
51+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperType))
52+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperTypeV1))
4753
}
4854

4955
func Is(spec accspeccpi.AccessSpec) bool {
50-
return spec != nil && spec.GetKind() == Type || spec.GetKind() == LegacyType
56+
return spec != nil && (spec.GetKind() == Type || spec.GetKind() == LegacyType || spec.GetKind() == UpperType)
5157
}
5258

5359
// AccessSpec describes the access for a GitHub registry.

api/ocm/extensions/accessmethods/maven/method.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@ import (
1717
const (
1818
Type = "maven"
1919
TypeV1 = Type + runtime.VersionSeparator + "v1"
20+
21+
UpperType = "Maven"
22+
UpperTypeV1 = UpperType + runtime.VersionSeparator + "v1"
2023
)
2124

2225
func init() {
2326
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](Type, accspeccpi.WithDescription(usage)))
2427
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](TypeV1, accspeccpi.WithFormatSpec(formatV1), accspeccpi.WithConfigHandler(ConfigHandler())))
28+
29+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperType))
30+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperTypeV1))
2531
}
2632

2733
// AccessSpec describes the access for a Maven artifact.

api/ocm/extensions/accessmethods/npm/method.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ import (
1414
const (
1515
Type = "npm"
1616
TypeV1 = Type + runtime.VersionSeparator + "v1"
17+
18+
UpperType = "NPM"
19+
UpperTypeV1 = UpperType + runtime.VersionSeparator + "v1"
1720
)
1821

1922
func init() {
2023
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](Type, accspeccpi.WithDescription(usage)))
2124
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](TypeV1, accspeccpi.WithFormatSpec(formatV1), accspeccpi.WithConfigHandler(ConfigHandler())))
25+
26+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperType))
27+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperTypeV1))
2228
}
2329

2430
// AccessSpec describes the access for a NPM registry.

api/ocm/extensions/accessmethods/wget/method.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,21 @@ import (
2020
const (
2121
Type = "wget"
2222
TypeV1 = Type + runtime.VersionSeparator + "v1"
23+
24+
UpperType = "Wget"
25+
UpperTypeV1 = UpperType + runtime.VersionSeparator + "v1"
2326
)
2427

2528
func init() {
2629
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](Type, accspeccpi.WithDescription(usage)))
2730
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](TypeV1, accspeccpi.WithFormatSpec(formatV1), accspeccpi.WithConfigHandler(ConfigHandler())))
31+
32+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperType))
33+
accspeccpi.RegisterAccessType(accspeccpi.NewAccessSpecType[*AccessSpec](UpperTypeV1))
2834
}
2935

3036
func Is(spec accspeccpi.AccessSpec) bool {
31-
return spec != nil && spec.GetKind() == Type
37+
return spec != nil && (spec.GetKind() == Type || spec.GetKind() == UpperType)
3238
}
3339

3440
// New creates a new WGET accessor for http resources.

cmds/ocm/commands/ocmcmds/common/inputs/types/git/type.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ import (
55
"ocm.software/ocm/cmds/ocm/commands/ocmcmds/common/inputs"
66
)
77

8-
const TYPE = "git"
8+
const (
9+
TYPE = "git"
10+
UPPER_TYPE = "Git"
11+
)
912

1013
func init() {
1114
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(TYPE, &Spec{}, usage, ConfigHandler()))
15+
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(UPPER_TYPE, &Spec{}, usage, ConfigHandler()))
1216
}
1317

1418
const usage = `

cmds/ocm/commands/ocmcmds/common/inputs/types/maven/type.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ import (
44
"ocm.software/ocm/cmds/ocm/commands/ocmcmds/common/inputs"
55
)
66

7-
const TYPE = "maven"
7+
const (
8+
TYPE = "maven"
9+
UPPER_TYPE = "Maven"
10+
)
811

912
func init() {
1013
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(TYPE, &Spec{}, usage, ConfigHandler()))
14+
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(UPPER_TYPE, &Spec{}, usage, ConfigHandler()))
1115
}
1216

1317
const usage = `

cmds/ocm/commands/ocmcmds/common/inputs/types/npm/type.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ import (
44
"ocm.software/ocm/cmds/ocm/commands/ocmcmds/common/inputs"
55
)
66

7-
const TYPE = "npm"
7+
const (
8+
TYPE = "npm"
9+
UPPER_TYPE = "NPM"
10+
)
811

912
func init() {
1013
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(TYPE, &Spec{}, usage, ConfigHandler()))
14+
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(UPPER_TYPE, &Spec{}, usage, ConfigHandler()))
1115
}
1216

1317
const usage = `

cmds/ocm/commands/ocmcmds/common/inputs/types/wget/type.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ import (
55
"ocm.software/ocm/cmds/ocm/commands/ocmcmds/common/inputs"
66
)
77

8-
const TYPE = "wget"
8+
const (
9+
TYPE = "wget"
10+
UPPER_TYPE = "Wget"
11+
)
912

1013
func init() {
1114
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(TYPE, &Spec{}, usage, ConfigHandler()))
15+
inputs.DefaultInputTypeScheme.Register(inputs.NewInputType(UPPER_TYPE, &Spec{}, usage, ConfigHandler()))
1216
}
1317

1418
const usage = `

docs/reference/ocm_add_resource-configuration.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,29 @@ with the field <code>type</code> in the <code>input</code> field:
261261

262262
Options used to configure fields: <code>--inputCompress</code>, <code>--inputPath</code>, <code>--mediaType</code>
263263

264+
- Input type <code>Git</code>
265+
266+
The repository type allows accessing an arbitrary git repository
267+
using the manifest annotation <code>software.ocm/component-version</code>.
268+
The ref can be used to further specify the branch or tag to checkout, otherwise the remote HEAD is used.
269+
270+
This blob type specification supports the following fields:
271+
- **<code>repository</code>** *string*
272+
273+
This REQUIRED property describes the URL of the git repository to access. All git URL formats are supported.
274+
275+
- **<code>ref</code>** *string*
276+
277+
This OPTIONAL property can be used to specify the remote branch or tag to checkout (commonly called ref).
278+
If not set, the default HEAD (remotes/origin/HEAD) of the remote is used.
279+
280+
- **<code>commit</code>** *string*
281+
282+
This OPTIONAL property can be used to specify the commit hash to checkout.
283+
If not set, the default HEAD of the ref is used.
284+
285+
Options used to configure fields: <code>--inputRepository</code>, <code>--inputVersion</code>
286+
264287
- Input type <code>Helm</code>
265288

266289
The path must denote an helm chart archive or directory
@@ -311,6 +334,62 @@ with the field <code>type</code> in the <code>input</code> field:
311334

312335
Options used to configure fields: <code>--hint</code>, <code>--inputCompress</code>, <code>--inputHelmRepository</code>, <code>--inputPath</code>, <code>--inputVersion</code>, <code>--mediaType</code>
313336

337+
- Input type <code>Maven</code>
338+
339+
The <code>repoUrl</code> is the url pointing either to the http endpoint of a maven
340+
repository (e.g. https://repo.maven.apache.org/maven2/) or to a file system based
341+
maven repository (e.g. file://local/directory).
342+
343+
This blob type specification supports the following fields:
344+
- **<code>repoUrl</code>** *string*
345+
346+
This REQUIRED property describes the url from which the resource is to be
347+
accessed.
348+
349+
- **<code>groupId</code>** *string*
350+
351+
This REQUIRED property describes the groupId of a maven artifact.
352+
353+
- **<code>artifactId</code>** *string*
354+
355+
This REQUIRED property describes artifactId of a maven artifact.
356+
357+
- **<code>version</code>** *string*
358+
359+
This REQUIRED property describes the version of a maven artifact.
360+
361+
- **<code>classifier</code>** *string*
362+
363+
This OPTIONAL property describes the classifier of a maven artifact.
364+
365+
- **<code>extension</code>** *string*
366+
367+
This OPTIONAL property describes the extension of a maven artifact.
368+
369+
Options used to configure fields: <code>--artifactId</code>, <code>--classifier</code>, <code>--extension</code>, <code>--groupId</code>, <code>--inputPath</code>, <code>--inputVersion</code>, <code>--url</code>
370+
371+
- Input type <code>NPM</code>
372+
373+
The <code>registry</code> is the url pointing to the npm registry from which a resource is
374+
downloaded.
375+
376+
This blob type specification supports the following fields:
377+
- **<code>registry</code>** *string*
378+
379+
This REQUIRED property describes the url from which the resource is to be
380+
downloaded.
381+
382+
- **<code>package</code>** *string*
383+
384+
This REQUIRED property describes the name of the package to download.
385+
386+
- **<code>version</code>** *string*
387+
388+
This is an OPTIONAL property describing the version of the package to download. If
389+
not defined, latest will be used automatically.
390+
391+
Options used to configure fields: <code>--inputRepository</code>, <code>--inputVersion</code>, <code>--package</code>
392+
314393
- Input type <code>UTF8</code>
315394

316395
This blob type is used to provide inline text based content (UTF8). The
@@ -344,6 +423,46 @@ with the field <code>type</code> in the <code>input</code> field:
344423

345424
Options used to configure fields: <code>--inputCompress</code>, <code>--inputFormattedJson</code>, <code>--inputJson</code>, <code>--inputText</code>, <code>--inputYaml</code>, <code>--mediaType</code>
346425

426+
- Input type <code>Wget</code>
427+
428+
The <code>url</code> is the url pointing to the http endpoint from which a resource is
429+
downloaded. The <code>mimeType</code> can be used to specify the MIME type of the
430+
resource.
431+
432+
This blob type specification supports the following fields:
433+
- **<code>url</code>** *string*
434+
435+
This REQUIRED property describes the url from which the resource is to be
436+
downloaded.
437+
438+
- **<code>mediaType</code>** *string*
439+
440+
This OPTIONAL property describes the media type of the resource to be
441+
downloaded. If omitted, ocm tries to read the mediaType from the Content-Type header
442+
of the http response. If the mediaType cannot be set from the Content-Type header as well,
443+
ocm tries to deduct the mediaType from the URL. If that is not possible either, the default
444+
media type is defaulted to application/octet-stream.
445+
446+
- **<code>header</code>** *map[string][]string*
447+
448+
This OPTIONAL property describes the http headers to be set in the http request to the server.
449+
450+
- **<code>verb</code>** *string*
451+
452+
This OPTIONAL property describes the http verb (also known as http request method) for the http
453+
request. If omitted, the http verb is defaulted to GET.
454+
455+
- **<code>body</code>** *[]byte*
456+
457+
This OPTIONAL property describes the http body to be included in the request.
458+
459+
- **<code>noredirect</code>** *bool*
460+
461+
This OPTIONAL property describes whether http redirects should be disabled. If omitted,
462+
it is defaulted to false (so, per default, redirects are enabled).
463+
464+
Options used to configure fields: <code>--body</code>, <code>--header</code>, <code>--mediaType</code>, <code>--noredirect</code>, <code>--url</code>, <code>--verb</code>
465+
347466
- Input type <code>binary</code>
348467

349468
This blob type is used to provide base64 encoded binary content. The

0 commit comments

Comments
 (0)