Skip to content

Commit

Permalink
Merge pull request #611 from cristianoveiga/updated_model_to_0.0.185
Browse files Browse the repository at this point in the history
updated model to v0.0.185
  • Loading branch information
jhernand authored Mar 30, 2022
2 parents 0ffd2ce + a01c4db commit 6d61e21
Show file tree
Hide file tree
Showing 12 changed files with 9,216 additions and 8,828 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
This document describes the relevant changes between releases of the OCM API
SDK.

## 0.1.254 Mar 30 2022

- Update to model 0.0.185:
- Fixes to Cloud Resources endpoints.

## 0.1.253 Mar 29 2022

- Update to model 0.1.184:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
export CGO_ENABLED=0

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

# Details of the metamodel to use:
Expand Down
159 changes: 0 additions & 159 deletions accountsmgmt/v1/cloud_resource_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@ func NewCloudResourceClient(transport http.RoundTripper, path string) *CloudReso
}
}

// Add creates a request for the 'add' method.
//
// Creates a new cloud resource.
func (c *CloudResourceClient) Add() *CloudResourceAddRequest {
return &CloudResourceAddRequest{
transport: c.transport,
path: c.path,
}
}

// Delete creates a request for the 'delete' method.
//
// Deletes the cloud resource.
Expand Down Expand Up @@ -212,155 +202,6 @@ func (c *CloudResourceClient) Poll() *CloudResourcePollRequest {
}
}

// CloudResourceAddRequest is the request for the 'add' method.
type CloudResourceAddRequest struct {
transport http.RoundTripper
path string
query url.Values
header http.Header
body *CloudResource
}

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

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

// Impersonate wraps requests on behalf of another user.
// Note: Services that do not support this feature may silently ignore this call.
func (r *CloudResourceAddRequest) Impersonate(user string) *CloudResourceAddRequest {
helpers.AddImpersonationHeader(&r.header, user)
return r
}

// Body sets the value of the 'body' parameter.
//
//
func (r *CloudResourceAddRequest) Body(value *CloudResource) *CloudResourceAddRequest {
r.body = 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 *CloudResourceAddRequest) Send() (result *CloudResourceAddResponse, err error) {
return r.SendContext(context.Background())
}

// SendContext sends this request, waits for the response, and returns it.
func (r *CloudResourceAddRequest) SendContext(ctx context.Context) (result *CloudResourceAddResponse, err error) {
query := helpers.CopyQuery(r.query)
header := helpers.CopyHeader(r.header)
buffer := &bytes.Buffer{}
err = writeCloudResourceAddRequest(r, buffer)
if err != nil {
return
}
uri := &url.URL{
Path: r.path,
RawQuery: query.Encode(),
}
request := &http.Request{
Method: "POST",
URL: uri,
Header: header,
Body: ioutil.NopCloser(buffer),
}
if ctx != nil {
request = request.WithContext(ctx)
}
response, err := r.transport.RoundTrip(request)
if err != nil {
return
}
defer response.Body.Close()
result = &CloudResourceAddResponse{}
result.status = response.StatusCode
result.header = response.Header
reader := bufio.NewReader(response.Body)
_, err = reader.Peek(1)
if err == io.EOF {
err = nil
return
}
if result.status >= 400 {
result.err, err = errors.UnmarshalErrorStatus(reader, result.status)
if err != nil {
return
}
err = result.err
return
}
err = readCloudResourceAddResponse(result, reader)
if err != nil {
return
}
return
}

// CloudResourceAddResponse is the response for the 'add' method.
type CloudResourceAddResponse struct {
status int
header http.Header
err *errors.Error
body *CloudResource
}

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

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

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

// Body returns the value of the 'body' parameter.
//
//
func (r *CloudResourceAddResponse) Body() *CloudResource {
if r == nil {
return nil
}
return r.body
}

// GetBody returns the value of the 'body' parameter and
// a flag indicating if the parameter has a value.
//
//
func (r *CloudResourceAddResponse) GetBody() (value *CloudResource, ok bool) {
ok = r != nil && r.body != nil
if ok {
value = r.body
}
return
}

// CloudResourceDeleteRequest is the request for the 'delete' method.
type CloudResourceDeleteRequest struct {
transport http.RoundTripper
Expand Down
16 changes: 0 additions & 16 deletions accountsmgmt/v1/cloud_resource_resource_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,6 @@ import (
"net/http"
)

func readCloudResourceAddRequest(request *CloudResourceAddServerRequest, r *http.Request) error {
var err error
request.body, err = UnmarshalCloudResource(r.Body)
return err
}
func writeCloudResourceAddRequest(request *CloudResourceAddRequest, writer io.Writer) error {
return MarshalCloudResource(request.body, writer)
}
func readCloudResourceAddResponse(response *CloudResourceAddResponse, reader io.Reader) error {
var err error
response.body, err = UnmarshalCloudResource(reader)
return err
}
func writeCloudResourceAddResponse(response *CloudResourceAddServerResponse, w http.ResponseWriter) error {
return MarshalCloudResource(response.body, w)
}
func readCloudResourceDeleteRequest(request *CloudResourceDeleteServerRequest, r *http.Request) error {
return nil
}
Expand Down
91 changes: 0 additions & 91 deletions accountsmgmt/v1/cloud_resource_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ import (
// CloudResourceServer represents the interface the manages the 'cloud_resource' resource.
type CloudResourceServer interface {

// Add handles a request for the 'add' method.
//
// Creates a new cloud resource.
Add(ctx context.Context, request *CloudResourceAddServerRequest, response *CloudResourceAddServerResponse) error

// Delete handles a request for the 'delete' method.
//
// Deletes the cloud resource.
Expand All @@ -51,54 +46,6 @@ type CloudResourceServer interface {
Update(ctx context.Context, request *CloudResourceUpdateServerRequest, response *CloudResourceUpdateServerResponse) error
}

// CloudResourceAddServerRequest is the request for the 'add' method.
type CloudResourceAddServerRequest struct {
body *CloudResource
}

// Body returns the value of the 'body' parameter.
//
//
func (r *CloudResourceAddServerRequest) Body() *CloudResource {
if r == nil {
return nil
}
return r.body
}

// GetBody returns the value of the 'body' parameter and
// a flag indicating if the parameter has a value.
//
//
func (r *CloudResourceAddServerRequest) GetBody() (value *CloudResource, ok bool) {
ok = r != nil && r.body != nil
if ok {
value = r.body
}
return
}

// CloudResourceAddServerResponse is the response for the 'add' method.
type CloudResourceAddServerResponse struct {
status int
err *errors.Error
body *CloudResource
}

// Body sets the value of the 'body' parameter.
//
//
func (r *CloudResourceAddServerResponse) Body(value *CloudResource) *CloudResourceAddServerResponse {
r.body = value
return r
}

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

// CloudResourceDeleteServerRequest is the request for the 'delete' method.
type CloudResourceDeleteServerRequest struct {
}
Expand Down Expand Up @@ -194,9 +141,6 @@ func (r *CloudResourceUpdateServerResponse) Status(value int) *CloudResourceUpda
func dispatchCloudResource(w http.ResponseWriter, r *http.Request, server CloudResourceServer, segments []string) {
if len(segments) == 0 {
switch r.Method {
case "POST":
adaptCloudResourceAddRequest(w, r, server)
return
case "DELETE":
adaptCloudResourceDeleteRequest(w, r, server)
return
Expand All @@ -218,41 +162,6 @@ func dispatchCloudResource(w http.ResponseWriter, r *http.Request, server CloudR
}
}

// adaptCloudResourceAddRequest 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 adaptCloudResourceAddRequest(w http.ResponseWriter, r *http.Request, server CloudResourceServer) {
request := &CloudResourceAddServerRequest{}
err := readCloudResourceAddRequest(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 := &CloudResourceAddServerResponse{}
response.status = 201
err = server.Add(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 = writeCloudResourceAddResponse(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
}
}

// adaptCloudResourceDeleteRequest 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
Loading

0 comments on commit 6d61e21

Please sign in to comment.