Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
support for endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan committed Feb 18, 2022
1 parent 94d2703 commit 8683a1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion client/eptattachment/eptattchment.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

//Create
func Create(serviceAttachment string, location string) (respBody []byte, err error) {
func Create(name string, serviceAttachment string, location string) (respBody []byte, err error) {

endpointAttachment := []string{}

Expand All @@ -35,6 +35,10 @@ func Create(serviceAttachment string, location string) (respBody []byte, err err
u, _ := url.Parse(apiclient.BaseURL)
u.Path = path.Join(u.Path, apiclient.GetApigeeOrg(), "endpointAttachments")

q := u.Query()
q.Set("endpointAttachmentId", name)
u.RawQuery = q.Encode()

respBody, err = apiclient.HttpClient(apiclient.GetPrintOutput(), u.String(), payload)
return respBody, err
}
Expand Down
7 changes: 5 additions & 2 deletions cmd/eptattachment/crteptattachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,23 @@ var CreateCmd = &cobra.Command{
if !ok {
return fmt.Errorf("disk encryption key must be of the format projects/{project-id}/regions/{location}/serviceAttachments/{sa-name}")
}
_, err = eptattachment.Create(name, location)
_, err = eptattachment.Create(name, serviceAttachment, location)
return
},
}

var location string
var location, serviceAttachment string

func init() {

CreateCmd.Flags().StringVarP(&name, "name", "n",
"", "Name of the service endpoint")
CreateCmd.Flags().StringVarP(&location, "location", "l",
"", "Location of the service endpoint")
CreateCmd.Flags().StringVarP(&serviceAttachment, "service-attachment", "s",
"", "Service attachment url: projects/{project-id}/regions/{location}/serviceAttachments/{sa-name}")

_ = CreateCmd.MarkFlagRequired("name")
_ = CreateCmd.MarkFlagRequired("service-attachment")
_ = CreateCmd.MarkFlagRequired("location")
}

0 comments on commit 8683a1c

Please sign in to comment.