Skip to content

Commit

Permalink
Merge pull request #531 from tzvatot/version-gates-2
Browse files Browse the repository at this point in the history
Bump ocm api model to version 0.0.163
  • Loading branch information
tzvatot authored Dec 21, 2021
2 parents 6dae69a + 88f67ea commit 508906d
Show file tree
Hide file tree
Showing 8 changed files with 6,346 additions and 6,082 deletions.
7 changes: 6 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
This document describes the relevant changes between releases of the OCM API
SDK.

## 0.1.230 Dec 21 2021

- Update to model 0.0.163:
- Add support for deleting version gate.

## 0.1.229 Dec 21 2021

- Update to model 0.0.161:
- Update to model 0.0.162:
- Add support for adding version gate.

## 0.1.228 Dec 20 2021
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export GOPROXY=https://proxy.golang.org
export CGO_ENABLED=0

# Details of the model to use:
model_version:=v0.0.162
model_version:=v0.0.163
model_url:=https://github.com/openshift-online/ocm-api-model.git

# Details of the metamodel to use:
Expand Down
12,208 changes: 6,129 additions & 6,079 deletions clustersmgmt/v1/openapi.go

Large diffs are not rendered by default.

104 changes: 104 additions & 0 deletions clustersmgmt/v1/version_gate_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ func NewVersionGateClient(transport http.RoundTripper, path string) *VersionGate
}
}

// Delete creates a request for the 'delete' method.
//
// Deletes the version gate.
func (c *VersionGateClient) Delete() *VersionGateDeleteRequest {
return &VersionGateDeleteRequest{
transport: c.transport,
path: c.path,
}
}

// Get creates a request for the 'get' method.
//
// Retrieves the details of the version gate.
Expand Down Expand Up @@ -178,6 +188,100 @@ func (c *VersionGateClient) Poll() *VersionGatePollRequest {
}
}

// VersionGateDeleteRequest is the request for the 'delete' method.
type VersionGateDeleteRequest struct {
transport http.RoundTripper
path string
query url.Values
header http.Header
}

// Parameter adds a query parameter.
func (r *VersionGateDeleteRequest) Parameter(name string, value interface{}) *VersionGateDeleteRequest {
helpers.AddValue(&r.query, name, value)
return r
}

// Header adds a request header.
func (r *VersionGateDeleteRequest) Header(name string, value interface{}) *VersionGateDeleteRequest {
helpers.AddHeader(&r.header, name, value)
return r
}

// Send sends this request, waits for the response, and returns it.
//
// This is a potentially lengthy operation, as it requires network communication.
// Consider using a context and the SendContext method.
func (r *VersionGateDeleteRequest) Send() (result *VersionGateDeleteResponse, err error) {
return r.SendContext(context.Background())
}

// SendContext sends this request, waits for the response, and returns it.
func (r *VersionGateDeleteRequest) SendContext(ctx context.Context) (result *VersionGateDeleteResponse, err error) {
query := helpers.CopyQuery(r.query)
header := helpers.CopyHeader(r.header)
uri := &url.URL{
Path: r.path,
RawQuery: query.Encode(),
}
request := &http.Request{
Method: "DELETE",
URL: uri,
Header: header,
}
if ctx != nil {
request = request.WithContext(ctx)
}
response, err := r.transport.RoundTrip(request)
if err != nil {
return
}
defer response.Body.Close()
result = &VersionGateDeleteResponse{}
result.status = response.StatusCode
result.header = response.Header
if result.status >= 400 {
result.err, err = errors.UnmarshalErrorStatus(response.Body, result.status)
if err != nil {
return
}
err = result.err
return
}
return
}

// VersionGateDeleteResponse is the response for the 'delete' method.
type VersionGateDeleteResponse struct {
status int
header http.Header
err *errors.Error
}

// Status returns the response status code.
func (r *VersionGateDeleteResponse) Status() int {
if r == nil {
return 0
}
return r.status
}

// Header returns header of the response.
func (r *VersionGateDeleteResponse) Header() http.Header {
if r == nil {
return nil
}
return r.header
}

// Error returns the response error.
func (r *VersionGateDeleteResponse) Error() *errors.Error {
if r == nil {
return nil
}
return r.err
}

// VersionGateGetRequest is the request for the 'get' method.
type VersionGateGetRequest struct {
transport http.RoundTripper
Expand Down
12 changes: 12 additions & 0 deletions clustersmgmt/v1/version_gate_resource_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ import (
"net/http"
)

func readVersionGateDeleteRequest(request *VersionGateDeleteServerRequest, r *http.Request) error {
return nil
}
func writeVersionGateDeleteRequest(request *VersionGateDeleteRequest, writer io.Writer) error {
return nil
}
func readVersionGateDeleteResponse(response *VersionGateDeleteResponse, reader io.Reader) error {
return nil
}
func writeVersionGateDeleteResponse(response *VersionGateDeleteServerResponse, w http.ResponseWriter) error {
return nil
}
func readVersionGateGetRequest(request *VersionGateGetServerRequest, r *http.Request) error {
return nil
}
Expand Down
59 changes: 59 additions & 0 deletions clustersmgmt/v1/version_gate_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,33 @@ import (
// VersionGateServer represents the interface the manages the 'version_gate' resource.
type VersionGateServer interface {

// Delete handles a request for the 'delete' method.
//
// Deletes the version gate.
Delete(ctx context.Context, request *VersionGateDeleteServerRequest, response *VersionGateDeleteServerResponse) error

// Get handles a request for the 'get' method.
//
// Retrieves the details of the version gate.
Get(ctx context.Context, request *VersionGateGetServerRequest, response *VersionGateGetServerResponse) error
}

// VersionGateDeleteServerRequest is the request for the 'delete' method.
type VersionGateDeleteServerRequest struct {
}

// VersionGateDeleteServerResponse is the response for the 'delete' method.
type VersionGateDeleteServerResponse struct {
status int
err *errors.Error
}

// Status sets the status code.
func (r *VersionGateDeleteServerResponse) Status(value int) *VersionGateDeleteServerResponse {
r.status = value
return r
}

// VersionGateGetServerRequest is the request for the 'get' method.
type VersionGateGetServerRequest struct {
}
Expand Down Expand Up @@ -67,6 +88,9 @@ func (r *VersionGateGetServerResponse) Status(value int) *VersionGateGetServerRe
func dispatchVersionGate(w http.ResponseWriter, r *http.Request, server VersionGateServer, segments []string) {
if len(segments) == 0 {
switch r.Method {
case "DELETE":
adaptVersionGateDeleteRequest(w, r, server)
return
case "GET":
adaptVersionGateGetRequest(w, r, server)
return
Expand All @@ -82,6 +106,41 @@ func dispatchVersionGate(w http.ResponseWriter, r *http.Request, server VersionG
}
}

// adaptVersionGateDeleteRequest translates the given HTTP request into a call to
// the corresponding method of the given server. Then it translates the
// results returned by that method into an HTTP response.
func adaptVersionGateDeleteRequest(w http.ResponseWriter, r *http.Request, server VersionGateServer) {
request := &VersionGateDeleteServerRequest{}
err := readVersionGateDeleteRequest(request, r)
if err != nil {
glog.Errorf(
"Can't read request for method '%s' and path '%s': %v",
r.Method, r.URL.Path, err,
)
errors.SendInternalServerError(w, r)
return
}
response := &VersionGateDeleteServerResponse{}
response.status = 204
err = server.Delete(r.Context(), request, response)
if err != nil {
glog.Errorf(
"Can't process request for method '%s' and path '%s': %v",
r.Method, r.URL.Path, err,
)
errors.SendInternalServerError(w, r)
return
}
err = writeVersionGateDeleteResponse(response, w)
if err != nil {
glog.Errorf(
"Can't write response for method '%s' and path '%s': %v",
r.Method, r.URL.Path, err,
)
return
}
}

// adaptVersionGateGetRequest translates the given HTTP request into a call to
// the corresponding method of the given server. Then it translates the
// results returned by that method into an HTTP response.
Expand Down
34 changes: 34 additions & 0 deletions openapi/clusters_mgmt/v1/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -6598,6 +6598,40 @@
}
},
"/api/clusters_mgmt/v1/versions/{version_id}/gates/{version_gate_id}": {
"delete": {
"description": "Deletes the version gate.",
"parameters": [
{
"name": "version_id",
"in": "path",
"schema": {
"type": "string"
}
},
{
"name": "version_gate_id",
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"204": {
"description": "Success."
},
"default": {
"description": "Error.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"get": {
"description": "Retrieves the details of the version gate.",
"parameters": [
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ limitations under the License.

package sdk

const Version = "0.1.229"
const Version = "0.1.230"

0 comments on commit 508906d

Please sign in to comment.