Skip to content

Commit 48f2296

Browse files
committed
STAC-24049: process feedback
revert whitespace/formatting in api_retention.go add usage examples to new commands
1 parent ed90ce7 commit 48f2296

13 files changed

Lines changed: 74 additions & 36 deletions

cmd/otelcomponentmapping/otelcomponentmapping_apply.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ type ApplyArgs struct {
2020
func OtelComponentMappingApplyCommand(deps *di.Deps) *cobra.Command {
2121
args := &ApplyArgs{}
2222
cmd := &cobra.Command{
23-
Use: "apply",
23+
Use: "apply --file FILE",
2424
Short: "Create or edit an OTel Component Mapping from YAML",
2525
Long: "Create or edit a OTel Component Mapping from YAML file.",
26-
RunE: deps.CmdRunEWithApi(RunApplyComponentMappingCommand(args)),
26+
Example: `# create a new OTel component mapping from a YAML file
27+
sts otel-component-mapping apply --file new-component-mapping.yaml
28+
29+
# update an existing mapping
30+
sts otel-component-mapping apply --file updated-component-mapping.yaml`,
31+
RunE: deps.CmdRunEWithApi(RunApplyComponentMappingCommand(args)),
2732
}
2833

2934
common.AddRequiredFileFlagVar(cmd, &args.File, "Path to a .yaml file with the mapping definition")

cmd/otelcomponentmapping/otelcomponentmapping_delete.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ type DeleteArgs struct {
1616
func OtelComponentMappingDeleteCommand(deps *di.Deps) *cobra.Command {
1717
args := &DeleteArgs{}
1818
cmd := &cobra.Command{
19-
Use: "delete",
19+
Use: "delete --identifier URN",
2020
Short: "Delete an OTel Component Mapping by identifier (URN)",
2121
Long: "Delete an OTel Component Mapping by identifier (URN)",
22-
RunE: deps.CmdRunEWithApi(RunDeleteComponentMappingCommand(args)),
22+
Example: `# delete a component mapping by identifier
23+
sts otel-component-mapping delete --identifier urn:stackpack:stackpack-name:shared:otel-component-mapping:service`,
24+
RunE: deps.CmdRunEWithApi(RunDeleteComponentMappingCommand(args)),
2325
}
2426

2527
common.AddRequiredIdentifierFlagVar(cmd, &args.Identifier, "Identifier (URN) of the Component Mapping to delete")

cmd/otelcomponentmapping/otelcomponentmapping_describe.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ type DescribeArgs struct {
1919
func OtelComponentMappingDescribeCommand(deps *di.Deps) *cobra.Command {
2020
args := &DescribeArgs{}
2121
cmd := &cobra.Command{
22-
Use: "describe",
22+
Use: "describe --identifier URN",
2323
Short: "Describe an Otel Component Mapping",
2424
Long: "Describe an Otel Component Mapping by identifier (URN). Optionally write to output file.",
25-
RunE: deps.CmdRunEWithApi(RunDescribeComponentMappingCommand(args)),
25+
Example: `# describe an OTel component mapping by identifier
26+
sts otel-component-mapping describe --identifier urn:stackpack:stackpack-name:shared:otel-component-mapping:service
27+
28+
# output mapping to a file
29+
sts otel-component-mapping describe --identifier urn:stackpack:stackpack-name:shared:otel-component-mapping:service --file exported.yaml`,
30+
RunE: deps.CmdRunEWithApi(RunDescribeComponentMappingCommand(args)),
2631
}
2732

2833
common.AddRequiredIdentifierFlagVar(cmd, &args.Identifier, "Identifier (URN) of the Component Mapping")

cmd/otelcomponentmapping/otelcomponentmapping_edit.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ type EditArgs struct {
2626
func OtelComponentMappingEditCommand(deps *di.Deps) *cobra.Command {
2727
args := &EditArgs{}
2828
cmd := &cobra.Command{
29-
Use: "edit",
29+
Use: "edit --identifier URN",
3030
Short: "Edit an OTel Component Mapping using $EDITOR",
3131
Long: LongDescription,
32-
RunE: deps.CmdRunEWithApi(RunEditComponentMappingCommand(args)),
32+
Example: `# edit a component mapping using your editor
33+
sts otel-component-mapping edit --identifier urn:stackpack:stackpack-name:shared:otel-component-mapping:service`,
34+
RunE: deps.CmdRunEWithApi(RunEditComponentMappingCommand(args)),
3335
}
3436

3537
common.AddRequiredIdentifierFlagVar(cmd, &args.Identifier, "Identifier (URN) of the Component Mapping")

cmd/otelcomponentmapping/otelcomponentmapping_list.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ func OtelComponentMappingListCommand(deps *di.Deps) *cobra.Command {
1515
Use: "list",
1616
Short: "Lists active OTel Component Mappings",
1717
Long: "Lists active OTel Component Mappings.",
18-
RunE: deps.CmdRunEWithApi(RunListComponentCommand),
18+
Example: `# list all OTel component mappings
19+
sts otel-component-mapping list
20+
21+
# list all component mappings in JSON format
22+
sts otel-component-mapping list -o json`,
23+
RunE: deps.CmdRunEWithApi(RunListComponentCommand),
1924
}
2025

2126
return cmd

cmd/otelcomponentmapping/otelcomponentmapping_status.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ func OtelComponentMappingStatusCommand(deps *di.Deps) *cobra.Command {
1313
Use: "status",
1414
Short: "Get the status of an OTel Component Mappings",
1515
Long: "Get the status of an OTel Component Mappings.",
16-
RunE: deps.CmdRunEWithApi(otelmapping.RunStatus(args, "component", otelmapping.FetchComponentStatus)),
16+
Example: `# get the status of a component mapping
17+
sts otel-component-mapping status --identifier urn:stackpack:stackpack-name:shared:otel-component-mapping:service`,
18+
RunE: deps.CmdRunEWithApi(otelmapping.RunStatus(args, "component", otelmapping.FetchComponentStatus)),
1719
}
1820

1921
common.AddRequiredIdentifierFlagVar(cmd, &args.Identifier, "Identifier of the OTel Component Mapping")

cmd/otelrelationmapping/otelrelationmapping_apply.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ type ApplyArgs struct {
2020
func OtelRelationMappingApplyCommand(deps *di.Deps) *cobra.Command {
2121
args := &ApplyArgs{}
2222
cmd := &cobra.Command{
23-
Use: "apply",
23+
Use: "apply --file FILE",
2424
Short: "Create or edit an OTel Relation Mapping from YAML",
2525
Long: "Create or edit an OTel Relation Mapping from YAML file.",
26-
RunE: deps.CmdRunEWithApi(RunApplyRelationMappingCommand(args)),
26+
Example: `# create a new OTel relation mapping from a YAML file
27+
sts otel-relation-mapping apply --file new-relation-mapping.yaml
28+
29+
# update an existing relation mapping
30+
sts otel-relation-mapping apply --file updated-relation-mapping.yaml`,
31+
RunE: deps.CmdRunEWithApi(RunApplyRelationMappingCommand(args)),
2732
}
2833

2934
common.AddRequiredFileFlagVar(cmd, &args.File, "Path to .yaml file with the mapping definition")

cmd/otelrelationmapping/otelrelationmapping_delete.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ type DeleteArgs struct {
1616
func OtelRelationMappingDeleteCommand(deps *di.Deps) *cobra.Command {
1717
args := &DeleteArgs{}
1818
cmd := &cobra.Command{
19-
Use: "delete",
19+
Use: "delete --identifier URN",
2020
Short: "Delete an OTel Relation Mapping by identifier (URN)",
2121
Long: "Delete an OTel Relation Mapping by identifier (URN).",
22-
RunE: deps.CmdRunEWithApi(RunDeleteRelationMappingCommand(args)),
22+
Example: `# delete a relation mapping by identifier
23+
sts otel-relation-mapping delete --identifier urn:stackpack:stackpack-name:shared:otel-relation-mapping:database`,
24+
RunE: deps.CmdRunEWithApi(RunDeleteRelationMappingCommand(args)),
2325
}
2426

2527
common.AddRequiredIdentifierFlagVar(cmd, &args.Identifier, "Identifier (URN) of the Relation Mapping to delete")

cmd/otelrelationmapping/otelrelationmapping_describe.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ type DescribeArgs struct {
1919
func OtelRelationMappingDescribeCommand(deps *di.Deps) *cobra.Command {
2020
args := &DescribeArgs{}
2121
cmd := &cobra.Command{
22-
Use: "describe",
22+
Use: "describe --identifier URN",
2323
Short: "Describe an OTel Relation Mapping by identifier (URN)",
2424
Long: "Describe an OTel Relation Mapping by identifier (URN). Optionally write to output file.",
25-
RunE: deps.CmdRunEWithApi(RunDescribeRelationMappingCommand(args)),
25+
Example: `# describe an OTel relation mapping by identifier
26+
sts otel-relation-mapping describe --identifier urn:stackpack:stackpack-name:shared:otel-relation-mapping:database
27+
28+
# output relation mapping to a file
29+
sts otel-relation-mapping describe --identifier urn:stackpack:stackpack-name:shared:otel-relation-mapping:database --file exported.yaml`,
30+
RunE: deps.CmdRunEWithApi(RunDescribeRelationMappingCommand(args)),
2631
}
2732
common.AddRequiredIdentifierFlagVar(cmd, &args.Identifier, "Identifier (URN) of the Relation Mapping")
2833
common.AddFileFlagVar(cmd, &args.FilePath, "Path to the output file")

cmd/otelrelationmapping/otelrelationmapping_edit.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ type EditArgs struct {
2626
func OtelRelationMappingEditCommand(deps *di.Deps) *cobra.Command {
2727
args := &EditArgs{}
2828
cmd := &cobra.Command{
29-
Use: "edit",
29+
Use: "edit --identifier URN",
3030
Short: "Edit an OTel Relation Mapping using $EDITOR",
3131
Long: LongDescription,
32-
RunE: deps.CmdRunEWithApi(RunEditRelationMappingCommand(args)),
32+
Example: `# edit a relation mapping using your editor
33+
sts otel-relation-mapping edit --identifier urn:stackpack:stackpack-name:shared:otel-relation-mapping:database`,
34+
RunE: deps.CmdRunEWithApi(RunEditRelationMappingCommand(args)),
3335
}
3436
common.AddRequiredIdentifierFlagVar(cmd, &args.Identifier, "Identifier (URN) of the Relation Mapping")
3537
return cmd

0 commit comments

Comments
 (0)