Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCM-3234 | bump model to 0.0.330 #860

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export PATH := $(LOCAL_BIN_PATH):$(PATH)
export CGO_ENABLED=0

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

# Details of the metamodel to use:
Expand Down
154 changes: 154 additions & 0 deletions clustersmgmt/v1/hypershift_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1

import (
"bufio"
"bytes"
"context"
"io"
"net/http"
Expand Down Expand Up @@ -59,6 +60,16 @@ func (c *HypershiftClient) Get() *HypershiftGetRequest {
}
}

// Update creates a request for the 'update' method.
//
// Updates the Hypershift details for a single cluster.
func (c *HypershiftClient) Update() *HypershiftUpdateRequest {
return &HypershiftUpdateRequest{
transport: c.transport,
path: c.path,
}
}

// HypershiftPollRequest is the request for the Poll method.
type HypershiftPollRequest struct {
request *HypershiftGetRequest
Expand Down Expand Up @@ -305,3 +316,146 @@ func (r *HypershiftGetResponse) GetBody() (value *HypershiftConfig, ok bool) {
}
return
}

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

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

// Header adds a request header.
func (r *HypershiftUpdateRequest) Header(name string, value interface{}) *HypershiftUpdateRequest {
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 *HypershiftUpdateRequest) Impersonate(user string) *HypershiftUpdateRequest {
helpers.AddImpersonationHeader(&r.header, user)
return r
}

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

// SendContext sends this request, waits for the response, and returns it.
func (r *HypershiftUpdateRequest) SendContext(ctx context.Context) (result *HypershiftUpdateResponse, err error) {
query := helpers.CopyQuery(r.query)
header := helpers.CopyHeader(r.header)
buffer := &bytes.Buffer{}
err = writeHypershiftUpdateRequest(r, buffer)
if err != nil {
return
}
uri := &url.URL{
Path: r.path,
RawQuery: query.Encode(),
}
request := &http.Request{
Method: "PATCH",
URL: uri,
Header: header,
Body: io.NopCloser(buffer),
}
if ctx != nil {
request = request.WithContext(ctx)
}
response, err := r.transport.RoundTrip(request)
if err != nil {
return
}
defer response.Body.Close()
result = &HypershiftUpdateResponse{}
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 = readHypershiftUpdateResponse(result, reader)
if err != nil {
return
}
return
}

// HypershiftUpdateResponse is the response for the 'update' method.
type HypershiftUpdateResponse struct {
status int
header http.Header
err *errors.Error
body *HypershiftConfig
}

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

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

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

// Body returns the value of the 'body' parameter.
func (r *HypershiftUpdateResponse) Body() *HypershiftConfig {
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 *HypershiftUpdateResponse) GetBody() (value *HypershiftConfig, ok bool) {
ok = r != nil && r.body != nil
if ok {
value = r.body
}
return
}
8 changes: 8 additions & 0 deletions clustersmgmt/v1/hypershift_resource_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@ func readHypershiftGetResponse(response *HypershiftGetResponse, reader io.Reader
response.body, err = UnmarshalHypershiftConfig(reader)
return err
}
func writeHypershiftUpdateRequest(request *HypershiftUpdateRequest, writer io.Writer) error {
return MarshalHypershiftConfig(request.body, writer)
}
func readHypershiftUpdateResponse(response *HypershiftUpdateResponse, reader io.Reader) error {
var err error
response.body, err = UnmarshalHypershiftConfig(reader)
return err
}
Loading
Loading