Skip to content

Commit

Permalink
Merge pull request #226 from igoihman/update_to_0_0_75
Browse files Browse the repository at this point in the history
Update to ocm-api-model 0.0.75
  • Loading branch information
Irit Goihman authored Aug 7, 2020
2 parents 406c4dc + 9474d9f commit 0e7ff7a
Show file tree
Hide file tree
Showing 21 changed files with 3,534 additions and 1,989 deletions.
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.74
model_version:=v0.0.75
model_url:=https://github.com/openshift-online/ocm-api-model.git

# Details of the metamodel to use:
Expand Down
3,410 changes: 1,814 additions & 1,596 deletions accountsmgmt/v1/openapi.go

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions accountsmgmt/v1/root_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,14 @@ func (c *Client) SupportCases() *SupportCasesClient {
path.Join(c.metric, "support_cases"),
)
}

// TokenAuthorization returns the target 'token_authorization' resource.
//
// Reference to the resource that manages token authorization.
func (c *Client) TokenAuthorization() *TokenAuthorizationClient {
return NewTokenAuthorizationClient(
c.transport,
path.Join(c.path, "token_authorization"),
path.Join(c.metric, "token_authorization"),
)
}
12 changes: 12 additions & 0 deletions accountsmgmt/v1/root_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ type Server interface {
//
// Reference to the resource that manages the support cases.
SupportCases() SupportCasesServer

// TokenAuthorization returns the target 'token_authorization' resource.
//
// Reference to the resource that manages token authorization.
TokenAuthorization() TokenAuthorizationServer
}

// Dispatch navigates the servers tree rooted at the given server
Expand Down Expand Up @@ -302,6 +307,13 @@ func Dispatch(w http.ResponseWriter, r *http.Request, server Server, segments []
return
}
dispatchSupportCases(w, r, target, segments[1:])
case "token_authorization":
target := server.TokenAuthorization()
if target == nil {
errors.SendNotFound(w, r)
return
}
dispatchTokenAuthorization(w, r, target, segments[1:])
default:
errors.SendNotFound(w, r)
return
Expand Down
155 changes: 155 additions & 0 deletions accountsmgmt/v1/support_case_client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/*
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/accountsmgmt/v1

import (
"context"
"net/http"
"net/url"

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

// SupportCaseClient is the client of the 'support_case' resource.
//
// Manages a specific support case.
type SupportCaseClient struct {
transport http.RoundTripper
path string
metric string
}

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

// Delete creates a request for the 'delete' method.
//
// Deletes the support case by Case ID.
func (c *SupportCaseClient) Delete() *SupportCaseDeleteRequest {
return &SupportCaseDeleteRequest{
transport: c.transport,
path: c.path,
metric: c.metric,
}
}

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

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

// Header adds a request header.
func (r *SupportCaseDeleteRequest) Header(name string, value interface{}) *SupportCaseDeleteRequest {
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 *SupportCaseDeleteRequest) Send() (result *SupportCaseDeleteResponse, err error) {
return r.SendContext(context.Background())
}

// SendContext sends this request, waits for the response, and returns it.
func (r *SupportCaseDeleteRequest) SendContext(ctx context.Context) (result *SupportCaseDeleteResponse, err error) {
query := helpers.CopyQuery(r.query)
header := helpers.SetHeader(r.header, r.metric)
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 = &SupportCaseDeleteResponse{}
result.status = response.StatusCode
result.header = response.Header
if result.status >= 400 {
result.err, err = errors.UnmarshalError(response.Body)
if err != nil {
return
}
err = result.err
return
}
return
}

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

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

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

// Error returns the response error.
func (r *SupportCaseDeleteResponse) Error() *errors.Error {
if r == nil {
return nil
}
return r.err
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,109 +19,131 @@ limitations under the License.

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

// SupportCaseBuilder contains the data and logic needed to build 'support_case' objects.
//
//
type SupportCaseBuilder struct {
id *string
href *string
link bool
clusterUuid *string
description *string
eventStreamId *string
severity *string
summary *string
// SupportCaseRequestBuilder contains the data and logic needed to build 'support_case_request' objects.
//
//
type SupportCaseRequestBuilder struct {
id *string
href *string
link bool
clusterId *string
clusterUuid *string
description *string
eventStreamId *string
severity *string
subscriptionId *string
summary *string
}

// NewSupportCase creates a new builder of 'support_case' objects.
func NewSupportCase() *SupportCaseBuilder {
return new(SupportCaseBuilder)
// NewSupportCaseRequest creates a new builder of 'support_case_request' objects.
func NewSupportCaseRequest() *SupportCaseRequestBuilder {
return new(SupportCaseRequestBuilder)
}

// ID sets the identifier of the object.
func (b *SupportCaseBuilder) ID(value string) *SupportCaseBuilder {
func (b *SupportCaseRequestBuilder) ID(value string) *SupportCaseRequestBuilder {
b.id = &value
return b
}

// HREF sets the link to the object.
func (b *SupportCaseBuilder) HREF(value string) *SupportCaseBuilder {
func (b *SupportCaseRequestBuilder) HREF(value string) *SupportCaseRequestBuilder {
b.href = &value
return b
}

// Link sets the flag that indicates if this is a link.
func (b *SupportCaseBuilder) Link(value bool) *SupportCaseBuilder {
func (b *SupportCaseRequestBuilder) Link(value bool) *SupportCaseRequestBuilder {
b.link = value
return b
}

// ClusterId sets the value of the 'cluster_id' attribute to the given value.
//
//
func (b *SupportCaseRequestBuilder) ClusterId(value string) *SupportCaseRequestBuilder {
b.clusterId = &value
return b
}

// ClusterUuid sets the value of the 'cluster_uuid' attribute to the given value.
//
//
func (b *SupportCaseBuilder) ClusterUuid(value string) *SupportCaseBuilder {
func (b *SupportCaseRequestBuilder) ClusterUuid(value string) *SupportCaseRequestBuilder {
b.clusterUuid = &value
return b
}

// Description sets the value of the 'description' attribute to the given value.
//
//
func (b *SupportCaseBuilder) Description(value string) *SupportCaseBuilder {
func (b *SupportCaseRequestBuilder) Description(value string) *SupportCaseRequestBuilder {
b.description = &value
return b
}

// EventStreamId sets the value of the 'event_stream_id' attribute to the given value.
//
//
func (b *SupportCaseBuilder) EventStreamId(value string) *SupportCaseBuilder {
func (b *SupportCaseRequestBuilder) EventStreamId(value string) *SupportCaseRequestBuilder {
b.eventStreamId = &value
return b
}

// Severity sets the value of the 'severity' attribute to the given value.
//
//
func (b *SupportCaseBuilder) Severity(value string) *SupportCaseBuilder {
func (b *SupportCaseRequestBuilder) Severity(value string) *SupportCaseRequestBuilder {
b.severity = &value
return b
}

// SubscriptionId sets the value of the 'subscription_id' attribute to the given value.
//
//
func (b *SupportCaseRequestBuilder) SubscriptionId(value string) *SupportCaseRequestBuilder {
b.subscriptionId = &value
return b
}

// Summary sets the value of the 'summary' attribute to the given value.
//
//
func (b *SupportCaseBuilder) Summary(value string) *SupportCaseBuilder {
func (b *SupportCaseRequestBuilder) Summary(value string) *SupportCaseRequestBuilder {
b.summary = &value
return b
}

// Copy copies the attributes of the given object into this builder, discarding any previous values.
func (b *SupportCaseBuilder) Copy(object *SupportCase) *SupportCaseBuilder {
func (b *SupportCaseRequestBuilder) Copy(object *SupportCaseRequest) *SupportCaseRequestBuilder {
if object == nil {
return b
}
b.id = object.id
b.href = object.href
b.link = object.link
b.clusterId = object.clusterId
b.clusterUuid = object.clusterUuid
b.description = object.description
b.eventStreamId = object.eventStreamId
b.severity = object.severity
b.subscriptionId = object.subscriptionId
b.summary = object.summary
return b
}

// Build creates a 'support_case' object using the configuration stored in the builder.
func (b *SupportCaseBuilder) Build() (object *SupportCase, err error) {
object = new(SupportCase)
// Build creates a 'support_case_request' object using the configuration stored in the builder.
func (b *SupportCaseRequestBuilder) Build() (object *SupportCaseRequest, err error) {
object = new(SupportCaseRequest)
object.id = b.id
object.href = b.href
object.link = b.link
object.clusterId = b.clusterId
object.clusterUuid = b.clusterUuid
object.description = b.description
object.eventStreamId = b.eventStreamId
object.severity = b.severity
object.subscriptionId = b.subscriptionId
object.summary = b.summary
return
}
Loading

0 comments on commit 0e7ff7a

Please sign in to comment.