Skip to content

Commit

Permalink
OCM-4192 | feat: bump model to 0.0.328
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbranco committed Oct 19, 2023
1 parent 4cbe9ce commit 5bc911e
Show file tree
Hide file tree
Showing 8 changed files with 14,880 additions and 14,374 deletions.
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.327
model_version:=v0.0.328
model_url:=https://github.com/openshift-online/ocm-api-model.git

# Details of the metamodel to use:
Expand Down
10 changes: 10 additions & 0 deletions clustersmgmt/v1/cluster_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,16 @@ func (c *ClusterClient) UpgradePolicies() *UpgradePoliciesClient {
)
}

// Vpc returns the target 'vpc' resource.
//
// Reference to the resource that manages the vpc resource.
func (c *ClusterClient) Vpc() *VpcClient {
return NewVpcClient(
c.transport,
path.Join(c.path, "vpc"),
)
}

// ClusterPollRequest is the request for the Poll method.
type ClusterPollRequest struct {
request *ClusterGetRequest
Expand Down
28,798 changes: 14,426 additions & 14,372 deletions clustersmgmt/v1/openapi.go

Large diffs are not rendered by default.

305 changes: 305 additions & 0 deletions clustersmgmt/v1/vpc_client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
/*
Copyright (c) 2020 Red Hat, 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.
*/

// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
// your changes will be lost when the file is generated again.

package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1

import (
"bufio"
"context"
"io"
"net/http"
"net/url"
"time"

"github.com/openshift-online/ocm-sdk-go/errors"
"github.com/openshift-online/ocm-sdk-go/helpers"
)

// VpcClient is the client of the 'vpc' resource.
//
// Provides detailed information about the status of an specific cluster.
type VpcClient struct {
transport http.RoundTripper
path string
}

// NewVpcClient creates a new client for the 'vpc'
// resource using the given transport to send the requests and receive the
// responses.
func NewVpcClient(transport http.RoundTripper, path string) *VpcClient {
return &VpcClient{
transport: transport,
path: path,
}
}

// Get creates a request for the 'get' method.
func (c *VpcClient) Get() *VpcGetRequest {
return &VpcGetRequest{
transport: c.transport,
path: c.path,
}
}

// VpcPollRequest is the request for the Poll method.
type VpcPollRequest struct {
request *VpcGetRequest
interval time.Duration
statuses []int
predicates []func(interface{}) bool
}

// Parameter adds a query parameter to all the requests that will be used to retrieve the object.
func (r *VpcPollRequest) Parameter(name string, value interface{}) *VpcPollRequest {
r.request.Parameter(name, value)
return r
}

// Header adds a request header to all the requests that will be used to retrieve the object.
func (r *VpcPollRequest) Header(name string, value interface{}) *VpcPollRequest {
r.request.Header(name, value)
return r
}

// Interval sets the polling interval. This parameter is mandatory and must be greater than zero.
func (r *VpcPollRequest) Interval(value time.Duration) *VpcPollRequest {
r.interval = value
return r
}

// Status set the expected status of the response. Multiple values can be set calling this method
// multiple times. The response will be considered successful if the status is any of those values.
func (r *VpcPollRequest) Status(value int) *VpcPollRequest {
r.statuses = append(r.statuses, value)
return r
}

// Predicate adds a predicate that the response should satisfy be considered successful. Multiple
// predicates can be set calling this method multiple times. The response will be considered successful
// if all the predicates are satisfied.
func (r *VpcPollRequest) Predicate(value func(*VpcGetResponse) bool) *VpcPollRequest {
r.predicates = append(r.predicates, func(response interface{}) bool {
return value(response.(*VpcGetResponse))
})
return r
}

// StartContext starts the polling loop. Responses will be considered successful if the status is one of
// the values specified with the Status method and if all the predicates specified with the Predicate
// method return nil.
//
// The context must have a timeout or deadline, otherwise this method will immediately return an error.
func (r *VpcPollRequest) StartContext(ctx context.Context) (response *VpcPollResponse, err error) {
result, err := helpers.PollContext(ctx, r.interval, r.statuses, r.predicates, r.task)
if result != nil {
response = &VpcPollResponse{
response: result.(*VpcGetResponse),
}
}
return
}

// task adapts the types of the request/response types so that they can be used with the generic
// polling function from the helpers package.
func (r *VpcPollRequest) task(ctx context.Context) (status int, result interface{}, err error) {
response, err := r.request.SendContext(ctx)
if response != nil {
status = response.Status()
result = response
}
return
}

// VpcPollResponse is the response for the Poll method.
type VpcPollResponse struct {
response *VpcGetResponse
}

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

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

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

// Body returns the value of the 'body' parameter.
func (r *VpcPollResponse) Body() *CloudVPC {
return r.response.Body()
}

// GetBody returns the value of the 'body' parameter and
// a flag indicating if the parameter has a value.
func (r *VpcPollResponse) GetBody() (value *CloudVPC, ok bool) {
return r.response.GetBody()
}

// Poll creates a request to repeatedly retrieve the object till the response has one of a given set
// of states and satisfies a set of predicates.
func (c *VpcClient) Poll() *VpcPollRequest {
return &VpcPollRequest{
request: c.Get(),
}
}

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

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

// Header adds a request header.
func (r *VpcGetRequest) Header(name string, value interface{}) *VpcGetRequest {
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 *VpcGetRequest) Impersonate(user string) *VpcGetRequest {
helpers.AddImpersonationHeader(&r.header, user)
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 *VpcGetRequest) Send() (result *VpcGetResponse, err error) {
return r.SendContext(context.Background())
}

// SendContext sends this request, waits for the response, and returns it.
func (r *VpcGetRequest) SendContext(ctx context.Context) (result *VpcGetResponse, 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: "GET",
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 = &VpcGetResponse{}
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 = readVpcGetResponse(result, reader)
if err != nil {
return
}
return
}

// VpcGetResponse is the response for the 'get' method.
type VpcGetResponse struct {
status int
header http.Header
err *errors.Error
body *CloudVPC
}

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

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

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

// Body returns the value of the 'body' parameter.
func (r *VpcGetResponse) Body() *CloudVPC {
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 *VpcGetResponse) GetBody() (value *CloudVPC, ok bool) {
ok = r != nil && r.body != nil
if ok {
value = r.body
}
return
}
31 changes: 31 additions & 0 deletions clustersmgmt/v1/vpc_resource_json.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright (c) 2020 Red Hat, 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.
*/

// IMPORTANT: This file has been generated automatically, refrain from modifying it manually as all
// your changes will be lost when the file is generated again.

package v1 // github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1

import "io"

func writeVpcGetRequest(request *VpcGetRequest, writer io.Writer) error {
return nil
}
func readVpcGetResponse(response *VpcGetResponse, reader io.Reader) error {
var err error
response.body, err = UnmarshalCloudVPC(reader)
return err
}
Loading

0 comments on commit 5bc911e

Please sign in to comment.