-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #854 from gdbranco/feat/ocm-4192
OCM-4192 | feat: bump model to 0.0.328
- Loading branch information
Showing
10 changed files
with
14,885 additions
and
14,375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Oops, something went wrong.