Skip to content

Commit

Permalink
chore: Adds examples to apihub #613 (#614)
Browse files Browse the repository at this point in the history
* chore: adds samples for apihub #613

* chore: adds more samples for apihub #613
  • Loading branch information
srinandan authored Dec 27, 2024
1 parent 42bc042 commit cc713bf
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 1 deletion.
9 changes: 9 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ package main
import (
"internal/cmd"
"internal/cmd/apidocs"
apihubapi "internal/cmd/apihub/apis"
apiversion "internal/cmd/apihub/apis/versions"
apispec "internal/cmd/apihub/apis/versions/specs"
"internal/cmd/apihub/deployments"
"internal/cmd/apis"
"internal/cmd/appgroups"
"internal/cmd/apps"
Expand Down Expand Up @@ -71,6 +75,11 @@ Set up apigeecli with preferences: ` + getSingleLine("apigeecli prefs set -o $or
| references | ` + getSingleLine(references.GetExample(0)) + ` |
| apps | ` + getSingleLine(apps.GetExample(0)) + ` |
| apidocs | ` + getSingleLine(apidocs.GetExample(0)) + ` |
| apihub | ` + getSingleLine(apihubapi.GetExample(0)) + ` |
| apihub | ` + getSingleLine(apiversion.GetExample(0)) + ` |
| apihub | ` + getSingleLine(apispec.GetExample(0)) + ` |
| apihub | ` + getSingleLine(deployments.GetExample(0)) + ` |
NOTE: This file is auto-generated during a release. Do not modify.`
Expand Down
8 changes: 8 additions & 0 deletions internal/cmd/apihub/apis/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ var ApisCmd = &cobra.Command{

var org, region string

var examples = []string{
`apigeecli apihub apis create -i $apiId -f ./test/api.json -r $region -p $project --default-token`,
}

func init() {
ApisCmd.PersistentFlags().StringVarP(&org, "org", "o",
"", "Apigee organization name")
Expand All @@ -46,3 +50,7 @@ func init() {
_ = ApisCmd.MarkFlagRequired("org")
_ = ApisCmd.MarkFlagRequired("region")
}

func GetExample(i int) string {
return examples[i]
}
9 changes: 9 additions & 0 deletions internal/cmd/apihub/apis/versions/specs/specs.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ var SpecsCmd = &cobra.Command{

var org, region string

var examples = []string{
`apigeecli apihub apis versions specs create -i $id --api-id $apiId \
--version=$version -d $displayName -f ./test/petstore.yaml -r $region --default-token`,
}

func init() {
SpecsCmd.PersistentFlags().StringVarP(&org, "org", "o",
"", "Apigee organization name")
Expand All @@ -43,3 +48,7 @@ func init() {
_ = SpecsCmd.MarkFlagRequired("org")
_ = SpecsCmd.MarkFlagRequired("region")
}

func GetExample(i int) string {
return examples[i]
}
9 changes: 9 additions & 0 deletions internal/cmd/apihub/apis/versions/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ var ApiVersionsCmd = &cobra.Command{

var org, region string

var examples = []string{
`apigeecli apihub apis versions create -i $apVeriId --api-id $apiId \
-f ./test/api-ver.json -r $region -p $project --default-token`,
}

func init() {
ApiVersionsCmd.PersistentFlags().StringVarP(&org, "org", "o",
"", "Apigee organization name")
Expand All @@ -45,3 +50,7 @@ func init() {
_ = ApiVersionsCmd.MarkFlagRequired("org")
_ = ApiVersionsCmd.MarkFlagRequired("region")
}

func GetExample(i int) string {
return examples[i]
}
2 changes: 1 addition & 1 deletion internal/cmd/apihub/deployments/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ func init() {
_ = CrtCmd.MarkFlagRequired("display-name")
_ = CrtCmd.MarkFlagRequired("resource-uri")
_ = CrtCmd.MarkFlagRequired("endpoints")
_ = CrtCmd.MarkFlagRequired("type")
_ = CrtCmd.MarkFlagRequired("dep-type")
}
11 changes: 11 additions & 0 deletions internal/cmd/apihub/deployments/depoyments.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ var DeploymentCmd = &cobra.Command{

var org, region string

var examples = []string{
`apigeecli apihub deployments create -n $name --dep-type apigee -d $dispName \
--env-type development --slo-type "99-99" --endpoints https://api.example.com \
--resource-uri https://apigee.googleapis.com/v1/organizations/$project/apis/$proxy/revisions/1 \
-r us-central1 --default-token`,
}

func init() {
DeploymentCmd.PersistentFlags().StringVarP(&org, "org", "o",
"", "Apigee organization name")
Expand All @@ -42,3 +49,7 @@ func init() {
_ = DeploymentCmd.MarkFlagRequired("org")
_ = DeploymentCmd.MarkFlagRequired("region")
}

func GetExample(i int) string {
return examples[i]
}

0 comments on commit cc713bf

Please sign in to comment.