Skip to content

Commit

Permalink
Merge pull request blackducksoftware#66 from tarunsethi/detectURI-API
Browse files Browse the repository at this point in the history
Added support for GET requests for /external-config/detect-uri endpoint
  • Loading branch information
cpedlar-syn authored Feb 26, 2021
2 parents e6daea9 + b641060 commit bdf86cf
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
22 changes: 22 additions & 0 deletions hubapi/extconfig-detect-uri-api.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2021 Synopsys, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package hubapi

type DetectURI struct {
bdJsonAdminDetailV4
Category string `json:"category"`
DetectURI string `json:"value"`
Meta Meta `json:"_meta"`
}
30 changes: 30 additions & 0 deletions hubclient/extconfig-detecturi-client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2021 Synopsys, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package hubclient

import "github.com/blackducksoftware/hub-client-go/hubapi"

func (c *Client) DetectURI() (*hubapi.DetectURI, error) {

detectURIURL := c.baseURL + "/api/external-config/detect-uri"

var detectURI hubapi.DetectURI
err := c.HttpGetJSON(detectURIURL, &detectURI, 200)

if err != nil {
return nil, AnnotateHubClientError(err, "Error trying to get Detect URI")
}
return &detectURI, nil
}

0 comments on commit bdf86cf

Please sign in to comment.