diff --git a/clients/instance/ibm-pi-network-address-group.go b/clients/instance/ibm-pi-network-address-group.go new file mode 100644 index 00000000..d35dd019 --- /dev/null +++ b/clients/instance/ibm-pi-network-address-group.go @@ -0,0 +1,114 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/helpers" + "github.com/IBM-Cloud/power-go-client/ibmpisession" + "github.com/IBM-Cloud/power-go-client/power/client/network_address_groups" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPINetworkAddressGroupClient +type IBMPINetworkAddressGroupClient struct { + IBMPIClient +} + +// NewIBMPINetworkAddressGroupClient +func NewIBMPINetworkAddressGroupClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPINetworkAddressGroupClient { + return &IBMPINetworkAddressGroupClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Create a new Network Address Group +func (f *IBMPINetworkAddressGroupClient) Create(body *models.NetworkAddressGroupCreate) (*models.NetworkAddressGroup, error) { + params := network_address_groups.NewV1NetworkAddressGroupsPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body) + postok, postcreated, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to create a network address group %s", err)) + } + if postok != nil && postok.Payload != nil { + return postok.Payload, nil + } + if postcreated != nil && postcreated.Payload != nil { + return postcreated.Payload, nil + } + return nil, fmt.Errorf("failed to create a network address group") +} + +// Get the list of Network Address Groups for a workspace +func (f *IBMPINetworkAddressGroupClient) GetAll() (*models.NetworkAddressGroups, error) { + params := network_address_groups.NewV1NetworkAddressGroupsGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get network address groups %s", err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get network address groups") + } + return resp.Payload, nil + +} + +// Get the detail of a Network Address Group +func (f *IBMPINetworkAddressGroupClient) Get(id string) (*models.NetworkAddressGroup, error) { + params := network_address_groups.NewV1NetworkAddressGroupsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithNetworkAddressGroupID(id) + resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsIDGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get network address group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get network address group %s", id) + } + return resp.Payload, nil + +} + +// Update a Network Address Group +func (f *IBMPINetworkAddressGroupClient) Update(id string, body *models.NetworkAddressGroupUpdate) (*models.NetworkAddressGroup, error) { + params := network_address_groups.NewV1NetworkAddressGroupsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut).WithNetworkAddressGroupID(id).WithBody(body) + resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsIDPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update network address group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to update network address group %s", id) + } + return resp.Payload, nil +} + +// Delete a Network Address Group from a workspace +func (f *IBMPINetworkAddressGroupClient) Delete(id string) error { + params := network_address_groups.NewV1NetworkAddressGroupsIDDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkAddressGroupID(id) + _, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsIDDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to delete network address group %s: %w", id, err) + } + return nil +} + +// Add a member to a Network Address Group +func (f *IBMPINetworkAddressGroupClient) AddMember(id string, body *models.NetworkAddressGroupAddMember) (*models.NetworkAddressGroupMember, error) { + params := network_address_groups.NewV1NetworkAddressGroupsMembersPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkAddressGroupID(id).WithBody(body) + resp, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsMembersPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to add member to network address group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to add member to network address group %s", id) + } + return resp.Payload, nil +} + +// Delete the member from a Network Address Group +func (f *IBMPINetworkAddressGroupClient) DeleteMember(id, memberId string) error { + params := network_address_groups.NewV1NetworkAddressGroupsMembersDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkAddressGroupID(id).WithNetworkAddressGroupMemberID(memberId) + _, err := f.session.Power.NetworkAddressGroups.V1NetworkAddressGroupsMembersDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete member %s from network address group %s: %w", memberId, id, err)) + } + + return nil +} diff --git a/clients/instance/ibm-pi-network-security-group.go b/clients/instance/ibm-pi-network-security-group.go new file mode 100644 index 00000000..d9d4bf52 --- /dev/null +++ b/clients/instance/ibm-pi-network-security-group.go @@ -0,0 +1,144 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/helpers" + "github.com/IBM-Cloud/power-go-client/ibmpisession" + "github.com/IBM-Cloud/power-go-client/power/client/network_security_groups" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPINetworkSecurityGroupClient +type IBMPINetworkSecurityGroupClient struct { + IBMPIClient +} + +// NewIBMIPINetworkSecurityGroupClient +func NewIBMIPINetworkSecurityGroupClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPINetworkSecurityGroupClient { + return &IBMPINetworkSecurityGroupClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get a network security group +func (f *IBMPINetworkSecurityGroupClient) Get(id string) (*models.NetworkSecurityGroup, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsIDGetParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut).WithNetworkSecurityGroupID(id) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsIDGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get network security group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get network security group %s", id) + } + return resp.Payload, nil +} + +// Get all network security groups +func (f *IBMPINetworkSecurityGroupClient) GetAll() (*models.NetworkSecurityGroups, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsListParams().WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsList(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to get network security groups %s", err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get network security groups") + } + return resp.Payload, nil +} + +// Create a network security group +func (f *IBMPINetworkSecurityGroupClient) Create(body *models.NetworkSecurityGroupCreate) (*models.NetworkSecurityGroup, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body) + postok, postcreated, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to create a network security group %s", err)) + } + if postok != nil && postok.Payload != nil { + return postok.Payload, nil + } + if postcreated != nil && postcreated.Payload != nil { + return postcreated.Payload, nil + } + return nil, fmt.Errorf("failed to create a network security group") +} + +// Update a network security group +func (f *IBMPINetworkSecurityGroupClient) Update(id string, body *models.NetworkSecurityGroupUpdate) (*models.NetworkSecurityGroup, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsIDPutParams().WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut).WithNetworkSecurityGroupID(id).WithBody(body) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsIDPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to update network security group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to update network security group %s", id) + } + return resp.Payload, nil +} + +// Delete a network security group +func (f *IBMPINetworkSecurityGroupClient) Delete(id string) error { + params := network_security_groups.NewV1NetworkSecurityGroupsIDDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkSecurityGroupID(id) + _, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsIDDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to delete network security group %s: %w", id, err) + } + return nil +} + +// Add a member to a network security group +func (f *IBMPINetworkSecurityGroupClient) AddMember(id string, body *models.NetworkSecurityGroupAddMember) (*models.NetworkSecurityGroupMember, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsMembersPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkSecurityGroupID(id).WithBody(body) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsMembersPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to add member to network security group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to add member to network security group %s", id) + } + return resp.Payload, nil +} + +// Deleta a member from a network securti group +func (f *IBMPINetworkSecurityGroupClient) DeleteMember(id, memberId string) error { + params := network_security_groups.NewV1NetworkSecurityGroupsMembersDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkSecurityGroupID(id).WithNetworkSecurityGroupMemberID(memberId) + _, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsMembersDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete member %s from network security group %s: %w", memberId, id, err)) + } + return nil +} + +// Add a rule to a network security group +func (f *IBMPINetworkSecurityGroupClient) AddRule(id string, body *models.NetworkSecurityGroupAddRule) (*models.NetworkSecurityGroupRule, error) { + params := network_security_groups.NewV1NetworkSecurityGroupsRulesPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithNetworkSecurityGroupID(id).WithBody(body) + resp, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsRulesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to add rule to network security group %s: %w", id, err)) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to add rule to network security group %s", id) + } + return resp.Payload, nil +} + +// Delete a rule from a network security group +func (f *IBMPINetworkSecurityGroupClient) DeleteRule(id, ruleId string) error { + params := network_security_groups.NewV1NetworkSecurityGroupsRulesDeleteParams().WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut).WithNetworkSecurityGroupID(id).WithNetworkSecurityGroupRuleID(ruleId) + _, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsRulesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return ibmpisession.SDKFailWithAPIError(err, fmt.Errorf("failed to delete rule %s from network security group %s: %w", ruleId, id, err)) + } + return nil +} + +// Action on a network security group +func (f *IBMPINetworkSecurityGroupClient) Action(body *models.NetworkSecurityGroupsAction) error { + params := network_security_groups.NewV1NetworkSecurityGroupsActionPostParams().WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut).WithBody(body) + _, _, err := f.session.Power.NetworkSecurityGroups.V1NetworkSecurityGroupsActionPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to perform action :%w", err) + } + return nil +} diff --git a/power/client/network_address_groups/network_address_groups_client.go b/power/client/network_address_groups/network_address_groups_client.go new file mode 100644 index 00000000..e2e3af98 --- /dev/null +++ b/power/client/network_address_groups/network_address_groups_client.go @@ -0,0 +1,353 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new network address groups API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new network address groups API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new network address groups API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for network address groups API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + V1NetworkAddressGroupsGet(params *V1NetworkAddressGroupsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsGetOK, error) + + V1NetworkAddressGroupsIDDelete(params *V1NetworkAddressGroupsIDDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDDeleteOK, error) + + V1NetworkAddressGroupsIDGet(params *V1NetworkAddressGroupsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDGetOK, error) + + V1NetworkAddressGroupsIDPut(params *V1NetworkAddressGroupsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDPutOK, error) + + V1NetworkAddressGroupsMembersDelete(params *V1NetworkAddressGroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsMembersDeleteOK, error) + + V1NetworkAddressGroupsMembersPost(params *V1NetworkAddressGroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsMembersPostOK, error) + + V1NetworkAddressGroupsPost(params *V1NetworkAddressGroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsPostOK, *V1NetworkAddressGroupsPostCreated, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +V1NetworkAddressGroupsGet gets the list of network address groups for a workspace +*/ +func (a *Client) V1NetworkAddressGroupsGet(params *V1NetworkAddressGroupsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.get", + Method: "GET", + PathPattern: "/v1/network-address-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkAddressGroupsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkAddressGroups.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsIDDelete deletes a network address group from a workspace +*/ +func (a *Client) V1NetworkAddressGroupsIDDelete(params *V1NetworkAddressGroupsIDDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsIDDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.id.delete", + Method: "DELETE", + PathPattern: "/v1/network-address-groups/{network_address_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsIDDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkAddressGroupsIDDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkAddressGroups.id.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsIDGet gets the detail of a network address group +*/ +func (a *Client) V1NetworkAddressGroupsIDGet(params *V1NetworkAddressGroupsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsIDGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.id.get", + Method: "GET", + PathPattern: "/v1/network-address-groups/{network_address_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsIDGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkAddressGroupsIDGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkAddressGroups.id.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsIDPut updates a network address group +*/ +func (a *Client) V1NetworkAddressGroupsIDPut(params *V1NetworkAddressGroupsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsIDPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsIDPutParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.id.put", + Method: "PUT", + PathPattern: "/v1/network-address-groups/{network_address_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsIDPutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkAddressGroupsIDPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkAddressGroups.id.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsMembersDelete deletes the member from a network address group +*/ +func (a *Client) V1NetworkAddressGroupsMembersDelete(params *V1NetworkAddressGroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsMembersDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsMembersDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.members.delete", + Method: "DELETE", + PathPattern: "/v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsMembersDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkAddressGroupsMembersDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkAddressGroups.members.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsMembersPost adds a member to a network address group +*/ +func (a *Client) V1NetworkAddressGroupsMembersPost(params *V1NetworkAddressGroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsMembersPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsMembersPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.members.post", + Method: "POST", + PathPattern: "/v1/network-address-groups/{network_address_group_id}/members", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsMembersPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkAddressGroupsMembersPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkAddressGroups.members.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkAddressGroupsPost creates a new network address group +*/ +func (a *Client) V1NetworkAddressGroupsPost(params *V1NetworkAddressGroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkAddressGroupsPostOK, *V1NetworkAddressGroupsPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkAddressGroupsPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkAddressGroups.post", + Method: "POST", + PathPattern: "/v1/network-address-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkAddressGroupsPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *V1NetworkAddressGroupsPostOK: + return value, nil, nil + case *V1NetworkAddressGroupsPostCreated: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for network_address_groups: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/power/client/network_address_groups/v1_network_address_groups_get_parameters.go b/power/client/network_address_groups/v1_network_address_groups_get_parameters.go new file mode 100644 index 00000000..6e230a35 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworkAddressGroupsGetParams creates a new V1NetworkAddressGroupsGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkAddressGroupsGetParams() *V1NetworkAddressGroupsGetParams { + return &V1NetworkAddressGroupsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsGetParamsWithTimeout creates a new V1NetworkAddressGroupsGetParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsGetParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsGetParams { + return &V1NetworkAddressGroupsGetParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsGetParamsWithContext creates a new V1NetworkAddressGroupsGetParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsGetParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsGetParams { + return &V1NetworkAddressGroupsGetParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsGetParamsWithHTTPClient creates a new V1NetworkAddressGroupsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsGetParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsGetParams { + return &V1NetworkAddressGroupsGetParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsGetParams contains all the parameters to send to the API endpoint + + for the v1 network address groups get operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsGetParams) WithDefaults() *V1NetworkAddressGroupsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups get params +func (o *V1NetworkAddressGroupsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_get_responses.go b/power/client/network_address_groups/v1_network_address_groups_get_responses.go new file mode 100644 index 00000000..5716e64c --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_get_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkAddressGroupsGetReader is a Reader for the V1NetworkAddressGroupsGet structure. +type V1NetworkAddressGroupsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/network-address-groups] v1.networkAddressGroups.get", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsGetOK creates a V1NetworkAddressGroupsGetOK with default headers values +func NewV1NetworkAddressGroupsGetOK() *V1NetworkAddressGroupsGetOK { + return &V1NetworkAddressGroupsGetOK{} +} + +/* +V1NetworkAddressGroupsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsGetOK struct { + Payload *models.NetworkAddressGroups +} + +// IsSuccess returns true when this v1 network address groups get o k response has a 2xx status code +func (o *V1NetworkAddressGroupsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups get o k response has a 3xx status code +func (o *V1NetworkAddressGroupsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get o k response has a 4xx status code +func (o *V1NetworkAddressGroupsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups get o k response has a 5xx status code +func (o *V1NetworkAddressGroupsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups get o k response a status code equal to that given +func (o *V1NetworkAddressGroupsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups get o k response +func (o *V1NetworkAddressGroupsGetOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsGetOK) GetPayload() *models.NetworkAddressGroups { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroups) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsGetBadRequest creates a V1NetworkAddressGroupsGetBadRequest with default headers values +func NewV1NetworkAddressGroupsGetBadRequest() *V1NetworkAddressGroupsGetBadRequest { + return &V1NetworkAddressGroupsGetBadRequest{} +} + +/* +V1NetworkAddressGroupsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups get bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups get bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups get bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups get bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups get bad request response +func (o *V1NetworkAddressGroupsGetBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsGetUnauthorized creates a V1NetworkAddressGroupsGetUnauthorized with default headers values +func NewV1NetworkAddressGroupsGetUnauthorized() *V1NetworkAddressGroupsGetUnauthorized { + return &V1NetworkAddressGroupsGetUnauthorized{} +} + +/* +V1NetworkAddressGroupsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups get unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups get unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups get unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups get unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups get unauthorized response +func (o *V1NetworkAddressGroupsGetUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsGetForbidden creates a V1NetworkAddressGroupsGetForbidden with default headers values +func NewV1NetworkAddressGroupsGetForbidden() *V1NetworkAddressGroupsGetForbidden { + return &V1NetworkAddressGroupsGetForbidden{} +} + +/* +V1NetworkAddressGroupsGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups get forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups get forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups get forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups get forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups get forbidden response +func (o *V1NetworkAddressGroupsGetForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsGetNotFound creates a V1NetworkAddressGroupsGetNotFound with default headers values +func NewV1NetworkAddressGroupsGetNotFound() *V1NetworkAddressGroupsGetNotFound { + return &V1NetworkAddressGroupsGetNotFound{} +} + +/* +V1NetworkAddressGroupsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups get not found response has a 2xx status code +func (o *V1NetworkAddressGroupsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups get not found response has a 3xx status code +func (o *V1NetworkAddressGroupsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get not found response has a 4xx status code +func (o *V1NetworkAddressGroupsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups get not found response has a 5xx status code +func (o *V1NetworkAddressGroupsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups get not found response a status code equal to that given +func (o *V1NetworkAddressGroupsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups get not found response +func (o *V1NetworkAddressGroupsGetNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsGetInternalServerError creates a V1NetworkAddressGroupsGetInternalServerError with default headers values +func NewV1NetworkAddressGroupsGetInternalServerError() *V1NetworkAddressGroupsGetInternalServerError { + return &V1NetworkAddressGroupsGetInternalServerError{} +} + +/* +V1NetworkAddressGroupsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups get internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups get internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups get internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups get internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups get internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups get internal server error response +func (o *V1NetworkAddressGroupsGetInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups][%d] v1NetworkAddressGroupsGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_id_delete_parameters.go b/power/client/network_address_groups/v1_network_address_groups_id_delete_parameters.go new file mode 100644 index 00000000..fb6028a1 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworkAddressGroupsIDDeleteParams creates a new V1NetworkAddressGroupsIDDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkAddressGroupsIDDeleteParams() *V1NetworkAddressGroupsIDDeleteParams { + return &V1NetworkAddressGroupsIDDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsIDDeleteParamsWithTimeout creates a new V1NetworkAddressGroupsIDDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsIDDeleteParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDDeleteParams { + return &V1NetworkAddressGroupsIDDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsIDDeleteParamsWithContext creates a new V1NetworkAddressGroupsIDDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsIDDeleteParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsIDDeleteParams { + return &V1NetworkAddressGroupsIDDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsIDDeleteParamsWithHTTPClient creates a new V1NetworkAddressGroupsIDDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsIDDeleteParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDDeleteParams { + return &V1NetworkAddressGroupsIDDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsIDDeleteParams contains all the parameters to send to the API endpoint + + for the v1 network address groups id delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsIDDeleteParams struct { + + /* NetworkAddressGroupID. + + Network Address Group ID + */ + NetworkAddressGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups id delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDDeleteParams) WithDefaults() *V1NetworkAddressGroupsIDDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups id delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsIDDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkAddressGroupID adds the networkAddressGroupID to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) WithNetworkAddressGroupID(networkAddressGroupID string) *V1NetworkAddressGroupsIDDeleteParams { + o.SetNetworkAddressGroupID(networkAddressGroupID) + return o +} + +// SetNetworkAddressGroupID adds the networkAddressGroupId to the v1 network address groups id delete params +func (o *V1NetworkAddressGroupsIDDeleteParams) SetNetworkAddressGroupID(networkAddressGroupID string) { + o.NetworkAddressGroupID = networkAddressGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsIDDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_address_group_id + if err := r.SetPathParam("network_address_group_id", o.NetworkAddressGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_id_delete_responses.go b/power/client/network_address_groups/v1_network_address_groups_id_delete_responses.go new file mode 100644 index 00000000..92768813 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkAddressGroupsIDDeleteReader is a Reader for the V1NetworkAddressGroupsIDDelete structure. +type V1NetworkAddressGroupsIDDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsIDDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsIDDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsIDDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsIDDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsIDDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsIDDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkAddressGroupsIDDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsIDDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/network-address-groups/{network_address_group_id}] v1.networkAddressGroups.id.delete", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsIDDeleteOK creates a V1NetworkAddressGroupsIDDeleteOK with default headers values +func NewV1NetworkAddressGroupsIDDeleteOK() *V1NetworkAddressGroupsIDDeleteOK { + return &V1NetworkAddressGroupsIDDeleteOK{} +} + +/* +V1NetworkAddressGroupsIDDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsIDDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network address groups Id delete o k response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups Id delete o k response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete o k response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id delete o k response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete o k response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups Id delete o k response +func (o *V1NetworkAddressGroupsIDDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsIDDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDDeleteBadRequest creates a V1NetworkAddressGroupsIDDeleteBadRequest with default headers values +func NewV1NetworkAddressGroupsIDDeleteBadRequest() *V1NetworkAddressGroupsIDDeleteBadRequest { + return &V1NetworkAddressGroupsIDDeleteBadRequest{} +} + +/* +V1NetworkAddressGroupsIDDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsIDDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id delete bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups Id delete bad request response +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDDeleteUnauthorized creates a V1NetworkAddressGroupsIDDeleteUnauthorized with default headers values +func NewV1NetworkAddressGroupsIDDeleteUnauthorized() *V1NetworkAddressGroupsIDDeleteUnauthorized { + return &V1NetworkAddressGroupsIDDeleteUnauthorized{} +} + +/* +V1NetworkAddressGroupsIDDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsIDDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id delete unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups Id delete unauthorized response +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDDeleteForbidden creates a V1NetworkAddressGroupsIDDeleteForbidden with default headers values +func NewV1NetworkAddressGroupsIDDeleteForbidden() *V1NetworkAddressGroupsIDDeleteForbidden { + return &V1NetworkAddressGroupsIDDeleteForbidden{} +} + +/* +V1NetworkAddressGroupsIDDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsIDDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id delete forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups Id delete forbidden response +func (o *V1NetworkAddressGroupsIDDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsIDDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDDeleteNotFound creates a V1NetworkAddressGroupsIDDeleteNotFound with default headers values +func NewV1NetworkAddressGroupsIDDeleteNotFound() *V1NetworkAddressGroupsIDDeleteNotFound { + return &V1NetworkAddressGroupsIDDeleteNotFound{} +} + +/* +V1NetworkAddressGroupsIDDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsIDDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete not found response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete not found response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete not found response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id delete not found response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete not found response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups Id delete not found response +func (o *V1NetworkAddressGroupsIDDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsIDDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDDeleteConflict creates a V1NetworkAddressGroupsIDDeleteConflict with default headers values +func NewV1NetworkAddressGroupsIDDeleteConflict() *V1NetworkAddressGroupsIDDeleteConflict { + return &V1NetworkAddressGroupsIDDeleteConflict{} +} + +/* +V1NetworkAddressGroupsIDDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkAddressGroupsIDDeleteConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete conflict response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete conflict response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete conflict response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id delete conflict response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id delete conflict response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network address groups Id delete conflict response +func (o *V1NetworkAddressGroupsIDDeleteConflict) Code() int { + return 409 +} + +func (o *V1NetworkAddressGroupsIDDeleteConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDDeleteInternalServerError creates a V1NetworkAddressGroupsIDDeleteInternalServerError with default headers values +func NewV1NetworkAddressGroupsIDDeleteInternalServerError() *V1NetworkAddressGroupsIDDeleteInternalServerError { + return &V1NetworkAddressGroupsIDDeleteInternalServerError{} +} + +/* +V1NetworkAddressGroupsIDDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsIDDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id delete internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id delete internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id delete internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id delete internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups Id delete internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups Id delete internal server error response +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_id_get_parameters.go b/power/client/network_address_groups/v1_network_address_groups_id_get_parameters.go new file mode 100644 index 00000000..0e9784c9 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworkAddressGroupsIDGetParams creates a new V1NetworkAddressGroupsIDGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkAddressGroupsIDGetParams() *V1NetworkAddressGroupsIDGetParams { + return &V1NetworkAddressGroupsIDGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsIDGetParamsWithTimeout creates a new V1NetworkAddressGroupsIDGetParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsIDGetParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDGetParams { + return &V1NetworkAddressGroupsIDGetParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsIDGetParamsWithContext creates a new V1NetworkAddressGroupsIDGetParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsIDGetParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsIDGetParams { + return &V1NetworkAddressGroupsIDGetParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsIDGetParamsWithHTTPClient creates a new V1NetworkAddressGroupsIDGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsIDGetParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDGetParams { + return &V1NetworkAddressGroupsIDGetParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsIDGetParams contains all the parameters to send to the API endpoint + + for the v1 network address groups id get operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsIDGetParams struct { + + /* NetworkAddressGroupID. + + Network Address Group ID + */ + NetworkAddressGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDGetParams) WithDefaults() *V1NetworkAddressGroupsIDGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsIDGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkAddressGroupID adds the networkAddressGroupID to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) WithNetworkAddressGroupID(networkAddressGroupID string) *V1NetworkAddressGroupsIDGetParams { + o.SetNetworkAddressGroupID(networkAddressGroupID) + return o +} + +// SetNetworkAddressGroupID adds the networkAddressGroupId to the v1 network address groups id get params +func (o *V1NetworkAddressGroupsIDGetParams) SetNetworkAddressGroupID(networkAddressGroupID string) { + o.NetworkAddressGroupID = networkAddressGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsIDGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_address_group_id + if err := r.SetPathParam("network_address_group_id", o.NetworkAddressGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_id_get_responses.go b/power/client/network_address_groups/v1_network_address_groups_id_get_responses.go new file mode 100644 index 00000000..fb0df93b --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_get_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkAddressGroupsIDGetReader is a Reader for the V1NetworkAddressGroupsIDGet structure. +type V1NetworkAddressGroupsIDGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsIDGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsIDGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsIDGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsIDGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsIDGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsIDGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsIDGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/network-address-groups/{network_address_group_id}] v1.networkAddressGroups.id.get", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsIDGetOK creates a V1NetworkAddressGroupsIDGetOK with default headers values +func NewV1NetworkAddressGroupsIDGetOK() *V1NetworkAddressGroupsIDGetOK { + return &V1NetworkAddressGroupsIDGetOK{} +} + +/* +V1NetworkAddressGroupsIDGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsIDGetOK struct { + Payload *models.NetworkAddressGroup +} + +// IsSuccess returns true when this v1 network address groups Id get o k response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups Id get o k response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get o k response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id get o k response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id get o k response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups Id get o k response +func (o *V1NetworkAddressGroupsIDGetOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsIDGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDGetOK) GetPayload() *models.NetworkAddressGroup { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDGetBadRequest creates a V1NetworkAddressGroupsIDGetBadRequest with default headers values +func NewV1NetworkAddressGroupsIDGetBadRequest() *V1NetworkAddressGroupsIDGetBadRequest { + return &V1NetworkAddressGroupsIDGetBadRequest{} +} + +/* +V1NetworkAddressGroupsIDGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsIDGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id get bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id get bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id get bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id get bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups Id get bad request response +func (o *V1NetworkAddressGroupsIDGetBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsIDGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDGetUnauthorized creates a V1NetworkAddressGroupsIDGetUnauthorized with default headers values +func NewV1NetworkAddressGroupsIDGetUnauthorized() *V1NetworkAddressGroupsIDGetUnauthorized { + return &V1NetworkAddressGroupsIDGetUnauthorized{} +} + +/* +V1NetworkAddressGroupsIDGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsIDGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id get unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id get unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id get unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id get unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups Id get unauthorized response +func (o *V1NetworkAddressGroupsIDGetUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsIDGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDGetForbidden creates a V1NetworkAddressGroupsIDGetForbidden with default headers values +func NewV1NetworkAddressGroupsIDGetForbidden() *V1NetworkAddressGroupsIDGetForbidden { + return &V1NetworkAddressGroupsIDGetForbidden{} +} + +/* +V1NetworkAddressGroupsIDGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsIDGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id get forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id get forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id get forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id get forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups Id get forbidden response +func (o *V1NetworkAddressGroupsIDGetForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsIDGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDGetNotFound creates a V1NetworkAddressGroupsIDGetNotFound with default headers values +func NewV1NetworkAddressGroupsIDGetNotFound() *V1NetworkAddressGroupsIDGetNotFound { + return &V1NetworkAddressGroupsIDGetNotFound{} +} + +/* +V1NetworkAddressGroupsIDGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsIDGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id get not found response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id get not found response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get not found response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id get not found response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id get not found response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups Id get not found response +func (o *V1NetworkAddressGroupsIDGetNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsIDGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDGetInternalServerError creates a V1NetworkAddressGroupsIDGetInternalServerError with default headers values +func NewV1NetworkAddressGroupsIDGetInternalServerError() *V1NetworkAddressGroupsIDGetInternalServerError { + return &V1NetworkAddressGroupsIDGetInternalServerError{} +} + +/* +V1NetworkAddressGroupsIDGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsIDGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id get internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsIDGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id get internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsIDGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id get internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsIDGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id get internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsIDGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups Id get internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsIDGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups Id get internal server error response +func (o *V1NetworkAddressGroupsIDGetInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsIDGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_id_put_parameters.go b/power/client/network_address_groups/v1_network_address_groups_id_put_parameters.go new file mode 100644 index 00000000..c09279ba --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_put_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewV1NetworkAddressGroupsIDPutParams creates a new V1NetworkAddressGroupsIDPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkAddressGroupsIDPutParams() *V1NetworkAddressGroupsIDPutParams { + return &V1NetworkAddressGroupsIDPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsIDPutParamsWithTimeout creates a new V1NetworkAddressGroupsIDPutParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsIDPutParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDPutParams { + return &V1NetworkAddressGroupsIDPutParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsIDPutParamsWithContext creates a new V1NetworkAddressGroupsIDPutParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsIDPutParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsIDPutParams { + return &V1NetworkAddressGroupsIDPutParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsIDPutParamsWithHTTPClient creates a new V1NetworkAddressGroupsIDPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsIDPutParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDPutParams { + return &V1NetworkAddressGroupsIDPutParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsIDPutParams contains all the parameters to send to the API endpoint + + for the v1 network address groups id put operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsIDPutParams struct { + + /* Body. + + Parameters for the update of a Network Address Group + */ + Body *models.NetworkAddressGroupUpdate + + /* NetworkAddressGroupID. + + Network Address Group ID + */ + NetworkAddressGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDPutParams) WithDefaults() *V1NetworkAddressGroupsIDPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsIDPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsIDPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsIDPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsIDPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) WithBody(body *models.NetworkAddressGroupUpdate) *V1NetworkAddressGroupsIDPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) SetBody(body *models.NetworkAddressGroupUpdate) { + o.Body = body +} + +// WithNetworkAddressGroupID adds the networkAddressGroupID to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) WithNetworkAddressGroupID(networkAddressGroupID string) *V1NetworkAddressGroupsIDPutParams { + o.SetNetworkAddressGroupID(networkAddressGroupID) + return o +} + +// SetNetworkAddressGroupID adds the networkAddressGroupId to the v1 network address groups id put params +func (o *V1NetworkAddressGroupsIDPutParams) SetNetworkAddressGroupID(networkAddressGroupID string) { + o.NetworkAddressGroupID = networkAddressGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsIDPutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_address_group_id + if err := r.SetPathParam("network_address_group_id", o.NetworkAddressGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_id_put_responses.go b/power/client/network_address_groups/v1_network_address_groups_id_put_responses.go new file mode 100644 index 00000000..0c86e3a0 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_id_put_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkAddressGroupsIDPutReader is a Reader for the V1NetworkAddressGroupsIDPut structure. +type V1NetworkAddressGroupsIDPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsIDPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsIDPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsIDPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsIDPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsIDPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsIDPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsIDPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /v1/network-address-groups/{network_address_group_id}] v1.networkAddressGroups.id.put", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsIDPutOK creates a V1NetworkAddressGroupsIDPutOK with default headers values +func NewV1NetworkAddressGroupsIDPutOK() *V1NetworkAddressGroupsIDPutOK { + return &V1NetworkAddressGroupsIDPutOK{} +} + +/* +V1NetworkAddressGroupsIDPutOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsIDPutOK struct { + Payload *models.NetworkAddressGroup +} + +// IsSuccess returns true when this v1 network address groups Id put o k response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups Id put o k response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put o k response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id put o k response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id put o k response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups Id put o k response +func (o *V1NetworkAddressGroupsIDPutOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsIDPutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDPutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsIDPutOK) GetPayload() *models.NetworkAddressGroup { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDPutBadRequest creates a V1NetworkAddressGroupsIDPutBadRequest with default headers values +func NewV1NetworkAddressGroupsIDPutBadRequest() *V1NetworkAddressGroupsIDPutBadRequest { + return &V1NetworkAddressGroupsIDPutBadRequest{} +} + +/* +V1NetworkAddressGroupsIDPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsIDPutBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id put bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id put bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id put bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id put bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups Id put bad request response +func (o *V1NetworkAddressGroupsIDPutBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsIDPutBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDPutBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsIDPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDPutUnauthorized creates a V1NetworkAddressGroupsIDPutUnauthorized with default headers values +func NewV1NetworkAddressGroupsIDPutUnauthorized() *V1NetworkAddressGroupsIDPutUnauthorized { + return &V1NetworkAddressGroupsIDPutUnauthorized{} +} + +/* +V1NetworkAddressGroupsIDPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsIDPutUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id put unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id put unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id put unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id put unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups Id put unauthorized response +func (o *V1NetworkAddressGroupsIDPutUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsIDPutUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDPutUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsIDPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDPutForbidden creates a V1NetworkAddressGroupsIDPutForbidden with default headers values +func NewV1NetworkAddressGroupsIDPutForbidden() *V1NetworkAddressGroupsIDPutForbidden { + return &V1NetworkAddressGroupsIDPutForbidden{} +} + +/* +V1NetworkAddressGroupsIDPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsIDPutForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id put forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id put forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id put forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id put forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups Id put forbidden response +func (o *V1NetworkAddressGroupsIDPutForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsIDPutForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDPutForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsIDPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDPutNotFound creates a V1NetworkAddressGroupsIDPutNotFound with default headers values +func NewV1NetworkAddressGroupsIDPutNotFound() *V1NetworkAddressGroupsIDPutNotFound { + return &V1NetworkAddressGroupsIDPutNotFound{} +} + +/* +V1NetworkAddressGroupsIDPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsIDPutNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id put not found response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id put not found response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put not found response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups Id put not found response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups Id put not found response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups Id put not found response +func (o *V1NetworkAddressGroupsIDPutNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsIDPutNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDPutNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsIDPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsIDPutInternalServerError creates a V1NetworkAddressGroupsIDPutInternalServerError with default headers values +func NewV1NetworkAddressGroupsIDPutInternalServerError() *V1NetworkAddressGroupsIDPutInternalServerError { + return &V1NetworkAddressGroupsIDPutInternalServerError{} +} + +/* +V1NetworkAddressGroupsIDPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsIDPutInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups Id put internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsIDPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups Id put internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsIDPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups Id put internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsIDPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups Id put internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsIDPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups Id put internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsIDPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups Id put internal server error response +func (o *V1NetworkAddressGroupsIDPutInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsIDPutInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDPutInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-address-groups/{network_address_group_id}][%d] v1NetworkAddressGroupsIdPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsIDPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsIDPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_members_delete_parameters.go b/power/client/network_address_groups/v1_network_address_groups_members_delete_parameters.go new file mode 100644 index 00000000..9351b40f --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_members_delete_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworkAddressGroupsMembersDeleteParams creates a new V1NetworkAddressGroupsMembersDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkAddressGroupsMembersDeleteParams() *V1NetworkAddressGroupsMembersDeleteParams { + return &V1NetworkAddressGroupsMembersDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsMembersDeleteParamsWithTimeout creates a new V1NetworkAddressGroupsMembersDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsMembersDeleteParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsMembersDeleteParams { + return &V1NetworkAddressGroupsMembersDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsMembersDeleteParamsWithContext creates a new V1NetworkAddressGroupsMembersDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsMembersDeleteParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsMembersDeleteParams { + return &V1NetworkAddressGroupsMembersDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsMembersDeleteParamsWithHTTPClient creates a new V1NetworkAddressGroupsMembersDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsMembersDeleteParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsMembersDeleteParams { + return &V1NetworkAddressGroupsMembersDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsMembersDeleteParams contains all the parameters to send to the API endpoint + + for the v1 network address groups members delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsMembersDeleteParams struct { + + /* NetworkAddressGroupID. + + Network Address Group ID + */ + NetworkAddressGroupID string + + /* NetworkAddressGroupMemberID. + + The Network Address Group Member ID + */ + NetworkAddressGroupMemberID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithDefaults() *V1NetworkAddressGroupsMembersDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsMembersDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsMembersDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsMembersDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkAddressGroupID adds the networkAddressGroupID to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithNetworkAddressGroupID(networkAddressGroupID string) *V1NetworkAddressGroupsMembersDeleteParams { + o.SetNetworkAddressGroupID(networkAddressGroupID) + return o +} + +// SetNetworkAddressGroupID adds the networkAddressGroupId to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetNetworkAddressGroupID(networkAddressGroupID string) { + o.NetworkAddressGroupID = networkAddressGroupID +} + +// WithNetworkAddressGroupMemberID adds the networkAddressGroupMemberID to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) WithNetworkAddressGroupMemberID(networkAddressGroupMemberID string) *V1NetworkAddressGroupsMembersDeleteParams { + o.SetNetworkAddressGroupMemberID(networkAddressGroupMemberID) + return o +} + +// SetNetworkAddressGroupMemberID adds the networkAddressGroupMemberId to the v1 network address groups members delete params +func (o *V1NetworkAddressGroupsMembersDeleteParams) SetNetworkAddressGroupMemberID(networkAddressGroupMemberID string) { + o.NetworkAddressGroupMemberID = networkAddressGroupMemberID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsMembersDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_address_group_id + if err := r.SetPathParam("network_address_group_id", o.NetworkAddressGroupID); err != nil { + return err + } + + // path param network_address_group_member_id + if err := r.SetPathParam("network_address_group_member_id", o.NetworkAddressGroupMemberID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go b/power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go new file mode 100644 index 00000000..6105c1f6 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_members_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkAddressGroupsMembersDeleteReader is a Reader for the V1NetworkAddressGroupsMembersDelete structure. +type V1NetworkAddressGroupsMembersDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsMembersDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsMembersDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsMembersDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsMembersDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsMembersDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsMembersDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkAddressGroupsMembersDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsMembersDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}] v1.networkAddressGroups.members.delete", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsMembersDeleteOK creates a V1NetworkAddressGroupsMembersDeleteOK with default headers values +func NewV1NetworkAddressGroupsMembersDeleteOK() *V1NetworkAddressGroupsMembersDeleteOK { + return &V1NetworkAddressGroupsMembersDeleteOK{} +} + +/* +V1NetworkAddressGroupsMembersDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsMembersDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network address groups members delete o k response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups members delete o k response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete o k response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups members delete o k response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete o k response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups members delete o k response +func (o *V1NetworkAddressGroupsMembersDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsMembersDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersDeleteBadRequest creates a V1NetworkAddressGroupsMembersDeleteBadRequest with default headers values +func NewV1NetworkAddressGroupsMembersDeleteBadRequest() *V1NetworkAddressGroupsMembersDeleteBadRequest { + return &V1NetworkAddressGroupsMembersDeleteBadRequest{} +} + +/* +V1NetworkAddressGroupsMembersDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsMembersDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members delete bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups members delete bad request response +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersDeleteUnauthorized creates a V1NetworkAddressGroupsMembersDeleteUnauthorized with default headers values +func NewV1NetworkAddressGroupsMembersDeleteUnauthorized() *V1NetworkAddressGroupsMembersDeleteUnauthorized { + return &V1NetworkAddressGroupsMembersDeleteUnauthorized{} +} + +/* +V1NetworkAddressGroupsMembersDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsMembersDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members delete unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups members delete unauthorized response +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersDeleteForbidden creates a V1NetworkAddressGroupsMembersDeleteForbidden with default headers values +func NewV1NetworkAddressGroupsMembersDeleteForbidden() *V1NetworkAddressGroupsMembersDeleteForbidden { + return &V1NetworkAddressGroupsMembersDeleteForbidden{} +} + +/* +V1NetworkAddressGroupsMembersDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsMembersDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members delete forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups members delete forbidden response +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersDeleteNotFound creates a V1NetworkAddressGroupsMembersDeleteNotFound with default headers values +func NewV1NetworkAddressGroupsMembersDeleteNotFound() *V1NetworkAddressGroupsMembersDeleteNotFound { + return &V1NetworkAddressGroupsMembersDeleteNotFound{} +} + +/* +V1NetworkAddressGroupsMembersDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsMembersDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete not found response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete not found response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete not found response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members delete not found response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete not found response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups members delete not found response +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersDeleteConflict creates a V1NetworkAddressGroupsMembersDeleteConflict with default headers values +func NewV1NetworkAddressGroupsMembersDeleteConflict() *V1NetworkAddressGroupsMembersDeleteConflict { + return &V1NetworkAddressGroupsMembersDeleteConflict{} +} + +/* +V1NetworkAddressGroupsMembersDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkAddressGroupsMembersDeleteConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete conflict response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete conflict response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete conflict response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members delete conflict response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members delete conflict response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network address groups members delete conflict response +func (o *V1NetworkAddressGroupsMembersDeleteConflict) Code() int { + return 409 +} + +func (o *V1NetworkAddressGroupsMembersDeleteConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersDeleteInternalServerError creates a V1NetworkAddressGroupsMembersDeleteInternalServerError with default headers values +func NewV1NetworkAddressGroupsMembersDeleteInternalServerError() *V1NetworkAddressGroupsMembersDeleteInternalServerError { + return &V1NetworkAddressGroupsMembersDeleteInternalServerError{} +} + +/* +V1NetworkAddressGroupsMembersDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsMembersDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members delete internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members delete internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members delete internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups members delete internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups members delete internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups members delete internal server error response +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-address-groups/{network_address_group_id}/members/{network_address_group_member_id}][%d] v1NetworkAddressGroupsMembersDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_members_post_parameters.go b/power/client/network_address_groups/v1_network_address_groups_members_post_parameters.go new file mode 100644 index 00000000..b178cd0f --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_members_post_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewV1NetworkAddressGroupsMembersPostParams creates a new V1NetworkAddressGroupsMembersPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkAddressGroupsMembersPostParams() *V1NetworkAddressGroupsMembersPostParams { + return &V1NetworkAddressGroupsMembersPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsMembersPostParamsWithTimeout creates a new V1NetworkAddressGroupsMembersPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsMembersPostParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsMembersPostParams { + return &V1NetworkAddressGroupsMembersPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsMembersPostParamsWithContext creates a new V1NetworkAddressGroupsMembersPostParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsMembersPostParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsMembersPostParams { + return &V1NetworkAddressGroupsMembersPostParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsMembersPostParamsWithHTTPClient creates a new V1NetworkAddressGroupsMembersPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsMembersPostParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsMembersPostParams { + return &V1NetworkAddressGroupsMembersPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsMembersPostParams contains all the parameters to send to the API endpoint + + for the v1 network address groups members post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsMembersPostParams struct { + + /* Body. + + Parameters for adding a member to a Network Address Group + */ + Body *models.NetworkAddressGroupAddMember + + /* NetworkAddressGroupID. + + Network Address Group ID + */ + NetworkAddressGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsMembersPostParams) WithDefaults() *V1NetworkAddressGroupsMembersPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsMembersPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsMembersPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsMembersPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsMembersPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) WithBody(body *models.NetworkAddressGroupAddMember) *V1NetworkAddressGroupsMembersPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) SetBody(body *models.NetworkAddressGroupAddMember) { + o.Body = body +} + +// WithNetworkAddressGroupID adds the networkAddressGroupID to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) WithNetworkAddressGroupID(networkAddressGroupID string) *V1NetworkAddressGroupsMembersPostParams { + o.SetNetworkAddressGroupID(networkAddressGroupID) + return o +} + +// SetNetworkAddressGroupID adds the networkAddressGroupId to the v1 network address groups members post params +func (o *V1NetworkAddressGroupsMembersPostParams) SetNetworkAddressGroupID(networkAddressGroupID string) { + o.NetworkAddressGroupID = networkAddressGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsMembersPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_address_group_id + if err := r.SetPathParam("network_address_group_id", o.NetworkAddressGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_members_post_responses.go b/power/client/network_address_groups/v1_network_address_groups_members_post_responses.go new file mode 100644 index 00000000..ea8d2ce3 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_members_post_responses.go @@ -0,0 +1,638 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkAddressGroupsMembersPostReader is a Reader for the V1NetworkAddressGroupsMembersPost structure. +type V1NetworkAddressGroupsMembersPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsMembersPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsMembersPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsMembersPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsMembersPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsMembersPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsMembersPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkAddressGroupsMembersPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworkAddressGroupsMembersPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsMembersPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-address-groups/{network_address_group_id}/members] v1.networkAddressGroups.members.post", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsMembersPostOK creates a V1NetworkAddressGroupsMembersPostOK with default headers values +func NewV1NetworkAddressGroupsMembersPostOK() *V1NetworkAddressGroupsMembersPostOK { + return &V1NetworkAddressGroupsMembersPostOK{} +} + +/* +V1NetworkAddressGroupsMembersPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsMembersPostOK struct { + Payload *models.NetworkAddressGroupMember +} + +// IsSuccess returns true when this v1 network address groups members post o k response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups members post o k response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post o k response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups members post o k response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post o k response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups members post o k response +func (o *V1NetworkAddressGroupsMembersPostOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsMembersPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostOK) GetPayload() *models.NetworkAddressGroupMember { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroupMember) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersPostBadRequest creates a V1NetworkAddressGroupsMembersPostBadRequest with default headers values +func NewV1NetworkAddressGroupsMembersPostBadRequest() *V1NetworkAddressGroupsMembersPostBadRequest { + return &V1NetworkAddressGroupsMembersPostBadRequest{} +} + +/* +V1NetworkAddressGroupsMembersPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsMembersPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups members post bad request response +func (o *V1NetworkAddressGroupsMembersPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsMembersPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersPostUnauthorized creates a V1NetworkAddressGroupsMembersPostUnauthorized with default headers values +func NewV1NetworkAddressGroupsMembersPostUnauthorized() *V1NetworkAddressGroupsMembersPostUnauthorized { + return &V1NetworkAddressGroupsMembersPostUnauthorized{} +} + +/* +V1NetworkAddressGroupsMembersPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsMembersPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups members post unauthorized response +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersPostForbidden creates a V1NetworkAddressGroupsMembersPostForbidden with default headers values +func NewV1NetworkAddressGroupsMembersPostForbidden() *V1NetworkAddressGroupsMembersPostForbidden { + return &V1NetworkAddressGroupsMembersPostForbidden{} +} + +/* +V1NetworkAddressGroupsMembersPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsMembersPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups members post forbidden response +func (o *V1NetworkAddressGroupsMembersPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsMembersPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersPostNotFound creates a V1NetworkAddressGroupsMembersPostNotFound with default headers values +func NewV1NetworkAddressGroupsMembersPostNotFound() *V1NetworkAddressGroupsMembersPostNotFound { + return &V1NetworkAddressGroupsMembersPostNotFound{} +} + +/* +V1NetworkAddressGroupsMembersPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsMembersPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post not found response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post not found response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post not found response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post not found response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post not found response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups members post not found response +func (o *V1NetworkAddressGroupsMembersPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsMembersPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersPostConflict creates a V1NetworkAddressGroupsMembersPostConflict with default headers values +func NewV1NetworkAddressGroupsMembersPostConflict() *V1NetworkAddressGroupsMembersPostConflict { + return &V1NetworkAddressGroupsMembersPostConflict{} +} + +/* +V1NetworkAddressGroupsMembersPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkAddressGroupsMembersPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post conflict response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post conflict response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post conflict response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post conflict response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post conflict response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network address groups members post conflict response +func (o *V1NetworkAddressGroupsMembersPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkAddressGroupsMembersPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersPostUnprocessableEntity creates a V1NetworkAddressGroupsMembersPostUnprocessableEntity with default headers values +func NewV1NetworkAddressGroupsMembersPostUnprocessableEntity() *V1NetworkAddressGroupsMembersPostUnprocessableEntity { + return &V1NetworkAddressGroupsMembersPostUnprocessableEntity{} +} + +/* +V1NetworkAddressGroupsMembersPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworkAddressGroupsMembersPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post unprocessable entity response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post unprocessable entity response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post unprocessable entity response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups members post unprocessable entity response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups members post unprocessable entity response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 network address groups members post unprocessable entity response +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsMembersPostInternalServerError creates a V1NetworkAddressGroupsMembersPostInternalServerError with default headers values +func NewV1NetworkAddressGroupsMembersPostInternalServerError() *V1NetworkAddressGroupsMembersPostInternalServerError { + return &V1NetworkAddressGroupsMembersPostInternalServerError{} +} + +/* +V1NetworkAddressGroupsMembersPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsMembersPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups members post internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups members post internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups members post internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups members post internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups members post internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups members post internal server error response +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups/{network_address_group_id}/members][%d] v1NetworkAddressGroupsMembersPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsMembersPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_post_parameters.go b/power/client/network_address_groups/v1_network_address_groups_post_parameters.go new file mode 100644 index 00000000..508919b2 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_post_parameters.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewV1NetworkAddressGroupsPostParams creates a new V1NetworkAddressGroupsPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkAddressGroupsPostParams() *V1NetworkAddressGroupsPostParams { + return &V1NetworkAddressGroupsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkAddressGroupsPostParamsWithTimeout creates a new V1NetworkAddressGroupsPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkAddressGroupsPostParamsWithTimeout(timeout time.Duration) *V1NetworkAddressGroupsPostParams { + return &V1NetworkAddressGroupsPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkAddressGroupsPostParamsWithContext creates a new V1NetworkAddressGroupsPostParams object +// with the ability to set a context for a request. +func NewV1NetworkAddressGroupsPostParamsWithContext(ctx context.Context) *V1NetworkAddressGroupsPostParams { + return &V1NetworkAddressGroupsPostParams{ + Context: ctx, + } +} + +// NewV1NetworkAddressGroupsPostParamsWithHTTPClient creates a new V1NetworkAddressGroupsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkAddressGroupsPostParamsWithHTTPClient(client *http.Client) *V1NetworkAddressGroupsPostParams { + return &V1NetworkAddressGroupsPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkAddressGroupsPostParams contains all the parameters to send to the API endpoint + + for the v1 network address groups post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkAddressGroupsPostParams struct { + + /* Body. + + Parameters for the creation of a Network Address Group + */ + Body *models.NetworkAddressGroupCreate + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network address groups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsPostParams) WithDefaults() *V1NetworkAddressGroupsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network address groups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkAddressGroupsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) WithTimeout(timeout time.Duration) *V1NetworkAddressGroupsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) WithContext(ctx context.Context) *V1NetworkAddressGroupsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) WithHTTPClient(client *http.Client) *V1NetworkAddressGroupsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) WithBody(body *models.NetworkAddressGroupCreate) *V1NetworkAddressGroupsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network address groups post params +func (o *V1NetworkAddressGroupsPostParams) SetBody(body *models.NetworkAddressGroupCreate) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkAddressGroupsPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_address_groups/v1_network_address_groups_post_responses.go b/power/client/network_address_groups/v1_network_address_groups_post_responses.go new file mode 100644 index 00000000..2a7b9597 --- /dev/null +++ b/power/client/network_address_groups/v1_network_address_groups_post_responses.go @@ -0,0 +1,714 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_address_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkAddressGroupsPostReader is a Reader for the V1NetworkAddressGroupsPost structure. +type V1NetworkAddressGroupsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkAddressGroupsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkAddressGroupsPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewV1NetworkAddressGroupsPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkAddressGroupsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkAddressGroupsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkAddressGroupsPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkAddressGroupsPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkAddressGroupsPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworkAddressGroupsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkAddressGroupsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-address-groups] v1.networkAddressGroups.post", response, response.Code()) + } +} + +// NewV1NetworkAddressGroupsPostOK creates a V1NetworkAddressGroupsPostOK with default headers values +func NewV1NetworkAddressGroupsPostOK() *V1NetworkAddressGroupsPostOK { + return &V1NetworkAddressGroupsPostOK{} +} + +/* +V1NetworkAddressGroupsPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkAddressGroupsPostOK struct { + Payload *models.NetworkAddressGroup +} + +// IsSuccess returns true when this v1 network address groups post o k response has a 2xx status code +func (o *V1NetworkAddressGroupsPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups post o k response has a 3xx status code +func (o *V1NetworkAddressGroupsPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post o k response has a 4xx status code +func (o *V1NetworkAddressGroupsPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups post o k response has a 5xx status code +func (o *V1NetworkAddressGroupsPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post o k response a status code equal to that given +func (o *V1NetworkAddressGroupsPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network address groups post o k response +func (o *V1NetworkAddressGroupsPostOK) Code() int { + return 200 +} + +func (o *V1NetworkAddressGroupsPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostOK %s", 200, payload) +} + +func (o *V1NetworkAddressGroupsPostOK) GetPayload() *models.NetworkAddressGroup { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsPostCreated creates a V1NetworkAddressGroupsPostCreated with default headers values +func NewV1NetworkAddressGroupsPostCreated() *V1NetworkAddressGroupsPostCreated { + return &V1NetworkAddressGroupsPostCreated{} +} + +/* +V1NetworkAddressGroupsPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type V1NetworkAddressGroupsPostCreated struct { + Payload *models.NetworkAddressGroup +} + +// IsSuccess returns true when this v1 network address groups post created response has a 2xx status code +func (o *V1NetworkAddressGroupsPostCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network address groups post created response has a 3xx status code +func (o *V1NetworkAddressGroupsPostCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post created response has a 4xx status code +func (o *V1NetworkAddressGroupsPostCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups post created response has a 5xx status code +func (o *V1NetworkAddressGroupsPostCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post created response a status code equal to that given +func (o *V1NetworkAddressGroupsPostCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the v1 network address groups post created response +func (o *V1NetworkAddressGroupsPostCreated) Code() int { + return 201 +} + +func (o *V1NetworkAddressGroupsPostCreated) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostCreated %s", 201, payload) +} + +func (o *V1NetworkAddressGroupsPostCreated) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostCreated %s", 201, payload) +} + +func (o *V1NetworkAddressGroupsPostCreated) GetPayload() *models.NetworkAddressGroup { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkAddressGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsPostBadRequest creates a V1NetworkAddressGroupsPostBadRequest with default headers values +func NewV1NetworkAddressGroupsPostBadRequest() *V1NetworkAddressGroupsPostBadRequest { + return &V1NetworkAddressGroupsPostBadRequest{} +} + +/* +V1NetworkAddressGroupsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkAddressGroupsPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post bad request response has a 2xx status code +func (o *V1NetworkAddressGroupsPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post bad request response has a 3xx status code +func (o *V1NetworkAddressGroupsPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post bad request response has a 4xx status code +func (o *V1NetworkAddressGroupsPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post bad request response has a 5xx status code +func (o *V1NetworkAddressGroupsPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post bad request response a status code equal to that given +func (o *V1NetworkAddressGroupsPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network address groups post bad request response +func (o *V1NetworkAddressGroupsPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkAddressGroupsPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkAddressGroupsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsPostUnauthorized creates a V1NetworkAddressGroupsPostUnauthorized with default headers values +func NewV1NetworkAddressGroupsPostUnauthorized() *V1NetworkAddressGroupsPostUnauthorized { + return &V1NetworkAddressGroupsPostUnauthorized{} +} + +/* +V1NetworkAddressGroupsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkAddressGroupsPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post unauthorized response has a 2xx status code +func (o *V1NetworkAddressGroupsPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post unauthorized response has a 3xx status code +func (o *V1NetworkAddressGroupsPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post unauthorized response has a 4xx status code +func (o *V1NetworkAddressGroupsPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post unauthorized response has a 5xx status code +func (o *V1NetworkAddressGroupsPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post unauthorized response a status code equal to that given +func (o *V1NetworkAddressGroupsPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network address groups post unauthorized response +func (o *V1NetworkAddressGroupsPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkAddressGroupsPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkAddressGroupsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsPostForbidden creates a V1NetworkAddressGroupsPostForbidden with default headers values +func NewV1NetworkAddressGroupsPostForbidden() *V1NetworkAddressGroupsPostForbidden { + return &V1NetworkAddressGroupsPostForbidden{} +} + +/* +V1NetworkAddressGroupsPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkAddressGroupsPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post forbidden response has a 2xx status code +func (o *V1NetworkAddressGroupsPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post forbidden response has a 3xx status code +func (o *V1NetworkAddressGroupsPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post forbidden response has a 4xx status code +func (o *V1NetworkAddressGroupsPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post forbidden response has a 5xx status code +func (o *V1NetworkAddressGroupsPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post forbidden response a status code equal to that given +func (o *V1NetworkAddressGroupsPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network address groups post forbidden response +func (o *V1NetworkAddressGroupsPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkAddressGroupsPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostForbidden %s", 403, payload) +} + +func (o *V1NetworkAddressGroupsPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsPostNotFound creates a V1NetworkAddressGroupsPostNotFound with default headers values +func NewV1NetworkAddressGroupsPostNotFound() *V1NetworkAddressGroupsPostNotFound { + return &V1NetworkAddressGroupsPostNotFound{} +} + +/* +V1NetworkAddressGroupsPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkAddressGroupsPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post not found response has a 2xx status code +func (o *V1NetworkAddressGroupsPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post not found response has a 3xx status code +func (o *V1NetworkAddressGroupsPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post not found response has a 4xx status code +func (o *V1NetworkAddressGroupsPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post not found response has a 5xx status code +func (o *V1NetworkAddressGroupsPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post not found response a status code equal to that given +func (o *V1NetworkAddressGroupsPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network address groups post not found response +func (o *V1NetworkAddressGroupsPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkAddressGroupsPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostNotFound %s", 404, payload) +} + +func (o *V1NetworkAddressGroupsPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsPostConflict creates a V1NetworkAddressGroupsPostConflict with default headers values +func NewV1NetworkAddressGroupsPostConflict() *V1NetworkAddressGroupsPostConflict { + return &V1NetworkAddressGroupsPostConflict{} +} + +/* +V1NetworkAddressGroupsPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkAddressGroupsPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post conflict response has a 2xx status code +func (o *V1NetworkAddressGroupsPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post conflict response has a 3xx status code +func (o *V1NetworkAddressGroupsPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post conflict response has a 4xx status code +func (o *V1NetworkAddressGroupsPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post conflict response has a 5xx status code +func (o *V1NetworkAddressGroupsPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post conflict response a status code equal to that given +func (o *V1NetworkAddressGroupsPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network address groups post conflict response +func (o *V1NetworkAddressGroupsPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkAddressGroupsPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostConflict %s", 409, payload) +} + +func (o *V1NetworkAddressGroupsPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsPostUnprocessableEntity creates a V1NetworkAddressGroupsPostUnprocessableEntity with default headers values +func NewV1NetworkAddressGroupsPostUnprocessableEntity() *V1NetworkAddressGroupsPostUnprocessableEntity { + return &V1NetworkAddressGroupsPostUnprocessableEntity{} +} + +/* +V1NetworkAddressGroupsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworkAddressGroupsPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post unprocessable entity response has a 2xx status code +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post unprocessable entity response has a 3xx status code +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post unprocessable entity response has a 4xx status code +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network address groups post unprocessable entity response has a 5xx status code +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network address groups post unprocessable entity response a status code equal to that given +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 network address groups post unprocessable entity response +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkAddressGroupsPostInternalServerError creates a V1NetworkAddressGroupsPostInternalServerError with default headers values +func NewV1NetworkAddressGroupsPostInternalServerError() *V1NetworkAddressGroupsPostInternalServerError { + return &V1NetworkAddressGroupsPostInternalServerError{} +} + +/* +V1NetworkAddressGroupsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkAddressGroupsPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network address groups post internal server error response has a 2xx status code +func (o *V1NetworkAddressGroupsPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network address groups post internal server error response has a 3xx status code +func (o *V1NetworkAddressGroupsPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network address groups post internal server error response has a 4xx status code +func (o *V1NetworkAddressGroupsPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network address groups post internal server error response has a 5xx status code +func (o *V1NetworkAddressGroupsPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network address groups post internal server error response a status code equal to that given +func (o *V1NetworkAddressGroupsPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network address groups post internal server error response +func (o *V1NetworkAddressGroupsPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkAddressGroupsPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-address-groups][%d] v1NetworkAddressGroupsPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkAddressGroupsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkAddressGroupsPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_security_groups/network_security_groups_client.go b/power/client/network_security_groups/network_security_groups_client.go new file mode 100644 index 00000000..6822d35e --- /dev/null +++ b/power/client/network_security_groups/network_security_groups_client.go @@ -0,0 +1,477 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new network security groups API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new network security groups API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new network security groups API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for network security groups API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + V1NetworkSecurityGroupsActionPost(params *V1NetworkSecurityGroupsActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsActionPostOK, *V1NetworkSecurityGroupsActionPostAccepted, error) + + V1NetworkSecurityGroupsIDDelete(params *V1NetworkSecurityGroupsIDDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDDeleteOK, error) + + V1NetworkSecurityGroupsIDGet(params *V1NetworkSecurityGroupsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDGetOK, error) + + V1NetworkSecurityGroupsIDPut(params *V1NetworkSecurityGroupsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDPutOK, error) + + V1NetworkSecurityGroupsList(params *V1NetworkSecurityGroupsListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsListOK, error) + + V1NetworkSecurityGroupsMembersDelete(params *V1NetworkSecurityGroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsMembersDeleteOK, error) + + V1NetworkSecurityGroupsMembersPost(params *V1NetworkSecurityGroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsMembersPostOK, error) + + V1NetworkSecurityGroupsPost(params *V1NetworkSecurityGroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsPostOK, *V1NetworkSecurityGroupsPostCreated, error) + + V1NetworkSecurityGroupsRulesDelete(params *V1NetworkSecurityGroupsRulesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsRulesDeleteOK, error) + + V1NetworkSecurityGroupsRulesPost(params *V1NetworkSecurityGroupsRulesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsRulesPostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +V1NetworkSecurityGroupsActionPost performs a network security groups action enable disable on a workspace on enablement a default network security group is created to allow all traffic for all active network iterfaces +*/ +func (a *Client) V1NetworkSecurityGroupsActionPost(params *V1NetworkSecurityGroupsActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsActionPostOK, *V1NetworkSecurityGroupsActionPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsActionPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.action.post", + Method: "POST", + PathPattern: "/v1/network-security-groups/action", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsActionPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *V1NetworkSecurityGroupsActionPostOK: + return value, nil, nil + case *V1NetworkSecurityGroupsActionPostAccepted: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for network_security_groups: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsIDDelete deletes a network security group from a workspace +*/ +func (a *Client) V1NetworkSecurityGroupsIDDelete(params *V1NetworkSecurityGroupsIDDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsIDDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.id.delete", + Method: "DELETE", + PathPattern: "/v1/network-security-groups/{network_security_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsIDDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkSecurityGroupsIDDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkSecurityGroups.id.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsIDGet gets the detail of a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsIDGet(params *V1NetworkSecurityGroupsIDGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsIDGetParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.id.get", + Method: "GET", + PathPattern: "/v1/network-security-groups/{network_security_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsIDGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkSecurityGroupsIDGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkSecurityGroups.id.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsIDPut updates a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsIDPut(params *V1NetworkSecurityGroupsIDPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsIDPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsIDPutParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.id.put", + Method: "PUT", + PathPattern: "/v1/network-security-groups/{network_security_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsIDPutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkSecurityGroupsIDPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkSecurityGroups.id.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsList gets the list of network security groups for a workspace +*/ +func (a *Client) V1NetworkSecurityGroupsList(params *V1NetworkSecurityGroupsListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsListParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.list", + Method: "GET", + PathPattern: "/v1/network-security-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkSecurityGroupsListOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkSecurityGroups.list: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsMembersDelete deletes the member from a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsMembersDelete(params *V1NetworkSecurityGroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsMembersDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsMembersDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.members.delete", + Method: "DELETE", + PathPattern: "/v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsMembersDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkSecurityGroupsMembersDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkSecurityGroups.members.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsMembersPost adds a member to a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsMembersPost(params *V1NetworkSecurityGroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsMembersPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsMembersPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.members.post", + Method: "POST", + PathPattern: "/v1/network-security-groups/{network_security_group_id}/members", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsMembersPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkSecurityGroupsMembersPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkSecurityGroups.members.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsPost creates a new network security group +*/ +func (a *Client) V1NetworkSecurityGroupsPost(params *V1NetworkSecurityGroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsPostOK, *V1NetworkSecurityGroupsPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.post", + Method: "POST", + PathPattern: "/v1/network-security-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, nil, err + } + switch value := result.(type) { + case *V1NetworkSecurityGroupsPostOK: + return value, nil, nil + case *V1NetworkSecurityGroupsPostCreated: + return nil, value, nil + } + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for network_security_groups: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsRulesDelete deletes the rule from a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsRulesDelete(params *V1NetworkSecurityGroupsRulesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsRulesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsRulesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.rules.delete", + Method: "DELETE", + PathPattern: "/v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsRulesDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkSecurityGroupsRulesDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkSecurityGroups.rules.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +V1NetworkSecurityGroupsRulesPost adds a rule to a network security group +*/ +func (a *Client) V1NetworkSecurityGroupsRulesPost(params *V1NetworkSecurityGroupsRulesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*V1NetworkSecurityGroupsRulesPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewV1NetworkSecurityGroupsRulesPostParams() + } + op := &runtime.ClientOperation{ + ID: "v1.networkSecurityGroups.rules.post", + Method: "POST", + PathPattern: "/v1/network-security-groups/{network_security_group_id}/rules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &V1NetworkSecurityGroupsRulesPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*V1NetworkSecurityGroupsRulesPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for v1.networkSecurityGroups.rules.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/power/client/network_security_groups/v1_network_security_groups_action_post_parameters.go b/power/client/network_security_groups/v1_network_security_groups_action_post_parameters.go new file mode 100644 index 00000000..7481ad9c --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_action_post_parameters.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewV1NetworkSecurityGroupsActionPostParams creates a new V1NetworkSecurityGroupsActionPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkSecurityGroupsActionPostParams() *V1NetworkSecurityGroupsActionPostParams { + return &V1NetworkSecurityGroupsActionPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsActionPostParamsWithTimeout creates a new V1NetworkSecurityGroupsActionPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsActionPostParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsActionPostParams { + return &V1NetworkSecurityGroupsActionPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsActionPostParamsWithContext creates a new V1NetworkSecurityGroupsActionPostParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsActionPostParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsActionPostParams { + return &V1NetworkSecurityGroupsActionPostParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsActionPostParamsWithHTTPClient creates a new V1NetworkSecurityGroupsActionPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsActionPostParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsActionPostParams { + return &V1NetworkSecurityGroupsActionPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsActionPostParams contains all the parameters to send to the API endpoint + + for the v1 network security groups action post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsActionPostParams struct { + + /* Body. + + Parameters for the desired action + */ + Body *models.NetworkSecurityGroupsAction + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsActionPostParams) WithDefaults() *V1NetworkSecurityGroupsActionPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsActionPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsActionPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsActionPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsActionPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) WithBody(body *models.NetworkSecurityGroupsAction) *V1NetworkSecurityGroupsActionPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network security groups action post params +func (o *V1NetworkSecurityGroupsActionPostParams) SetBody(body *models.NetworkSecurityGroupsAction) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsActionPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_action_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_action_post_responses.go new file mode 100644 index 00000000..b1536f9f --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_action_post_responses.go @@ -0,0 +1,710 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkSecurityGroupsActionPostReader is a Reader for the V1NetworkSecurityGroupsActionPost structure. +type V1NetworkSecurityGroupsActionPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsActionPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsActionPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewV1NetworkSecurityGroupsActionPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsActionPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsActionPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsActionPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsActionPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsActionPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsActionPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 550: + result := NewV1NetworkSecurityGroupsActionPostStatus550() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-security-groups/action] v1.networkSecurityGroups.action.post", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsActionPostOK creates a V1NetworkSecurityGroupsActionPostOK with default headers values +func NewV1NetworkSecurityGroupsActionPostOK() *V1NetworkSecurityGroupsActionPostOK { + return &V1NetworkSecurityGroupsActionPostOK{} +} + +/* +V1NetworkSecurityGroupsActionPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsActionPostOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network security groups action post o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups action post o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups action post o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups action post o k response +func (o *V1NetworkSecurityGroupsActionPostOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsActionPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsActionPostAccepted creates a V1NetworkSecurityGroupsActionPostAccepted with default headers values +func NewV1NetworkSecurityGroupsActionPostAccepted() *V1NetworkSecurityGroupsActionPostAccepted { + return &V1NetworkSecurityGroupsActionPostAccepted{} +} + +/* +V1NetworkSecurityGroupsActionPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type V1NetworkSecurityGroupsActionPostAccepted struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network security groups action post accepted response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups action post accepted response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post accepted response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups action post accepted response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post accepted response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the v1 network security groups action post accepted response +func (o *V1NetworkSecurityGroupsActionPostAccepted) Code() int { + return 202 +} + +func (o *V1NetworkSecurityGroupsActionPostAccepted) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostAccepted %s", 202, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostAccepted) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostAccepted %s", 202, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostAccepted) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsActionPostBadRequest creates a V1NetworkSecurityGroupsActionPostBadRequest with default headers values +func NewV1NetworkSecurityGroupsActionPostBadRequest() *V1NetworkSecurityGroupsActionPostBadRequest { + return &V1NetworkSecurityGroupsActionPostBadRequest{} +} + +/* +V1NetworkSecurityGroupsActionPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsActionPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups action post bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups action post bad request response +func (o *V1NetworkSecurityGroupsActionPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsActionPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsActionPostUnauthorized creates a V1NetworkSecurityGroupsActionPostUnauthorized with default headers values +func NewV1NetworkSecurityGroupsActionPostUnauthorized() *V1NetworkSecurityGroupsActionPostUnauthorized { + return &V1NetworkSecurityGroupsActionPostUnauthorized{} +} + +/* +V1NetworkSecurityGroupsActionPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsActionPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups action post unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups action post unauthorized response +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsActionPostForbidden creates a V1NetworkSecurityGroupsActionPostForbidden with default headers values +func NewV1NetworkSecurityGroupsActionPostForbidden() *V1NetworkSecurityGroupsActionPostForbidden { + return &V1NetworkSecurityGroupsActionPostForbidden{} +} + +/* +V1NetworkSecurityGroupsActionPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsActionPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups action post forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups action post forbidden response +func (o *V1NetworkSecurityGroupsActionPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsActionPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsActionPostNotFound creates a V1NetworkSecurityGroupsActionPostNotFound with default headers values +func NewV1NetworkSecurityGroupsActionPostNotFound() *V1NetworkSecurityGroupsActionPostNotFound { + return &V1NetworkSecurityGroupsActionPostNotFound{} +} + +/* +V1NetworkSecurityGroupsActionPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsActionPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups action post not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups action post not found response +func (o *V1NetworkSecurityGroupsActionPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsActionPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsActionPostConflict creates a V1NetworkSecurityGroupsActionPostConflict with default headers values +func NewV1NetworkSecurityGroupsActionPostConflict() *V1NetworkSecurityGroupsActionPostConflict { + return &V1NetworkSecurityGroupsActionPostConflict{} +} + +/* +V1NetworkSecurityGroupsActionPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsActionPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups action post conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups action post conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups action post conflict response +func (o *V1NetworkSecurityGroupsActionPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsActionPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsActionPostInternalServerError creates a V1NetworkSecurityGroupsActionPostInternalServerError with default headers values +func NewV1NetworkSecurityGroupsActionPostInternalServerError() *V1NetworkSecurityGroupsActionPostInternalServerError { + return &V1NetworkSecurityGroupsActionPostInternalServerError{} +} + +/* +V1NetworkSecurityGroupsActionPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsActionPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups action post internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups action post internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups action post internal server error response +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsActionPostStatus550 creates a V1NetworkSecurityGroupsActionPostStatus550 with default headers values +func NewV1NetworkSecurityGroupsActionPostStatus550() *V1NetworkSecurityGroupsActionPostStatus550 { + return &V1NetworkSecurityGroupsActionPostStatus550{} +} + +/* +V1NetworkSecurityGroupsActionPostStatus550 describes a response with status code 550, with default header values. + +Workspace Status Error +*/ +type V1NetworkSecurityGroupsActionPostStatus550 struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups action post status550 response has a 2xx status code +func (o *V1NetworkSecurityGroupsActionPostStatus550) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups action post status550 response has a 3xx status code +func (o *V1NetworkSecurityGroupsActionPostStatus550) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups action post status550 response has a 4xx status code +func (o *V1NetworkSecurityGroupsActionPostStatus550) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups action post status550 response has a 5xx status code +func (o *V1NetworkSecurityGroupsActionPostStatus550) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups action post status550 response a status code equal to that given +func (o *V1NetworkSecurityGroupsActionPostStatus550) IsCode(code int) bool { + return code == 550 +} + +// Code gets the status code for the v1 network security groups action post status550 response +func (o *V1NetworkSecurityGroupsActionPostStatus550) Code() int { + return 550 +} + +func (o *V1NetworkSecurityGroupsActionPostStatus550) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostStatus550 %s", 550, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostStatus550) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/action][%d] v1NetworkSecurityGroupsActionPostStatus550 %s", 550, payload) +} + +func (o *V1NetworkSecurityGroupsActionPostStatus550) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsActionPostStatus550) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_id_delete_parameters.go b/power/client/network_security_groups/v1_network_security_groups_id_delete_parameters.go new file mode 100644 index 00000000..b0f6b1f8 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworkSecurityGroupsIDDeleteParams creates a new V1NetworkSecurityGroupsIDDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkSecurityGroupsIDDeleteParams() *V1NetworkSecurityGroupsIDDeleteParams { + return &V1NetworkSecurityGroupsIDDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsIDDeleteParamsWithTimeout creates a new V1NetworkSecurityGroupsIDDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsIDDeleteParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDDeleteParams { + return &V1NetworkSecurityGroupsIDDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsIDDeleteParamsWithContext creates a new V1NetworkSecurityGroupsIDDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsIDDeleteParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsIDDeleteParams { + return &V1NetworkSecurityGroupsIDDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsIDDeleteParamsWithHTTPClient creates a new V1NetworkSecurityGroupsIDDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsIDDeleteParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDDeleteParams { + return &V1NetworkSecurityGroupsIDDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsIDDeleteParams contains all the parameters to send to the API endpoint + + for the v1 network security groups id delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsIDDeleteParams struct { + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups id delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDDeleteParams) WithDefaults() *V1NetworkSecurityGroupsIDDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups id delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsIDDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsIDDeleteParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups id delete params +func (o *V1NetworkSecurityGroupsIDDeleteParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsIDDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_id_delete_responses.go b/power/client/network_security_groups/v1_network_security_groups_id_delete_responses.go new file mode 100644 index 00000000..dcffcfb4 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkSecurityGroupsIDDeleteReader is a Reader for the V1NetworkSecurityGroupsIDDelete structure. +type V1NetworkSecurityGroupsIDDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsIDDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsIDDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsIDDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsIDDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsIDDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsIDDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsIDDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsIDDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/network-security-groups/{network_security_group_id}] v1.networkSecurityGroups.id.delete", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsIDDeleteOK creates a V1NetworkSecurityGroupsIDDeleteOK with default headers values +func NewV1NetworkSecurityGroupsIDDeleteOK() *V1NetworkSecurityGroupsIDDeleteOK { + return &V1NetworkSecurityGroupsIDDeleteOK{} +} + +/* +V1NetworkSecurityGroupsIDDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsIDDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network security groups Id delete o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups Id delete o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id delete o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups Id delete o k response +func (o *V1NetworkSecurityGroupsIDDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsIDDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDDeleteBadRequest creates a V1NetworkSecurityGroupsIDDeleteBadRequest with default headers values +func NewV1NetworkSecurityGroupsIDDeleteBadRequest() *V1NetworkSecurityGroupsIDDeleteBadRequest { + return &V1NetworkSecurityGroupsIDDeleteBadRequest{} +} + +/* +V1NetworkSecurityGroupsIDDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsIDDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id delete bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups Id delete bad request response +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDDeleteUnauthorized creates a V1NetworkSecurityGroupsIDDeleteUnauthorized with default headers values +func NewV1NetworkSecurityGroupsIDDeleteUnauthorized() *V1NetworkSecurityGroupsIDDeleteUnauthorized { + return &V1NetworkSecurityGroupsIDDeleteUnauthorized{} +} + +/* +V1NetworkSecurityGroupsIDDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsIDDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id delete unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups Id delete unauthorized response +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDDeleteForbidden creates a V1NetworkSecurityGroupsIDDeleteForbidden with default headers values +func NewV1NetworkSecurityGroupsIDDeleteForbidden() *V1NetworkSecurityGroupsIDDeleteForbidden { + return &V1NetworkSecurityGroupsIDDeleteForbidden{} +} + +/* +V1NetworkSecurityGroupsIDDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsIDDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id delete forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups Id delete forbidden response +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDDeleteNotFound creates a V1NetworkSecurityGroupsIDDeleteNotFound with default headers values +func NewV1NetworkSecurityGroupsIDDeleteNotFound() *V1NetworkSecurityGroupsIDDeleteNotFound { + return &V1NetworkSecurityGroupsIDDeleteNotFound{} +} + +/* +V1NetworkSecurityGroupsIDDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsIDDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id delete not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups Id delete not found response +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDDeleteConflict creates a V1NetworkSecurityGroupsIDDeleteConflict with default headers values +func NewV1NetworkSecurityGroupsIDDeleteConflict() *V1NetworkSecurityGroupsIDDeleteConflict { + return &V1NetworkSecurityGroupsIDDeleteConflict{} +} + +/* +V1NetworkSecurityGroupsIDDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsIDDeleteConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id delete conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id delete conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups Id delete conflict response +func (o *V1NetworkSecurityGroupsIDDeleteConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsIDDeleteConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDDeleteInternalServerError creates a V1NetworkSecurityGroupsIDDeleteInternalServerError with default headers values +func NewV1NetworkSecurityGroupsIDDeleteInternalServerError() *V1NetworkSecurityGroupsIDDeleteInternalServerError { + return &V1NetworkSecurityGroupsIDDeleteInternalServerError{} +} + +/* +V1NetworkSecurityGroupsIDDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsIDDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id delete internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id delete internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id delete internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id delete internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups Id delete internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups Id delete internal server error response +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_id_get_parameters.go b/power/client/network_security_groups/v1_network_security_groups_id_get_parameters.go new file mode 100644 index 00000000..fe003a1a --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworkSecurityGroupsIDGetParams creates a new V1NetworkSecurityGroupsIDGetParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkSecurityGroupsIDGetParams() *V1NetworkSecurityGroupsIDGetParams { + return &V1NetworkSecurityGroupsIDGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsIDGetParamsWithTimeout creates a new V1NetworkSecurityGroupsIDGetParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsIDGetParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDGetParams { + return &V1NetworkSecurityGroupsIDGetParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsIDGetParamsWithContext creates a new V1NetworkSecurityGroupsIDGetParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsIDGetParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsIDGetParams { + return &V1NetworkSecurityGroupsIDGetParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsIDGetParamsWithHTTPClient creates a new V1NetworkSecurityGroupsIDGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsIDGetParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDGetParams { + return &V1NetworkSecurityGroupsIDGetParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsIDGetParams contains all the parameters to send to the API endpoint + + for the v1 network security groups id get operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsIDGetParams struct { + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDGetParams) WithDefaults() *V1NetworkSecurityGroupsIDGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups id get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsIDGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsIDGetParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups id get params +func (o *V1NetworkSecurityGroupsIDGetParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsIDGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_id_get_responses.go b/power/client/network_security_groups/v1_network_security_groups_id_get_responses.go new file mode 100644 index 00000000..9f2baad3 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_get_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkSecurityGroupsIDGetReader is a Reader for the V1NetworkSecurityGroupsIDGet structure. +type V1NetworkSecurityGroupsIDGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsIDGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsIDGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsIDGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsIDGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsIDGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsIDGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsIDGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/network-security-groups/{network_security_group_id}] v1.networkSecurityGroups.id.get", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsIDGetOK creates a V1NetworkSecurityGroupsIDGetOK with default headers values +func NewV1NetworkSecurityGroupsIDGetOK() *V1NetworkSecurityGroupsIDGetOK { + return &V1NetworkSecurityGroupsIDGetOK{} +} + +/* +V1NetworkSecurityGroupsIDGetOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsIDGetOK struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups Id get o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups Id get o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id get o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id get o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups Id get o k response +func (o *V1NetworkSecurityGroupsIDGetOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsIDGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetOK) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDGetBadRequest creates a V1NetworkSecurityGroupsIDGetBadRequest with default headers values +func NewV1NetworkSecurityGroupsIDGetBadRequest() *V1NetworkSecurityGroupsIDGetBadRequest { + return &V1NetworkSecurityGroupsIDGetBadRequest{} +} + +/* +V1NetworkSecurityGroupsIDGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsIDGetBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id get bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id get bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id get bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id get bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups Id get bad request response +func (o *V1NetworkSecurityGroupsIDGetBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsIDGetBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDGetUnauthorized creates a V1NetworkSecurityGroupsIDGetUnauthorized with default headers values +func NewV1NetworkSecurityGroupsIDGetUnauthorized() *V1NetworkSecurityGroupsIDGetUnauthorized { + return &V1NetworkSecurityGroupsIDGetUnauthorized{} +} + +/* +V1NetworkSecurityGroupsIDGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsIDGetUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id get unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id get unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id get unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id get unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups Id get unauthorized response +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDGetForbidden creates a V1NetworkSecurityGroupsIDGetForbidden with default headers values +func NewV1NetworkSecurityGroupsIDGetForbidden() *V1NetworkSecurityGroupsIDGetForbidden { + return &V1NetworkSecurityGroupsIDGetForbidden{} +} + +/* +V1NetworkSecurityGroupsIDGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsIDGetForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id get forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id get forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id get forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id get forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups Id get forbidden response +func (o *V1NetworkSecurityGroupsIDGetForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsIDGetForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDGetNotFound creates a V1NetworkSecurityGroupsIDGetNotFound with default headers values +func NewV1NetworkSecurityGroupsIDGetNotFound() *V1NetworkSecurityGroupsIDGetNotFound { + return &V1NetworkSecurityGroupsIDGetNotFound{} +} + +/* +V1NetworkSecurityGroupsIDGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsIDGetNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id get not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id get not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id get not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id get not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups Id get not found response +func (o *V1NetworkSecurityGroupsIDGetNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsIDGetNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDGetInternalServerError creates a V1NetworkSecurityGroupsIDGetInternalServerError with default headers values +func NewV1NetworkSecurityGroupsIDGetInternalServerError() *V1NetworkSecurityGroupsIDGetInternalServerError { + return &V1NetworkSecurityGroupsIDGetInternalServerError{} +} + +/* +V1NetworkSecurityGroupsIDGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsIDGetInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id get internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id get internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id get internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id get internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups Id get internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups Id get internal server error response +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdGetInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_id_put_parameters.go b/power/client/network_security_groups/v1_network_security_groups_id_put_parameters.go new file mode 100644 index 00000000..be90c89b --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_put_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewV1NetworkSecurityGroupsIDPutParams creates a new V1NetworkSecurityGroupsIDPutParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkSecurityGroupsIDPutParams() *V1NetworkSecurityGroupsIDPutParams { + return &V1NetworkSecurityGroupsIDPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsIDPutParamsWithTimeout creates a new V1NetworkSecurityGroupsIDPutParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsIDPutParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDPutParams { + return &V1NetworkSecurityGroupsIDPutParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsIDPutParamsWithContext creates a new V1NetworkSecurityGroupsIDPutParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsIDPutParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsIDPutParams { + return &V1NetworkSecurityGroupsIDPutParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsIDPutParamsWithHTTPClient creates a new V1NetworkSecurityGroupsIDPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsIDPutParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDPutParams { + return &V1NetworkSecurityGroupsIDPutParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsIDPutParams contains all the parameters to send to the API endpoint + + for the v1 network security groups id put operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsIDPutParams struct { + + /* Body. + + Parameters for the update of a Network Security Group + */ + Body *models.NetworkSecurityGroupUpdate + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDPutParams) WithDefaults() *V1NetworkSecurityGroupsIDPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups id put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsIDPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsIDPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsIDPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsIDPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) WithBody(body *models.NetworkSecurityGroupUpdate) *V1NetworkSecurityGroupsIDPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) SetBody(body *models.NetworkSecurityGroupUpdate) { + o.Body = body +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsIDPutParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups id put params +func (o *V1NetworkSecurityGroupsIDPutParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsIDPutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_id_put_responses.go b/power/client/network_security_groups/v1_network_security_groups_id_put_responses.go new file mode 100644 index 00000000..2910a395 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_id_put_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkSecurityGroupsIDPutReader is a Reader for the V1NetworkSecurityGroupsIDPut structure. +type V1NetworkSecurityGroupsIDPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsIDPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsIDPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsIDPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsIDPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsIDPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsIDPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsIDPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /v1/network-security-groups/{network_security_group_id}] v1.networkSecurityGroups.id.put", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsIDPutOK creates a V1NetworkSecurityGroupsIDPutOK with default headers values +func NewV1NetworkSecurityGroupsIDPutOK() *V1NetworkSecurityGroupsIDPutOK { + return &V1NetworkSecurityGroupsIDPutOK{} +} + +/* +V1NetworkSecurityGroupsIDPutOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsIDPutOK struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups Id put o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups Id put o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id put o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id put o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups Id put o k response +func (o *V1NetworkSecurityGroupsIDPutOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsIDPutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutOK) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDPutBadRequest creates a V1NetworkSecurityGroupsIDPutBadRequest with default headers values +func NewV1NetworkSecurityGroupsIDPutBadRequest() *V1NetworkSecurityGroupsIDPutBadRequest { + return &V1NetworkSecurityGroupsIDPutBadRequest{} +} + +/* +V1NetworkSecurityGroupsIDPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsIDPutBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id put bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id put bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id put bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id put bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups Id put bad request response +func (o *V1NetworkSecurityGroupsIDPutBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsIDPutBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDPutUnauthorized creates a V1NetworkSecurityGroupsIDPutUnauthorized with default headers values +func NewV1NetworkSecurityGroupsIDPutUnauthorized() *V1NetworkSecurityGroupsIDPutUnauthorized { + return &V1NetworkSecurityGroupsIDPutUnauthorized{} +} + +/* +V1NetworkSecurityGroupsIDPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsIDPutUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id put unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id put unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id put unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id put unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups Id put unauthorized response +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDPutForbidden creates a V1NetworkSecurityGroupsIDPutForbidden with default headers values +func NewV1NetworkSecurityGroupsIDPutForbidden() *V1NetworkSecurityGroupsIDPutForbidden { + return &V1NetworkSecurityGroupsIDPutForbidden{} +} + +/* +V1NetworkSecurityGroupsIDPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsIDPutForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id put forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id put forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id put forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id put forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups Id put forbidden response +func (o *V1NetworkSecurityGroupsIDPutForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsIDPutForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDPutNotFound creates a V1NetworkSecurityGroupsIDPutNotFound with default headers values +func NewV1NetworkSecurityGroupsIDPutNotFound() *V1NetworkSecurityGroupsIDPutNotFound { + return &V1NetworkSecurityGroupsIDPutNotFound{} +} + +/* +V1NetworkSecurityGroupsIDPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsIDPutNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id put not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id put not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups Id put not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups Id put not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups Id put not found response +func (o *V1NetworkSecurityGroupsIDPutNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsIDPutNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsIDPutInternalServerError creates a V1NetworkSecurityGroupsIDPutInternalServerError with default headers values +func NewV1NetworkSecurityGroupsIDPutInternalServerError() *V1NetworkSecurityGroupsIDPutInternalServerError { + return &V1NetworkSecurityGroupsIDPutInternalServerError{} +} + +/* +V1NetworkSecurityGroupsIDPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsIDPutInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups Id put internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups Id put internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups Id put internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups Id put internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups Id put internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups Id put internal server error response +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /v1/network-security-groups/{network_security_group_id}][%d] v1NetworkSecurityGroupsIdPutInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsIDPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_list_parameters.go b/power/client/network_security_groups/v1_network_security_groups_list_parameters.go new file mode 100644 index 00000000..db9a44a7 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_list_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworkSecurityGroupsListParams creates a new V1NetworkSecurityGroupsListParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkSecurityGroupsListParams() *V1NetworkSecurityGroupsListParams { + return &V1NetworkSecurityGroupsListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsListParamsWithTimeout creates a new V1NetworkSecurityGroupsListParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsListParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsListParams { + return &V1NetworkSecurityGroupsListParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsListParamsWithContext creates a new V1NetworkSecurityGroupsListParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsListParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsListParams { + return &V1NetworkSecurityGroupsListParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsListParamsWithHTTPClient creates a new V1NetworkSecurityGroupsListParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsListParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsListParams { + return &V1NetworkSecurityGroupsListParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsListParams contains all the parameters to send to the API endpoint + + for the v1 network security groups list operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsListParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsListParams) WithDefaults() *V1NetworkSecurityGroupsListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups list params +func (o *V1NetworkSecurityGroupsListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_list_responses.go b/power/client/network_security_groups/v1_network_security_groups_list_responses.go new file mode 100644 index 00000000..4b71837d --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_list_responses.go @@ -0,0 +1,486 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkSecurityGroupsListReader is a Reader for the V1NetworkSecurityGroupsList structure. +type V1NetworkSecurityGroupsListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsListBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsListUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsListForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsListNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsListInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /v1/network-security-groups] v1.networkSecurityGroups.list", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsListOK creates a V1NetworkSecurityGroupsListOK with default headers values +func NewV1NetworkSecurityGroupsListOK() *V1NetworkSecurityGroupsListOK { + return &V1NetworkSecurityGroupsListOK{} +} + +/* +V1NetworkSecurityGroupsListOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsListOK struct { + Payload *models.NetworkSecurityGroups +} + +// IsSuccess returns true when this v1 network security groups list o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups list o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups list o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups list o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups list o k response +func (o *V1NetworkSecurityGroupsListOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsListOK) GetPayload() *models.NetworkSecurityGroups { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroups) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsListBadRequest creates a V1NetworkSecurityGroupsListBadRequest with default headers values +func NewV1NetworkSecurityGroupsListBadRequest() *V1NetworkSecurityGroupsListBadRequest { + return &V1NetworkSecurityGroupsListBadRequest{} +} + +/* +V1NetworkSecurityGroupsListBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsListBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups list bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsListBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups list bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsListBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsListBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups list bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsListBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups list bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsListBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups list bad request response +func (o *V1NetworkSecurityGroupsListBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsListBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsListBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsListBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsListUnauthorized creates a V1NetworkSecurityGroupsListUnauthorized with default headers values +func NewV1NetworkSecurityGroupsListUnauthorized() *V1NetworkSecurityGroupsListUnauthorized { + return &V1NetworkSecurityGroupsListUnauthorized{} +} + +/* +V1NetworkSecurityGroupsListUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsListUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups list unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsListUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups list unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsListUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsListUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups list unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsListUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups list unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsListUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups list unauthorized response +func (o *V1NetworkSecurityGroupsListUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsListUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsListUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsListUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsListForbidden creates a V1NetworkSecurityGroupsListForbidden with default headers values +func NewV1NetworkSecurityGroupsListForbidden() *V1NetworkSecurityGroupsListForbidden { + return &V1NetworkSecurityGroupsListForbidden{} +} + +/* +V1NetworkSecurityGroupsListForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsListForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups list forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsListForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups list forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsListForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsListForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups list forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsListForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups list forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsListForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups list forbidden response +func (o *V1NetworkSecurityGroupsListForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsListForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsListForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsListForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsListNotFound creates a V1NetworkSecurityGroupsListNotFound with default headers values +func NewV1NetworkSecurityGroupsListNotFound() *V1NetworkSecurityGroupsListNotFound { + return &V1NetworkSecurityGroupsListNotFound{} +} + +/* +V1NetworkSecurityGroupsListNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsListNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups list not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsListNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups list not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsListNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsListNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups list not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsListNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups list not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsListNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups list not found response +func (o *V1NetworkSecurityGroupsListNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsListNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsListNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsListNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsListInternalServerError creates a V1NetworkSecurityGroupsListInternalServerError with default headers values +func NewV1NetworkSecurityGroupsListInternalServerError() *V1NetworkSecurityGroupsListInternalServerError { + return &V1NetworkSecurityGroupsListInternalServerError{} +} + +/* +V1NetworkSecurityGroupsListInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsListInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups list internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsListInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups list internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsListInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups list internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsListInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups list internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsListInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups list internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsListInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups list internal server error response +func (o *V1NetworkSecurityGroupsListInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsListInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsListInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /v1/network-security-groups][%d] v1NetworkSecurityGroupsListInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsListInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsListInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_members_delete_parameters.go b/power/client/network_security_groups/v1_network_security_groups_members_delete_parameters.go new file mode 100644 index 00000000..1fce6b31 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_members_delete_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworkSecurityGroupsMembersDeleteParams creates a new V1NetworkSecurityGroupsMembersDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkSecurityGroupsMembersDeleteParams() *V1NetworkSecurityGroupsMembersDeleteParams { + return &V1NetworkSecurityGroupsMembersDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsMembersDeleteParamsWithTimeout creates a new V1NetworkSecurityGroupsMembersDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsMembersDeleteParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsMembersDeleteParams { + return &V1NetworkSecurityGroupsMembersDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsMembersDeleteParamsWithContext creates a new V1NetworkSecurityGroupsMembersDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsMembersDeleteParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsMembersDeleteParams { + return &V1NetworkSecurityGroupsMembersDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsMembersDeleteParamsWithHTTPClient creates a new V1NetworkSecurityGroupsMembersDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsMembersDeleteParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsMembersDeleteParams { + return &V1NetworkSecurityGroupsMembersDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsMembersDeleteParams contains all the parameters to send to the API endpoint + + for the v1 network security groups members delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsMembersDeleteParams struct { + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + /* NetworkSecurityGroupMemberID. + + Network Security Group Member ID + */ + NetworkSecurityGroupMemberID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithDefaults() *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WithNetworkSecurityGroupMemberID adds the networkSecurityGroupMemberID to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WithNetworkSecurityGroupMemberID(networkSecurityGroupMemberID string) *V1NetworkSecurityGroupsMembersDeleteParams { + o.SetNetworkSecurityGroupMemberID(networkSecurityGroupMemberID) + return o +} + +// SetNetworkSecurityGroupMemberID adds the networkSecurityGroupMemberId to the v1 network security groups members delete params +func (o *V1NetworkSecurityGroupsMembersDeleteParams) SetNetworkSecurityGroupMemberID(networkSecurityGroupMemberID string) { + o.NetworkSecurityGroupMemberID = networkSecurityGroupMemberID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsMembersDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + // path param network_security_group_member_id + if err := r.SetPathParam("network_security_group_member_id", o.NetworkSecurityGroupMemberID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_members_delete_responses.go b/power/client/network_security_groups/v1_network_security_groups_members_delete_responses.go new file mode 100644 index 00000000..da71f1b2 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_members_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkSecurityGroupsMembersDeleteReader is a Reader for the V1NetworkSecurityGroupsMembersDelete structure. +type V1NetworkSecurityGroupsMembersDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsMembersDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsMembersDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsMembersDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsMembersDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsMembersDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsMembersDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsMembersDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsMembersDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}] v1.networkSecurityGroups.members.delete", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsMembersDeleteOK creates a V1NetworkSecurityGroupsMembersDeleteOK with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteOK() *V1NetworkSecurityGroupsMembersDeleteOK { + return &V1NetworkSecurityGroupsMembersDeleteOK{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsMembersDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network security groups members delete o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups members delete o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups members delete o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups members delete o k response +func (o *V1NetworkSecurityGroupsMembersDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersDeleteBadRequest creates a V1NetworkSecurityGroupsMembersDeleteBadRequest with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteBadRequest() *V1NetworkSecurityGroupsMembersDeleteBadRequest { + return &V1NetworkSecurityGroupsMembersDeleteBadRequest{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsMembersDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members delete bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups members delete bad request response +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersDeleteUnauthorized creates a V1NetworkSecurityGroupsMembersDeleteUnauthorized with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteUnauthorized() *V1NetworkSecurityGroupsMembersDeleteUnauthorized { + return &V1NetworkSecurityGroupsMembersDeleteUnauthorized{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsMembersDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members delete unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups members delete unauthorized response +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersDeleteForbidden creates a V1NetworkSecurityGroupsMembersDeleteForbidden with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteForbidden() *V1NetworkSecurityGroupsMembersDeleteForbidden { + return &V1NetworkSecurityGroupsMembersDeleteForbidden{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsMembersDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members delete forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups members delete forbidden response +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersDeleteNotFound creates a V1NetworkSecurityGroupsMembersDeleteNotFound with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteNotFound() *V1NetworkSecurityGroupsMembersDeleteNotFound { + return &V1NetworkSecurityGroupsMembersDeleteNotFound{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsMembersDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members delete not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups members delete not found response +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersDeleteConflict creates a V1NetworkSecurityGroupsMembersDeleteConflict with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteConflict() *V1NetworkSecurityGroupsMembersDeleteConflict { + return &V1NetworkSecurityGroupsMembersDeleteConflict{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsMembersDeleteConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members delete conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members delete conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups members delete conflict response +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersDeleteInternalServerError creates a V1NetworkSecurityGroupsMembersDeleteInternalServerError with default headers values +func NewV1NetworkSecurityGroupsMembersDeleteInternalServerError() *V1NetworkSecurityGroupsMembersDeleteInternalServerError { + return &V1NetworkSecurityGroupsMembersDeleteInternalServerError{} +} + +/* +V1NetworkSecurityGroupsMembersDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsMembersDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members delete internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members delete internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members delete internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups members delete internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups members delete internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups members delete internal server error response +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/members/{network_security_group_member_id}][%d] v1NetworkSecurityGroupsMembersDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_members_post_parameters.go b/power/client/network_security_groups/v1_network_security_groups_members_post_parameters.go new file mode 100644 index 00000000..52edfdc8 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_members_post_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewV1NetworkSecurityGroupsMembersPostParams creates a new V1NetworkSecurityGroupsMembersPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkSecurityGroupsMembersPostParams() *V1NetworkSecurityGroupsMembersPostParams { + return &V1NetworkSecurityGroupsMembersPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsMembersPostParamsWithTimeout creates a new V1NetworkSecurityGroupsMembersPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsMembersPostParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsMembersPostParams { + return &V1NetworkSecurityGroupsMembersPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsMembersPostParamsWithContext creates a new V1NetworkSecurityGroupsMembersPostParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsMembersPostParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsMembersPostParams { + return &V1NetworkSecurityGroupsMembersPostParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsMembersPostParamsWithHTTPClient creates a new V1NetworkSecurityGroupsMembersPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsMembersPostParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsMembersPostParams { + return &V1NetworkSecurityGroupsMembersPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsMembersPostParams contains all the parameters to send to the API endpoint + + for the v1 network security groups members post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsMembersPostParams struct { + + /* Body. + + Parameters for adding a member to a Network Security Group + */ + Body *models.NetworkSecurityGroupAddMember + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsMembersPostParams) WithDefaults() *V1NetworkSecurityGroupsMembersPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsMembersPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsMembersPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsMembersPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsMembersPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) WithBody(body *models.NetworkSecurityGroupAddMember) *V1NetworkSecurityGroupsMembersPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) SetBody(body *models.NetworkSecurityGroupAddMember) { + o.Body = body +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsMembersPostParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups members post params +func (o *V1NetworkSecurityGroupsMembersPostParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsMembersPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_members_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_members_post_responses.go new file mode 100644 index 00000000..c273addc --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_members_post_responses.go @@ -0,0 +1,638 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkSecurityGroupsMembersPostReader is a Reader for the V1NetworkSecurityGroupsMembersPost structure. +type V1NetworkSecurityGroupsMembersPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsMembersPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsMembersPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsMembersPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsMembersPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsMembersPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsMembersPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsMembersPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworkSecurityGroupsMembersPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsMembersPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-security-groups/{network_security_group_id}/members] v1.networkSecurityGroups.members.post", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsMembersPostOK creates a V1NetworkSecurityGroupsMembersPostOK with default headers values +func NewV1NetworkSecurityGroupsMembersPostOK() *V1NetworkSecurityGroupsMembersPostOK { + return &V1NetworkSecurityGroupsMembersPostOK{} +} + +/* +V1NetworkSecurityGroupsMembersPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsMembersPostOK struct { + Payload *models.NetworkSecurityGroupMember +} + +// IsSuccess returns true when this v1 network security groups members post o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups members post o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups members post o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups members post o k response +func (o *V1NetworkSecurityGroupsMembersPostOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsMembersPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostOK) GetPayload() *models.NetworkSecurityGroupMember { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroupMember) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersPostBadRequest creates a V1NetworkSecurityGroupsMembersPostBadRequest with default headers values +func NewV1NetworkSecurityGroupsMembersPostBadRequest() *V1NetworkSecurityGroupsMembersPostBadRequest { + return &V1NetworkSecurityGroupsMembersPostBadRequest{} +} + +/* +V1NetworkSecurityGroupsMembersPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsMembersPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups members post bad request response +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersPostUnauthorized creates a V1NetworkSecurityGroupsMembersPostUnauthorized with default headers values +func NewV1NetworkSecurityGroupsMembersPostUnauthorized() *V1NetworkSecurityGroupsMembersPostUnauthorized { + return &V1NetworkSecurityGroupsMembersPostUnauthorized{} +} + +/* +V1NetworkSecurityGroupsMembersPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsMembersPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups members post unauthorized response +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersPostForbidden creates a V1NetworkSecurityGroupsMembersPostForbidden with default headers values +func NewV1NetworkSecurityGroupsMembersPostForbidden() *V1NetworkSecurityGroupsMembersPostForbidden { + return &V1NetworkSecurityGroupsMembersPostForbidden{} +} + +/* +V1NetworkSecurityGroupsMembersPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsMembersPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups members post forbidden response +func (o *V1NetworkSecurityGroupsMembersPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsMembersPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersPostNotFound creates a V1NetworkSecurityGroupsMembersPostNotFound with default headers values +func NewV1NetworkSecurityGroupsMembersPostNotFound() *V1NetworkSecurityGroupsMembersPostNotFound { + return &V1NetworkSecurityGroupsMembersPostNotFound{} +} + +/* +V1NetworkSecurityGroupsMembersPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsMembersPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups members post not found response +func (o *V1NetworkSecurityGroupsMembersPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsMembersPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersPostConflict creates a V1NetworkSecurityGroupsMembersPostConflict with default headers values +func NewV1NetworkSecurityGroupsMembersPostConflict() *V1NetworkSecurityGroupsMembersPostConflict { + return &V1NetworkSecurityGroupsMembersPostConflict{} +} + +/* +V1NetworkSecurityGroupsMembersPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsMembersPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups members post conflict response +func (o *V1NetworkSecurityGroupsMembersPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsMembersPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersPostUnprocessableEntity creates a V1NetworkSecurityGroupsMembersPostUnprocessableEntity with default headers values +func NewV1NetworkSecurityGroupsMembersPostUnprocessableEntity() *V1NetworkSecurityGroupsMembersPostUnprocessableEntity { + return &V1NetworkSecurityGroupsMembersPostUnprocessableEntity{} +} + +/* +V1NetworkSecurityGroupsMembersPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworkSecurityGroupsMembersPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post unprocessable entity response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post unprocessable entity response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post unprocessable entity response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups members post unprocessable entity response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups members post unprocessable entity response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 network security groups members post unprocessable entity response +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsMembersPostInternalServerError creates a V1NetworkSecurityGroupsMembersPostInternalServerError with default headers values +func NewV1NetworkSecurityGroupsMembersPostInternalServerError() *V1NetworkSecurityGroupsMembersPostInternalServerError { + return &V1NetworkSecurityGroupsMembersPostInternalServerError{} +} + +/* +V1NetworkSecurityGroupsMembersPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsMembersPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups members post internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups members post internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups members post internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups members post internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups members post internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups members post internal server error response +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/members][%d] v1NetworkSecurityGroupsMembersPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsMembersPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_post_parameters.go b/power/client/network_security_groups/v1_network_security_groups_post_parameters.go new file mode 100644 index 00000000..d827078a --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_post_parameters.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewV1NetworkSecurityGroupsPostParams creates a new V1NetworkSecurityGroupsPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkSecurityGroupsPostParams() *V1NetworkSecurityGroupsPostParams { + return &V1NetworkSecurityGroupsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsPostParamsWithTimeout creates a new V1NetworkSecurityGroupsPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsPostParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsPostParams { + return &V1NetworkSecurityGroupsPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsPostParamsWithContext creates a new V1NetworkSecurityGroupsPostParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsPostParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsPostParams { + return &V1NetworkSecurityGroupsPostParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsPostParamsWithHTTPClient creates a new V1NetworkSecurityGroupsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsPostParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsPostParams { + return &V1NetworkSecurityGroupsPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsPostParams contains all the parameters to send to the API endpoint + + for the v1 network security groups post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsPostParams struct { + + /* Body. + + Parameters for the creation of a Network Security Group + */ + Body *models.NetworkSecurityGroupCreate + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsPostParams) WithDefaults() *V1NetworkSecurityGroupsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) WithBody(body *models.NetworkSecurityGroupCreate) *V1NetworkSecurityGroupsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network security groups post params +func (o *V1NetworkSecurityGroupsPostParams) SetBody(body *models.NetworkSecurityGroupCreate) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_post_responses.go new file mode 100644 index 00000000..a384c457 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_post_responses.go @@ -0,0 +1,714 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkSecurityGroupsPostReader is a Reader for the V1NetworkSecurityGroupsPost structure. +type V1NetworkSecurityGroupsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewV1NetworkSecurityGroupsPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworkSecurityGroupsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-security-groups] v1.networkSecurityGroups.post", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsPostOK creates a V1NetworkSecurityGroupsPostOK with default headers values +func NewV1NetworkSecurityGroupsPostOK() *V1NetworkSecurityGroupsPostOK { + return &V1NetworkSecurityGroupsPostOK{} +} + +/* +V1NetworkSecurityGroupsPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsPostOK struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups post o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups post o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups post o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups post o k response +func (o *V1NetworkSecurityGroupsPostOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsPostOK) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsPostCreated creates a V1NetworkSecurityGroupsPostCreated with default headers values +func NewV1NetworkSecurityGroupsPostCreated() *V1NetworkSecurityGroupsPostCreated { + return &V1NetworkSecurityGroupsPostCreated{} +} + +/* +V1NetworkSecurityGroupsPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type V1NetworkSecurityGroupsPostCreated struct { + Payload *models.NetworkSecurityGroup +} + +// IsSuccess returns true when this v1 network security groups post created response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostCreated) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups post created response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostCreated) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post created response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostCreated) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups post created response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostCreated) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post created response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostCreated) IsCode(code int) bool { + return code == 201 +} + +// Code gets the status code for the v1 network security groups post created response +func (o *V1NetworkSecurityGroupsPostCreated) Code() int { + return 201 +} + +func (o *V1NetworkSecurityGroupsPostCreated) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostCreated %s", 201, payload) +} + +func (o *V1NetworkSecurityGroupsPostCreated) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostCreated %s", 201, payload) +} + +func (o *V1NetworkSecurityGroupsPostCreated) GetPayload() *models.NetworkSecurityGroup { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsPostBadRequest creates a V1NetworkSecurityGroupsPostBadRequest with default headers values +func NewV1NetworkSecurityGroupsPostBadRequest() *V1NetworkSecurityGroupsPostBadRequest { + return &V1NetworkSecurityGroupsPostBadRequest{} +} + +/* +V1NetworkSecurityGroupsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups post bad request response +func (o *V1NetworkSecurityGroupsPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsPostUnauthorized creates a V1NetworkSecurityGroupsPostUnauthorized with default headers values +func NewV1NetworkSecurityGroupsPostUnauthorized() *V1NetworkSecurityGroupsPostUnauthorized { + return &V1NetworkSecurityGroupsPostUnauthorized{} +} + +/* +V1NetworkSecurityGroupsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups post unauthorized response +func (o *V1NetworkSecurityGroupsPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsPostForbidden creates a V1NetworkSecurityGroupsPostForbidden with default headers values +func NewV1NetworkSecurityGroupsPostForbidden() *V1NetworkSecurityGroupsPostForbidden { + return &V1NetworkSecurityGroupsPostForbidden{} +} + +/* +V1NetworkSecurityGroupsPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups post forbidden response +func (o *V1NetworkSecurityGroupsPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsPostNotFound creates a V1NetworkSecurityGroupsPostNotFound with default headers values +func NewV1NetworkSecurityGroupsPostNotFound() *V1NetworkSecurityGroupsPostNotFound { + return &V1NetworkSecurityGroupsPostNotFound{} +} + +/* +V1NetworkSecurityGroupsPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups post not found response +func (o *V1NetworkSecurityGroupsPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsPostConflict creates a V1NetworkSecurityGroupsPostConflict with default headers values +func NewV1NetworkSecurityGroupsPostConflict() *V1NetworkSecurityGroupsPostConflict { + return &V1NetworkSecurityGroupsPostConflict{} +} + +/* +V1NetworkSecurityGroupsPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups post conflict response +func (o *V1NetworkSecurityGroupsPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsPostUnprocessableEntity creates a V1NetworkSecurityGroupsPostUnprocessableEntity with default headers values +func NewV1NetworkSecurityGroupsPostUnprocessableEntity() *V1NetworkSecurityGroupsPostUnprocessableEntity { + return &V1NetworkSecurityGroupsPostUnprocessableEntity{} +} + +/* +V1NetworkSecurityGroupsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworkSecurityGroupsPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post unprocessable entity response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post unprocessable entity response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post unprocessable entity response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups post unprocessable entity response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups post unprocessable entity response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 network security groups post unprocessable entity response +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsPostInternalServerError creates a V1NetworkSecurityGroupsPostInternalServerError with default headers values +func NewV1NetworkSecurityGroupsPostInternalServerError() *V1NetworkSecurityGroupsPostInternalServerError { + return &V1NetworkSecurityGroupsPostInternalServerError{} +} + +/* +V1NetworkSecurityGroupsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups post internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups post internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups post internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups post internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups post internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups post internal server error response +func (o *V1NetworkSecurityGroupsPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups][%d] v1NetworkSecurityGroupsPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_rules_delete_parameters.go b/power/client/network_security_groups/v1_network_security_groups_rules_delete_parameters.go new file mode 100644 index 00000000..c83eb86b --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_rules_delete_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewV1NetworkSecurityGroupsRulesDeleteParams creates a new V1NetworkSecurityGroupsRulesDeleteParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkSecurityGroupsRulesDeleteParams() *V1NetworkSecurityGroupsRulesDeleteParams { + return &V1NetworkSecurityGroupsRulesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsRulesDeleteParamsWithTimeout creates a new V1NetworkSecurityGroupsRulesDeleteParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsRulesDeleteParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsRulesDeleteParams { + return &V1NetworkSecurityGroupsRulesDeleteParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsRulesDeleteParamsWithContext creates a new V1NetworkSecurityGroupsRulesDeleteParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsRulesDeleteParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsRulesDeleteParams { + return &V1NetworkSecurityGroupsRulesDeleteParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsRulesDeleteParamsWithHTTPClient creates a new V1NetworkSecurityGroupsRulesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsRulesDeleteParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsRulesDeleteParams { + return &V1NetworkSecurityGroupsRulesDeleteParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsRulesDeleteParams contains all the parameters to send to the API endpoint + + for the v1 network security groups rules delete operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsRulesDeleteParams struct { + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + /* NetworkSecurityGroupRuleID. + + Network Security Group Rule ID + */ + NetworkSecurityGroupRuleID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups rules delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithDefaults() *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups rules delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WithNetworkSecurityGroupRuleID adds the networkSecurityGroupRuleID to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WithNetworkSecurityGroupRuleID(networkSecurityGroupRuleID string) *V1NetworkSecurityGroupsRulesDeleteParams { + o.SetNetworkSecurityGroupRuleID(networkSecurityGroupRuleID) + return o +} + +// SetNetworkSecurityGroupRuleID adds the networkSecurityGroupRuleId to the v1 network security groups rules delete params +func (o *V1NetworkSecurityGroupsRulesDeleteParams) SetNetworkSecurityGroupRuleID(networkSecurityGroupRuleID string) { + o.NetworkSecurityGroupRuleID = networkSecurityGroupRuleID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsRulesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + // path param network_security_group_rule_id + if err := r.SetPathParam("network_security_group_rule_id", o.NetworkSecurityGroupRuleID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go b/power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go new file mode 100644 index 00000000..e318eb64 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_rules_delete_responses.go @@ -0,0 +1,560 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkSecurityGroupsRulesDeleteReader is a Reader for the V1NetworkSecurityGroupsRulesDelete structure. +type V1NetworkSecurityGroupsRulesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsRulesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsRulesDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsRulesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsRulesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsRulesDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsRulesDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsRulesDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsRulesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}] v1.networkSecurityGroups.rules.delete", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsRulesDeleteOK creates a V1NetworkSecurityGroupsRulesDeleteOK with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteOK() *V1NetworkSecurityGroupsRulesDeleteOK { + return &V1NetworkSecurityGroupsRulesDeleteOK{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsRulesDeleteOK struct { + Payload models.Object +} + +// IsSuccess returns true when this v1 network security groups rules delete o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups rules delete o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups rules delete o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups rules delete o k response +func (o *V1NetworkSecurityGroupsRulesDeleteOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesDeleteBadRequest creates a V1NetworkSecurityGroupsRulesDeleteBadRequest with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteBadRequest() *V1NetworkSecurityGroupsRulesDeleteBadRequest { + return &V1NetworkSecurityGroupsRulesDeleteBadRequest{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsRulesDeleteBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules delete bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups rules delete bad request response +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesDeleteUnauthorized creates a V1NetworkSecurityGroupsRulesDeleteUnauthorized with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteUnauthorized() *V1NetworkSecurityGroupsRulesDeleteUnauthorized { + return &V1NetworkSecurityGroupsRulesDeleteUnauthorized{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsRulesDeleteUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules delete unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups rules delete unauthorized response +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesDeleteForbidden creates a V1NetworkSecurityGroupsRulesDeleteForbidden with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteForbidden() *V1NetworkSecurityGroupsRulesDeleteForbidden { + return &V1NetworkSecurityGroupsRulesDeleteForbidden{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsRulesDeleteForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules delete forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups rules delete forbidden response +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesDeleteNotFound creates a V1NetworkSecurityGroupsRulesDeleteNotFound with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteNotFound() *V1NetworkSecurityGroupsRulesDeleteNotFound { + return &V1NetworkSecurityGroupsRulesDeleteNotFound{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsRulesDeleteNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules delete not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups rules delete not found response +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesDeleteConflict creates a V1NetworkSecurityGroupsRulesDeleteConflict with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteConflict() *V1NetworkSecurityGroupsRulesDeleteConflict { + return &V1NetworkSecurityGroupsRulesDeleteConflict{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsRulesDeleteConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules delete conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules delete conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups rules delete conflict response +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesDeleteInternalServerError creates a V1NetworkSecurityGroupsRulesDeleteInternalServerError with default headers values +func NewV1NetworkSecurityGroupsRulesDeleteInternalServerError() *V1NetworkSecurityGroupsRulesDeleteInternalServerError { + return &V1NetworkSecurityGroupsRulesDeleteInternalServerError{} +} + +/* +V1NetworkSecurityGroupsRulesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsRulesDeleteInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules delete internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules delete internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules delete internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups rules delete internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups rules delete internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups rules delete internal server error response +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /v1/network-security-groups/{network_security_group_id}/rules/{network_security_group_rule_id}][%d] v1NetworkSecurityGroupsRulesDeleteInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_rules_post_parameters.go b/power/client/network_security_groups/v1_network_security_groups_rules_post_parameters.go new file mode 100644 index 00000000..c5ba2923 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_rules_post_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewV1NetworkSecurityGroupsRulesPostParams creates a new V1NetworkSecurityGroupsRulesPostParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewV1NetworkSecurityGroupsRulesPostParams() *V1NetworkSecurityGroupsRulesPostParams { + return &V1NetworkSecurityGroupsRulesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewV1NetworkSecurityGroupsRulesPostParamsWithTimeout creates a new V1NetworkSecurityGroupsRulesPostParams object +// with the ability to set a timeout on a request. +func NewV1NetworkSecurityGroupsRulesPostParamsWithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsRulesPostParams { + return &V1NetworkSecurityGroupsRulesPostParams{ + timeout: timeout, + } +} + +// NewV1NetworkSecurityGroupsRulesPostParamsWithContext creates a new V1NetworkSecurityGroupsRulesPostParams object +// with the ability to set a context for a request. +func NewV1NetworkSecurityGroupsRulesPostParamsWithContext(ctx context.Context) *V1NetworkSecurityGroupsRulesPostParams { + return &V1NetworkSecurityGroupsRulesPostParams{ + Context: ctx, + } +} + +// NewV1NetworkSecurityGroupsRulesPostParamsWithHTTPClient creates a new V1NetworkSecurityGroupsRulesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewV1NetworkSecurityGroupsRulesPostParamsWithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsRulesPostParams { + return &V1NetworkSecurityGroupsRulesPostParams{ + HTTPClient: client, + } +} + +/* +V1NetworkSecurityGroupsRulesPostParams contains all the parameters to send to the API endpoint + + for the v1 network security groups rules post operation. + + Typically these are written to a http.Request. +*/ +type V1NetworkSecurityGroupsRulesPostParams struct { + + /* Body. + + Parameters for adding a rule to a Network Security Group + */ + Body *models.NetworkSecurityGroupAddRule + + /* NetworkSecurityGroupID. + + Network Security Group ID + */ + NetworkSecurityGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the v1 network security groups rules post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsRulesPostParams) WithDefaults() *V1NetworkSecurityGroupsRulesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the v1 network security groups rules post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *V1NetworkSecurityGroupsRulesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) WithTimeout(timeout time.Duration) *V1NetworkSecurityGroupsRulesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) WithContext(ctx context.Context) *V1NetworkSecurityGroupsRulesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) WithHTTPClient(client *http.Client) *V1NetworkSecurityGroupsRulesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) WithBody(body *models.NetworkSecurityGroupAddRule) *V1NetworkSecurityGroupsRulesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) SetBody(body *models.NetworkSecurityGroupAddRule) { + o.Body = body +} + +// WithNetworkSecurityGroupID adds the networkSecurityGroupID to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) WithNetworkSecurityGroupID(networkSecurityGroupID string) *V1NetworkSecurityGroupsRulesPostParams { + o.SetNetworkSecurityGroupID(networkSecurityGroupID) + return o +} + +// SetNetworkSecurityGroupID adds the networkSecurityGroupId to the v1 network security groups rules post params +func (o *V1NetworkSecurityGroupsRulesPostParams) SetNetworkSecurityGroupID(networkSecurityGroupID string) { + o.NetworkSecurityGroupID = networkSecurityGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *V1NetworkSecurityGroupsRulesPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param network_security_group_id + if err := r.SetPathParam("network_security_group_id", o.NetworkSecurityGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go b/power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go new file mode 100644 index 00000000..5d519da4 --- /dev/null +++ b/power/client/network_security_groups/v1_network_security_groups_rules_post_responses.go @@ -0,0 +1,638 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package network_security_groups + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// V1NetworkSecurityGroupsRulesPostReader is a Reader for the V1NetworkSecurityGroupsRulesPost structure. +type V1NetworkSecurityGroupsRulesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *V1NetworkSecurityGroupsRulesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewV1NetworkSecurityGroupsRulesPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewV1NetworkSecurityGroupsRulesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewV1NetworkSecurityGroupsRulesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewV1NetworkSecurityGroupsRulesPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewV1NetworkSecurityGroupsRulesPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewV1NetworkSecurityGroupsRulesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewV1NetworkSecurityGroupsRulesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewV1NetworkSecurityGroupsRulesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /v1/network-security-groups/{network_security_group_id}/rules] v1.networkSecurityGroups.rules.post", response, response.Code()) + } +} + +// NewV1NetworkSecurityGroupsRulesPostOK creates a V1NetworkSecurityGroupsRulesPostOK with default headers values +func NewV1NetworkSecurityGroupsRulesPostOK() *V1NetworkSecurityGroupsRulesPostOK { + return &V1NetworkSecurityGroupsRulesPostOK{} +} + +/* +V1NetworkSecurityGroupsRulesPostOK describes a response with status code 200, with default header values. + +OK +*/ +type V1NetworkSecurityGroupsRulesPostOK struct { + Payload *models.NetworkSecurityGroupRule +} + +// IsSuccess returns true when this v1 network security groups rules post o k response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this v1 network security groups rules post o k response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post o k response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups rules post o k response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post o k response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the v1 network security groups rules post o k response +func (o *V1NetworkSecurityGroupsRulesPostOK) Code() int { + return 200 +} + +func (o *V1NetworkSecurityGroupsRulesPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostOK %s", 200, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostOK) GetPayload() *models.NetworkSecurityGroupRule { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkSecurityGroupRule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesPostBadRequest creates a V1NetworkSecurityGroupsRulesPostBadRequest with default headers values +func NewV1NetworkSecurityGroupsRulesPostBadRequest() *V1NetworkSecurityGroupsRulesPostBadRequest { + return &V1NetworkSecurityGroupsRulesPostBadRequest{} +} + +/* +V1NetworkSecurityGroupsRulesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type V1NetworkSecurityGroupsRulesPostBadRequest struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post bad request response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post bad request response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post bad request response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post bad request response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post bad request response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the v1 network security groups rules post bad request response +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) Code() int { + return 400 +} + +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostBadRequest %s", 400, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesPostUnauthorized creates a V1NetworkSecurityGroupsRulesPostUnauthorized with default headers values +func NewV1NetworkSecurityGroupsRulesPostUnauthorized() *V1NetworkSecurityGroupsRulesPostUnauthorized { + return &V1NetworkSecurityGroupsRulesPostUnauthorized{} +} + +/* +V1NetworkSecurityGroupsRulesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type V1NetworkSecurityGroupsRulesPostUnauthorized struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post unauthorized response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post unauthorized response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post unauthorized response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post unauthorized response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post unauthorized response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the v1 network security groups rules post unauthorized response +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) Code() int { + return 401 +} + +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostUnauthorized %s", 401, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesPostForbidden creates a V1NetworkSecurityGroupsRulesPostForbidden with default headers values +func NewV1NetworkSecurityGroupsRulesPostForbidden() *V1NetworkSecurityGroupsRulesPostForbidden { + return &V1NetworkSecurityGroupsRulesPostForbidden{} +} + +/* +V1NetworkSecurityGroupsRulesPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type V1NetworkSecurityGroupsRulesPostForbidden struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post forbidden response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post forbidden response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post forbidden response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post forbidden response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post forbidden response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the v1 network security groups rules post forbidden response +func (o *V1NetworkSecurityGroupsRulesPostForbidden) Code() int { + return 403 +} + +func (o *V1NetworkSecurityGroupsRulesPostForbidden) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostForbidden) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostForbidden %s", 403, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesPostNotFound creates a V1NetworkSecurityGroupsRulesPostNotFound with default headers values +func NewV1NetworkSecurityGroupsRulesPostNotFound() *V1NetworkSecurityGroupsRulesPostNotFound { + return &V1NetworkSecurityGroupsRulesPostNotFound{} +} + +/* +V1NetworkSecurityGroupsRulesPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type V1NetworkSecurityGroupsRulesPostNotFound struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post not found response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post not found response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post not found response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post not found response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post not found response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the v1 network security groups rules post not found response +func (o *V1NetworkSecurityGroupsRulesPostNotFound) Code() int { + return 404 +} + +func (o *V1NetworkSecurityGroupsRulesPostNotFound) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostNotFound) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostNotFound %s", 404, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesPostConflict creates a V1NetworkSecurityGroupsRulesPostConflict with default headers values +func NewV1NetworkSecurityGroupsRulesPostConflict() *V1NetworkSecurityGroupsRulesPostConflict { + return &V1NetworkSecurityGroupsRulesPostConflict{} +} + +/* +V1NetworkSecurityGroupsRulesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type V1NetworkSecurityGroupsRulesPostConflict struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post conflict response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post conflict response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post conflict response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post conflict response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post conflict response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the v1 network security groups rules post conflict response +func (o *V1NetworkSecurityGroupsRulesPostConflict) Code() int { + return 409 +} + +func (o *V1NetworkSecurityGroupsRulesPostConflict) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostConflict) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostConflict %s", 409, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesPostUnprocessableEntity creates a V1NetworkSecurityGroupsRulesPostUnprocessableEntity with default headers values +func NewV1NetworkSecurityGroupsRulesPostUnprocessableEntity() *V1NetworkSecurityGroupsRulesPostUnprocessableEntity { + return &V1NetworkSecurityGroupsRulesPostUnprocessableEntity{} +} + +/* +V1NetworkSecurityGroupsRulesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type V1NetworkSecurityGroupsRulesPostUnprocessableEntity struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post unprocessable entity response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post unprocessable entity response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post unprocessable entity response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this v1 network security groups rules post unprocessable entity response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this v1 network security groups rules post unprocessable entity response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the v1 network security groups rules post unprocessable entity response +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostUnprocessableEntity %s", 422, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewV1NetworkSecurityGroupsRulesPostInternalServerError creates a V1NetworkSecurityGroupsRulesPostInternalServerError with default headers values +func NewV1NetworkSecurityGroupsRulesPostInternalServerError() *V1NetworkSecurityGroupsRulesPostInternalServerError { + return &V1NetworkSecurityGroupsRulesPostInternalServerError{} +} + +/* +V1NetworkSecurityGroupsRulesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type V1NetworkSecurityGroupsRulesPostInternalServerError struct { + Payload *models.Error +} + +// IsSuccess returns true when this v1 network security groups rules post internal server error response has a 2xx status code +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this v1 network security groups rules post internal server error response has a 3xx status code +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this v1 network security groups rules post internal server error response has a 4xx status code +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this v1 network security groups rules post internal server error response has a 5xx status code +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this v1 network security groups rules post internal server error response a status code equal to that given +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the v1 network security groups rules post internal server error response +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) Code() int { + return 500 +} + +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /v1/network-security-groups/{network_security_group_id}/rules][%d] v1NetworkSecurityGroupsRulesPostInternalServerError %s", 500, payload) +} + +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *V1NetworkSecurityGroupsRulesPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/power/client/power_iaas_api_client.go b/power/client/power_iaas_api_client.go index 3c14cb10..6a25d818 100644 --- a/power/client/power_iaas_api_client.go +++ b/power/client/power_iaas_api_client.go @@ -21,6 +21,8 @@ import ( "github.com/IBM-Cloud/power-go-client/power/client/internal_power_v_s_locations" "github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions" "github.com/IBM-Cloud/power-go-client/power/client/internal_transit_gateway" + "github.com/IBM-Cloud/power-go-client/power/client/network_address_groups" + "github.com/IBM-Cloud/power-go-client/power/client/network_security_groups" "github.com/IBM-Cloud/power-go-client/power/client/networks" "github.com/IBM-Cloud/power-go-client/power/client/open_stacks" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections" @@ -111,6 +113,8 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaasA cli.InternalPowervsLocations = internal_power_v_s_locations.New(transport, formats) cli.InternalStorageRegions = internal_storage_regions.New(transport, formats) cli.InternalTransitGateway = internal_transit_gateway.New(transport, formats) + cli.NetworkAddressGroups = network_address_groups.New(transport, formats) + cli.NetworkSecurityGroups = network_security_groups.New(transport, formats) cli.Networks = networks.New(transport, formats) cli.OpenStacks = open_stacks.New(transport, formats) cli.PCloudCloudConnections = p_cloud_cloud_connections.New(transport, formats) @@ -212,6 +216,10 @@ type PowerIaasAPI struct { InternalTransitGateway internal_transit_gateway.ClientService + NetworkAddressGroups network_address_groups.ClientService + + NetworkSecurityGroups network_security_groups.ClientService + Networks networks.ClientService OpenStacks open_stacks.ClientService @@ -299,6 +307,8 @@ func (c *PowerIaasAPI) SetTransport(transport runtime.ClientTransport) { c.InternalPowervsLocations.SetTransport(transport) c.InternalStorageRegions.SetTransport(transport) c.InternalTransitGateway.SetTransport(transport) + c.NetworkAddressGroups.SetTransport(transport) + c.NetworkSecurityGroups.SetTransport(transport) c.Networks.SetTransport(transport) c.OpenStacks.SetTransport(transport) c.PCloudCloudConnections.SetTransport(transport) diff --git a/power/models/network.go b/power/models/network.go index db5ea45e..5e5d2153 100644 --- a/power/models/network.go +++ b/power/models/network.go @@ -31,8 +31,8 @@ type Network struct { // (currently not available) cloud connections this network is attached CloudConnections []*NetworkCloudConnectionsItems0 `json:"cloudConnections,omitempty"` - // crn - Crn CRN `json:"crn,omitempty"` + // The CRN for this resource + Crn string `json:"crn,omitempty"` // DHCP Managed Network DhcpManaged bool `json:"dhcpManaged,omitempty"` @@ -76,8 +76,8 @@ type Network struct { // Enum: ["vlan","pub-vlan","dhcp-vlan"] Type *string `json:"type"` - // user tags - UserTags Tags `json:"userTags,omitempty"` + // The user tags associated with this resource. + UserTags []string `json:"userTags,omitempty"` // VLAN ID // Required: true @@ -100,10 +100,6 @@ func (m *Network) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateCrn(formats); err != nil { - res = append(res, err) - } - if err := m.validateDNSServers(formats); err != nil { res = append(res, err) } @@ -136,10 +132,6 @@ func (m *Network) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateUserTags(formats); err != nil { - res = append(res, err) - } - if err := m.validateVlanID(formats); err != nil { res = append(res, err) } @@ -202,23 +194,6 @@ func (m *Network) validateCloudConnections(formats strfmt.Registry) error { return nil } -func (m *Network) validateCrn(formats strfmt.Registry) error { - if swag.IsZero(m.Crn) { // not required - return nil - } - - if err := m.Crn.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("crn") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("crn") - } - return err - } - - return nil -} - func (m *Network) validateDNSServers(formats strfmt.Registry) error { if err := validate.Required("dnsServers", "body", m.DNSServers); err != nil { @@ -381,23 +356,6 @@ func (m *Network) validateType(formats strfmt.Registry) error { return nil } -func (m *Network) validateUserTags(formats strfmt.Registry) error { - if swag.IsZero(m.UserTags) { // not required - return nil - } - - if err := m.UserTags.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("userTags") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("userTags") - } - return err - } - - return nil -} - func (m *Network) validateVlanID(formats strfmt.Registry) error { if err := validate.Required("vlanID", "body", m.VlanID); err != nil { @@ -419,10 +377,6 @@ func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) res = append(res, err) } - if err := m.contextValidateCrn(ctx, formats); err != nil { - res = append(res, err) - } - if err := m.contextValidateIPAddressMetrics(ctx, formats); err != nil { res = append(res, err) } @@ -435,10 +389,6 @@ func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) res = append(res, err) } - if err := m.contextValidateUserTags(ctx, formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -488,24 +438,6 @@ func (m *Network) contextValidateCloudConnections(ctx context.Context, formats s return nil } -func (m *Network) contextValidateCrn(ctx context.Context, formats strfmt.Registry) error { - - if swag.IsZero(m.Crn) { // not required - return nil - } - - if err := m.Crn.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("crn") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("crn") - } - return err - } - - return nil -} - func (m *Network) contextValidateIPAddressMetrics(ctx context.Context, formats strfmt.Registry) error { if m.IPAddressMetrics != nil { @@ -573,20 +505,6 @@ func (m *Network) contextValidatePublicIPAddressRanges(ctx context.Context, form return nil } -func (m *Network) contextValidateUserTags(ctx context.Context, formats strfmt.Registry) error { - - if err := m.UserTags.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("userTags") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("userTags") - } - return err - } - - return nil -} - // MarshalBinary interface implementation func (m *Network) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/power/models/network_address_group.go b/power/models/network_address_group.go new file mode 100644 index 00000000..6a7d2a9c --- /dev/null +++ b/power/models/network_address_group.go @@ -0,0 +1,176 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkAddressGroup network address group +// +// swagger:model NetworkAddressGroup +type NetworkAddressGroup struct { + + // The Network Address Group's crn + // Required: true + Crn *string `json:"crn"` + + // The id of the Network Address Group + // Required: true + ID *string `json:"id"` + + // The list of IP addresses in CIDR notation (for example 192.168.66.2/32) in the Network Address Group + Members []*NetworkAddressGroupMember `json:"members"` + + // The name of the Network Address Group + // Required: true + Name *string `json:"name"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags,omitempty"` +} + +// Validate validates this network address group +func (m *NetworkAddressGroup) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMembers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroup) validateCrn(formats strfmt.Registry) error { + + if err := validate.Required("crn", "body", m.Crn); err != nil { + return err + } + + return nil +} + +func (m *NetworkAddressGroup) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkAddressGroup) validateMembers(formats strfmt.Registry) error { + if swag.IsZero(m.Members) { // not required + return nil + } + + for i := 0; i < len(m.Members); i++ { + if swag.IsZero(m.Members[i]) { // not required + continue + } + + if m.Members[i] != nil { + if err := m.Members[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *NetworkAddressGroup) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this network address group based on the context it is used +func (m *NetworkAddressGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMembers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroup) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Members); i++ { + + if m.Members[i] != nil { + + if swag.IsZero(m.Members[i]) { // not required + return nil + } + + if err := m.Members[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroup) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroup) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroup + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_address_group_add_member.go b/power/models/network_address_group_add_member.go new file mode 100644 index 00000000..8f12580c --- /dev/null +++ b/power/models/network_address_group_add_member.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkAddressGroupAddMember network address group add member +// +// swagger:model NetworkAddressGroupAddMember +type NetworkAddressGroupAddMember struct { + + // The member to add in CIDR format + // Required: true + Cidr *string `json:"cidr"` +} + +// Validate validates this network address group add member +func (m *NetworkAddressGroupAddMember) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCidr(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroupAddMember) validateCidr(formats strfmt.Registry) error { + + if err := validate.Required("cidr", "body", m.Cidr); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network address group add member based on context it is used +func (m *NetworkAddressGroupAddMember) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroupAddMember) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroupAddMember) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroupAddMember + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_address_group_create.go b/power/models/network_address_group_create.go new file mode 100644 index 00000000..24a83dfb --- /dev/null +++ b/power/models/network_address_group_create.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkAddressGroupCreate network address group create +// +// swagger:model NetworkAddressGroupCreate +type NetworkAddressGroupCreate struct { + + // The name of the Network Address Group + // Required: true + Name *string `json:"name"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags,omitempty"` +} + +// Validate validates this network address group create +func (m *NetworkAddressGroupCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroupCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network address group create based on context it is used +func (m *NetworkAddressGroupCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroupCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroupCreate) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroupCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_address_group_member.go b/power/models/network_address_group_member.go new file mode 100644 index 00000000..8df76aaf --- /dev/null +++ b/power/models/network_address_group_member.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkAddressGroupMember network address group member +// +// swagger:model NetworkAddressGroupMember +type NetworkAddressGroupMember struct { + + // The IP addresses in CIDR notation for example 192.168.1.5/32 + // Required: true + Cidr *string `json:"cidr"` + + // The id of the Network Address Group member IP addresses + // Required: true + ID *string `json:"id"` +} + +// Validate validates this network address group member +func (m *NetworkAddressGroupMember) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCidr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroupMember) validateCidr(formats strfmt.Registry) error { + + if err := validate.Required("cidr", "body", m.Cidr); err != nil { + return err + } + + return nil +} + +func (m *NetworkAddressGroupMember) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network address group member based on context it is used +func (m *NetworkAddressGroupMember) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroupMember) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroupMember) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroupMember + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_address_group_update.go b/power/models/network_address_group_update.go new file mode 100644 index 00000000..a6e4dca0 --- /dev/null +++ b/power/models/network_address_group_update.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NetworkAddressGroupUpdate network address group update +// +// swagger:model NetworkAddressGroupUpdate +type NetworkAddressGroupUpdate struct { + + // Replaces the current Network Address Group Name + Name string `json:"name,omitempty"` +} + +// Validate validates this network address group update +func (m *NetworkAddressGroupUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network address group update based on context it is used +func (m *NetworkAddressGroupUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroupUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroupUpdate) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroupUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_address_groups.go b/power/models/network_address_groups.go new file mode 100644 index 00000000..425077d8 --- /dev/null +++ b/power/models/network_address_groups.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NetworkAddressGroups network address groups +// +// swagger:model NetworkAddressGroups +type NetworkAddressGroups struct { + + // list of Network Address Groups + NetworkAddressGroups []*NetworkAddressGroup `json:"networkAddressGroups"` +} + +// Validate validates this network address groups +func (m *NetworkAddressGroups) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNetworkAddressGroups(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroups) validateNetworkAddressGroups(formats strfmt.Registry) error { + if swag.IsZero(m.NetworkAddressGroups) { // not required + return nil + } + + for i := 0; i < len(m.NetworkAddressGroups); i++ { + if swag.IsZero(m.NetworkAddressGroups[i]) { // not required + continue + } + + if m.NetworkAddressGroups[i] != nil { + if err := m.NetworkAddressGroups[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkAddressGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkAddressGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network address groups based on the context it is used +func (m *NetworkAddressGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworkAddressGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkAddressGroups) contextValidateNetworkAddressGroups(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.NetworkAddressGroups); i++ { + + if m.NetworkAddressGroups[i] != nil { + + if swag.IsZero(m.NetworkAddressGroups[i]) { // not required + return nil + } + + if err := m.NetworkAddressGroups[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkAddressGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkAddressGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkAddressGroups) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkAddressGroups) UnmarshalBinary(b []byte) error { + var res NetworkAddressGroups + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group.go b/power/models/network_security_group.go new file mode 100644 index 00000000..7305e141 --- /dev/null +++ b/power/models/network_security_group.go @@ -0,0 +1,238 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroup network security group +// +// swagger:model NetworkSecurityGroup +type NetworkSecurityGroup struct { + + // The Network Security Group's crn + // Required: true + Crn *string `json:"crn"` + + // The ID of the Network Security Group + // Required: true + ID *string `json:"id"` + + // The list of IPv4 addresses and\or Network Interfaces in the Network Security Group + Members []*NetworkSecurityGroupMember `json:"members"` + + // The name of the Network Security Group + // Required: true + Name *string `json:"name"` + + // The list of rules in the Network Security Group + Rules []*NetworkSecurityGroupRule `json:"rules"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags,omitempty"` +} + +// Validate validates this network security group +func (m *NetworkSecurityGroup) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCrn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMembers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRules(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroup) validateCrn(formats strfmt.Registry) error { + + if err := validate.Required("crn", "body", m.Crn); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroup) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroup) validateMembers(formats strfmt.Registry) error { + if swag.IsZero(m.Members) { // not required + return nil + } + + for i := 0; i < len(m.Members); i++ { + if swag.IsZero(m.Members[i]) { // not required + continue + } + + if m.Members[i] != nil { + if err := m.Members[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *NetworkSecurityGroup) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroup) validateRules(formats strfmt.Registry) error { + if swag.IsZero(m.Rules) { // not required + return nil + } + + for i := 0; i < len(m.Rules); i++ { + if swag.IsZero(m.Rules[i]) { // not required + continue + } + + if m.Rules[i] != nil { + if err := m.Rules[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network security group based on the context it is used +func (m *NetworkSecurityGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMembers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroup) contextValidateMembers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Members); i++ { + + if m.Members[i] != nil { + + if swag.IsZero(m.Members[i]) { // not required + return nil + } + + if err := m.Members[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("members" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("members" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *NetworkSecurityGroup) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + + if swag.IsZero(m.Rules[i]) { // not required + return nil + } + + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroup) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroup) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroup + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_add_member.go b/power/models/network_security_group_add_member.go new file mode 100644 index 00000000..abb75b1b --- /dev/null +++ b/power/models/network_security_group_add_member.go @@ -0,0 +1,124 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupAddMember network security group add member +// +// swagger:model NetworkSecurityGroupAddMember +type NetworkSecurityGroupAddMember struct { + + // The target member to add. An IP4 address if ipv4-address type or a network interface ID if network-interface type + // Required: true + Target *string `json:"target"` + + // The type of member + // Required: true + // Enum: ["ipv4-address","network-interface"] + Type *string `json:"type"` +} + +// Validate validates this network security group add member +func (m *NetworkSecurityGroupAddMember) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTarget(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupAddMember) validateTarget(formats strfmt.Registry) error { + + if err := validate.Required("target", "body", m.Target); err != nil { + return err + } + + return nil +} + +var networkSecurityGroupAddMemberTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["ipv4-address","network-interface"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupAddMemberTypeTypePropEnum = append(networkSecurityGroupAddMemberTypeTypePropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupAddMemberTypeIPV4DashAddress captures enum value "ipv4-address" + NetworkSecurityGroupAddMemberTypeIPV4DashAddress string = "ipv4-address" + + // NetworkSecurityGroupAddMemberTypeNetworkDashInterface captures enum value "network-interface" + NetworkSecurityGroupAddMemberTypeNetworkDashInterface string = "network-interface" +) + +// prop value enum +func (m *NetworkSecurityGroupAddMember) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupAddMemberTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupAddMember) validateType(formats strfmt.Registry) error { + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + // value enum + if err := m.validateTypeEnum("type", "body", *m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group add member based on context it is used +func (m *NetworkSecurityGroupAddMember) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupAddMember) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupAddMember) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupAddMember + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_add_rule.go b/power/models/network_security_group_add_rule.go new file mode 100644 index 00000000..2d4037c8 --- /dev/null +++ b/power/models/network_security_group_add_rule.go @@ -0,0 +1,312 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupAddRule network security group add rule +// +// swagger:model NetworkSecurityGroupAddRule +type NetworkSecurityGroupAddRule struct { + + // The action to take if the rule matches network traffic + // Required: true + // Enum: ["allow","deny"] + Action *string `json:"action"` + + // destination ports + DestinationPorts *NetworkSecurityGroupRulePort `json:"destinationPorts,omitempty"` + + // protocol + // Required: true + Protocol *NetworkSecurityGroupRuleProtocol `json:"protocol"` + + // remote + // Required: true + Remote *NetworkSecurityGroupRuleRemote `json:"remote"` + + // source ports + SourcePorts *NetworkSecurityGroupRulePort `json:"sourcePorts,omitempty"` +} + +// Validate validates this network security group add rule +func (m *NetworkSecurityGroupAddRule) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDestinationPorts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProtocol(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRemote(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSourcePorts(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var networkSecurityGroupAddRuleTypeActionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["allow","deny"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupAddRuleTypeActionPropEnum = append(networkSecurityGroupAddRuleTypeActionPropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupAddRuleActionAllow captures enum value "allow" + NetworkSecurityGroupAddRuleActionAllow string = "allow" + + // NetworkSecurityGroupAddRuleActionDeny captures enum value "deny" + NetworkSecurityGroupAddRuleActionDeny string = "deny" +) + +// prop value enum +func (m *NetworkSecurityGroupAddRule) validateActionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupAddRuleTypeActionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateAction(formats strfmt.Registry) error { + + if err := validate.Required("action", "body", m.Action); err != nil { + return err + } + + // value enum + if err := m.validateActionEnum("action", "body", *m.Action); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateDestinationPorts(formats strfmt.Registry) error { + if swag.IsZero(m.DestinationPorts) { // not required + return nil + } + + if m.DestinationPorts != nil { + if err := m.DestinationPorts.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destinationPorts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("destinationPorts") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateProtocol(formats strfmt.Registry) error { + + if err := validate.Required("protocol", "body", m.Protocol); err != nil { + return err + } + + if m.Protocol != nil { + if err := m.Protocol.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("protocol") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("protocol") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateRemote(formats strfmt.Registry) error { + + if err := validate.Required("remote", "body", m.Remote); err != nil { + return err + } + + if m.Remote != nil { + if err := m.Remote.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("remote") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("remote") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) validateSourcePorts(formats strfmt.Registry) error { + if swag.IsZero(m.SourcePorts) { // not required + return nil + } + + if m.SourcePorts != nil { + if err := m.SourcePorts.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sourcePorts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sourcePorts") + } + return err + } + } + + return nil +} + +// ContextValidate validate this network security group add rule based on the context it is used +func (m *NetworkSecurityGroupAddRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDestinationPorts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateProtocol(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRemote(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSourcePorts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupAddRule) contextValidateDestinationPorts(ctx context.Context, formats strfmt.Registry) error { + + if m.DestinationPorts != nil { + + if swag.IsZero(m.DestinationPorts) { // not required + return nil + } + + if err := m.DestinationPorts.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destinationPorts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("destinationPorts") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) contextValidateProtocol(ctx context.Context, formats strfmt.Registry) error { + + if m.Protocol != nil { + + if err := m.Protocol.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("protocol") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("protocol") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) contextValidateRemote(ctx context.Context, formats strfmt.Registry) error { + + if m.Remote != nil { + + if err := m.Remote.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("remote") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("remote") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupAddRule) contextValidateSourcePorts(ctx context.Context, formats strfmt.Registry) error { + + if m.SourcePorts != nil { + + if swag.IsZero(m.SourcePorts) { // not required + return nil + } + + if err := m.SourcePorts.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sourcePorts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sourcePorts") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupAddRule) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupAddRule) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupAddRule + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_create.go b/power/models/network_security_group_create.go new file mode 100644 index 00000000..fdafaa42 --- /dev/null +++ b/power/models/network_security_group_create.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupCreate network security group create +// +// swagger:model NetworkSecurityGroupCreate +type NetworkSecurityGroupCreate struct { + + // The name of the Network Security Group + // Required: true + Name *string `json:"name"` + + // The user tags associated with this resource. + UserTags []string `json:"userTags,omitempty"` +} + +// Validate validates this network security group create +func (m *NetworkSecurityGroupCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group create based on context it is used +func (m *NetworkSecurityGroupCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupCreate) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_member.go b/power/models/network_security_group_member.go new file mode 100644 index 00000000..533ffe59 --- /dev/null +++ b/power/models/network_security_group_member.go @@ -0,0 +1,144 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupMember network security group member +// +// swagger:model NetworkSecurityGroupMember +type NetworkSecurityGroupMember struct { + + // The ID of the member in a Network Security Group + // Required: true + ID *string `json:"id"` + + // The mac address of a Network Interface included if the type is network-interface + MacAddress string `json:"macAddress,omitempty"` + + // If ipv4-address type, then IPv4 address or if network-interface type, then network interface ID + // Required: true + Target *string `json:"target"` + + // The type of member + // Required: true + // Enum: ["ipv4-address","network-interface"] + Type *string `json:"type"` +} + +// Validate validates this network security group member +func (m *NetworkSecurityGroupMember) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTarget(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupMember) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupMember) validateTarget(formats strfmt.Registry) error { + + if err := validate.Required("target", "body", m.Target); err != nil { + return err + } + + return nil +} + +var networkSecurityGroupMemberTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["ipv4-address","network-interface"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupMemberTypeTypePropEnum = append(networkSecurityGroupMemberTypeTypePropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupMemberTypeIPV4DashAddress captures enum value "ipv4-address" + NetworkSecurityGroupMemberTypeIPV4DashAddress string = "ipv4-address" + + // NetworkSecurityGroupMemberTypeNetworkDashInterface captures enum value "network-interface" + NetworkSecurityGroupMemberTypeNetworkDashInterface string = "network-interface" +) + +// prop value enum +func (m *NetworkSecurityGroupMember) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupMemberTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupMember) validateType(formats strfmt.Registry) error { + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + // value enum + if err := m.validateTypeEnum("type", "body", *m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group member based on context it is used +func (m *NetworkSecurityGroupMember) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupMember) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupMember) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupMember + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_rule.go b/power/models/network_security_group_rule.go new file mode 100644 index 00000000..a1be84f9 --- /dev/null +++ b/power/models/network_security_group_rule.go @@ -0,0 +1,329 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupRule network security group rule +// +// swagger:model NetworkSecurityGroupRule +type NetworkSecurityGroupRule struct { + + // The action to take if the rule matches network traffic + // Required: true + // Enum: ["allow","deny"] + Action *string `json:"action"` + + // destination port + DestinationPort *NetworkSecurityGroupRulePort `json:"destinationPort,omitempty"` + + // The ID of the rule in a Network Security Group + // Required: true + ID *string `json:"id"` + + // protocol + // Required: true + Protocol *NetworkSecurityGroupRuleProtocol `json:"protocol"` + + // remote + // Required: true + Remote *NetworkSecurityGroupRuleRemote `json:"remote"` + + // source port + SourcePort *NetworkSecurityGroupRulePort `json:"sourcePort,omitempty"` +} + +// Validate validates this network security group rule +func (m *NetworkSecurityGroupRule) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDestinationPort(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProtocol(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRemote(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSourcePort(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var networkSecurityGroupRuleTypeActionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["allow","deny"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupRuleTypeActionPropEnum = append(networkSecurityGroupRuleTypeActionPropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupRuleActionAllow captures enum value "allow" + NetworkSecurityGroupRuleActionAllow string = "allow" + + // NetworkSecurityGroupRuleActionDeny captures enum value "deny" + NetworkSecurityGroupRuleActionDeny string = "deny" +) + +// prop value enum +func (m *NetworkSecurityGroupRule) validateActionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleTypeActionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupRule) validateAction(formats strfmt.Registry) error { + + if err := validate.Required("action", "body", m.Action); err != nil { + return err + } + + // value enum + if err := m.validateActionEnum("action", "body", *m.Action); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateDestinationPort(formats strfmt.Registry) error { + if swag.IsZero(m.DestinationPort) { // not required + return nil + } + + if m.DestinationPort != nil { + if err := m.DestinationPort.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destinationPort") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("destinationPort") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateProtocol(formats strfmt.Registry) error { + + if err := validate.Required("protocol", "body", m.Protocol); err != nil { + return err + } + + if m.Protocol != nil { + if err := m.Protocol.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("protocol") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("protocol") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateRemote(formats strfmt.Registry) error { + + if err := validate.Required("remote", "body", m.Remote); err != nil { + return err + } + + if m.Remote != nil { + if err := m.Remote.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("remote") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("remote") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) validateSourcePort(formats strfmt.Registry) error { + if swag.IsZero(m.SourcePort) { // not required + return nil + } + + if m.SourcePort != nil { + if err := m.SourcePort.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sourcePort") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sourcePort") + } + return err + } + } + + return nil +} + +// ContextValidate validate this network security group rule based on the context it is used +func (m *NetworkSecurityGroupRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDestinationPort(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateProtocol(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRemote(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSourcePort(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupRule) contextValidateDestinationPort(ctx context.Context, formats strfmt.Registry) error { + + if m.DestinationPort != nil { + + if swag.IsZero(m.DestinationPort) { // not required + return nil + } + + if err := m.DestinationPort.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("destinationPort") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("destinationPort") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) contextValidateProtocol(ctx context.Context, formats strfmt.Registry) error { + + if m.Protocol != nil { + + if err := m.Protocol.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("protocol") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("protocol") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) contextValidateRemote(ctx context.Context, formats strfmt.Registry) error { + + if m.Remote != nil { + + if err := m.Remote.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("remote") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("remote") + } + return err + } + } + + return nil +} + +func (m *NetworkSecurityGroupRule) contextValidateSourcePort(ctx context.Context, formats strfmt.Registry) error { + + if m.SourcePort != nil { + + if swag.IsZero(m.SourcePort) { // not required + return nil + } + + if err := m.SourcePort.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sourcePort") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sourcePort") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupRule) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupRule) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupRule + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_rule_port.go b/power/models/network_security_group_rule_port.go new file mode 100644 index 00000000..296b98ab --- /dev/null +++ b/power/models/network_security_group_rule_port.go @@ -0,0 +1,94 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupRulePort network security group rule port +// +// swagger:model NetworkSecurityGroupRulePort +type NetworkSecurityGroupRulePort struct { + + // The end of the port range, if applicable. If the value is not present then the default value of 65535 will be the maximum port number. + // Maximum: 65535 + Maximum int64 `json:"maximum,omitempty"` + + // The start of the port range, if applicable. If the value is not present then the default value of 1 will be the minimum port number. + // Minimum: 1 + Minimum int64 `json:"minimum,omitempty"` +} + +// Validate validates this network security group rule port +func (m *NetworkSecurityGroupRulePort) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMaximum(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinimum(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupRulePort) validateMaximum(formats strfmt.Registry) error { + if swag.IsZero(m.Maximum) { // not required + return nil + } + + if err := validate.MaximumInt("maximum", "body", m.Maximum, 65535, false); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupRulePort) validateMinimum(formats strfmt.Registry) error { + if swag.IsZero(m.Minimum) { // not required + return nil + } + + if err := validate.MinimumInt("minimum", "body", m.Minimum, 1, false); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group rule port based on context it is used +func (m *NetworkSecurityGroupRulePort) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupRulePort) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupRulePort) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupRulePort + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_rule_protocol.go b/power/models/network_security_group_rule_protocol.go new file mode 100644 index 00000000..f55e1272 --- /dev/null +++ b/power/models/network_security_group_rule_protocol.go @@ -0,0 +1,182 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupRuleProtocol network security group rule protocol +// +// swagger:model NetworkSecurityGroupRuleProtocol +type NetworkSecurityGroupRuleProtocol struct { + + // If icmp type, the list of ICMP packet types (by numbers) affected by ICMP rules and if not present then all types are matched + IcmpTypes []int64 `json:"icmpTypes"` + + // If tcp type, the list of TCP flags and if not present then all flags are matched + TCPFlags []*NetworkSecurityGroupRuleProtocolTCPFlag `json:"tcpFlags"` + + // The protocol of the network traffic + // Enum: ["icmp","tcp","udp","all"] + Type string `json:"type,omitempty"` +} + +// Validate validates this network security group rule protocol +func (m *NetworkSecurityGroupRuleProtocol) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTCPFlags(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupRuleProtocol) validateTCPFlags(formats strfmt.Registry) error { + if swag.IsZero(m.TCPFlags) { // not required + return nil + } + + for i := 0; i < len(m.TCPFlags); i++ { + if swag.IsZero(m.TCPFlags[i]) { // not required + continue + } + + if m.TCPFlags[i] != nil { + if err := m.TCPFlags[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tcpFlags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tcpFlags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +var networkSecurityGroupRuleProtocolTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["icmp","tcp","udp","all"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupRuleProtocolTypeTypePropEnum = append(networkSecurityGroupRuleProtocolTypeTypePropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupRuleProtocolTypeIcmp captures enum value "icmp" + NetworkSecurityGroupRuleProtocolTypeIcmp string = "icmp" + + // NetworkSecurityGroupRuleProtocolTypeTCP captures enum value "tcp" + NetworkSecurityGroupRuleProtocolTypeTCP string = "tcp" + + // NetworkSecurityGroupRuleProtocolTypeUDP captures enum value "udp" + NetworkSecurityGroupRuleProtocolTypeUDP string = "udp" + + // NetworkSecurityGroupRuleProtocolTypeAll captures enum value "all" + NetworkSecurityGroupRuleProtocolTypeAll string = "all" +) + +// prop value enum +func (m *NetworkSecurityGroupRuleProtocol) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleProtocolTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupRuleProtocol) validateType(formats strfmt.Registry) error { + if swag.IsZero(m.Type) { // not required + return nil + } + + // value enum + if err := m.validateTypeEnum("type", "body", m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this network security group rule protocol based on the context it is used +func (m *NetworkSecurityGroupRuleProtocol) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTCPFlags(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupRuleProtocol) contextValidateTCPFlags(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TCPFlags); i++ { + + if m.TCPFlags[i] != nil { + + if swag.IsZero(m.TCPFlags[i]) { // not required + return nil + } + + if err := m.TCPFlags[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tcpFlags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tcpFlags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleProtocol) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleProtocol) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupRuleProtocol + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_rule_protocol_tcp_flag.go b/power/models/network_security_group_rule_protocol_tcp_flag.go new file mode 100644 index 00000000..559651c5 --- /dev/null +++ b/power/models/network_security_group_rule_protocol_tcp_flag.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupRuleProtocolTCPFlag network security group rule protocol Tcp flag +// +// swagger:model NetworkSecurityGroupRuleProtocolTcpFlag +type NetworkSecurityGroupRuleProtocolTCPFlag struct { + + // TCP flag + // Enum: ["syn","ack","fin","rst","urg","psh","wnd","chk","seq"] + Flag string `json:"flag,omitempty"` +} + +// Validate validates this network security group rule protocol Tcp flag +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFlag(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var networkSecurityGroupRuleProtocolTcpFlagTypeFlagPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["syn","ack","fin","rst","urg","psh","wnd","chk","seq"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupRuleProtocolTcpFlagTypeFlagPropEnum = append(networkSecurityGroupRuleProtocolTcpFlagTypeFlagPropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagSyn captures enum value "syn" + NetworkSecurityGroupRuleProtocolTCPFlagFlagSyn string = "syn" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagAck captures enum value "ack" + NetworkSecurityGroupRuleProtocolTCPFlagFlagAck string = "ack" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagFin captures enum value "fin" + NetworkSecurityGroupRuleProtocolTCPFlagFlagFin string = "fin" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagRst captures enum value "rst" + NetworkSecurityGroupRuleProtocolTCPFlagFlagRst string = "rst" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagUrg captures enum value "urg" + NetworkSecurityGroupRuleProtocolTCPFlagFlagUrg string = "urg" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagPsh captures enum value "psh" + NetworkSecurityGroupRuleProtocolTCPFlagFlagPsh string = "psh" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagWnd captures enum value "wnd" + NetworkSecurityGroupRuleProtocolTCPFlagFlagWnd string = "wnd" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagChk captures enum value "chk" + NetworkSecurityGroupRuleProtocolTCPFlagFlagChk string = "chk" + + // NetworkSecurityGroupRuleProtocolTCPFlagFlagSeq captures enum value "seq" + NetworkSecurityGroupRuleProtocolTCPFlagFlagSeq string = "seq" +) + +// prop value enum +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) validateFlagEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleProtocolTcpFlagTypeFlagPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) validateFlag(formats strfmt.Registry) error { + if swag.IsZero(m.Flag) { // not required + return nil + } + + // value enum + if err := m.validateFlagEnum("flag", "body", m.Flag); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group rule protocol Tcp flag based on context it is used +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleProtocolTCPFlag) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupRuleProtocolTCPFlag + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_rule_remote.go b/power/models/network_security_group_rule_remote.go new file mode 100644 index 00000000..47426697 --- /dev/null +++ b/power/models/network_security_group_rule_remote.go @@ -0,0 +1,111 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupRuleRemote network security group rule remote +// +// swagger:model NetworkSecurityGroupRuleRemote +type NetworkSecurityGroupRuleRemote struct { + + // The ID of the remote Network Address Group or Network Security Group the rules apply to. Not required for default-network-address-group + ID string `json:"id,omitempty"` + + // The type of remote group the rules apply to + // Enum: ["network-security-group","network-address-group","default-network-address-group"] + Type string `json:"type,omitempty"` +} + +// Validate validates this network security group rule remote +func (m *NetworkSecurityGroupRuleRemote) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var networkSecurityGroupRuleRemoteTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["network-security-group","network-address-group","default-network-address-group"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupRuleRemoteTypeTypePropEnum = append(networkSecurityGroupRuleRemoteTypeTypePropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupRuleRemoteTypeNetworkDashSecurityDashGroup captures enum value "network-security-group" + NetworkSecurityGroupRuleRemoteTypeNetworkDashSecurityDashGroup string = "network-security-group" + + // NetworkSecurityGroupRuleRemoteTypeNetworkDashAddressDashGroup captures enum value "network-address-group" + NetworkSecurityGroupRuleRemoteTypeNetworkDashAddressDashGroup string = "network-address-group" + + // NetworkSecurityGroupRuleRemoteTypeDefaultDashNetworkDashAddressDashGroup captures enum value "default-network-address-group" + NetworkSecurityGroupRuleRemoteTypeDefaultDashNetworkDashAddressDashGroup string = "default-network-address-group" +) + +// prop value enum +func (m *NetworkSecurityGroupRuleRemote) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupRuleRemoteTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupRuleRemote) validateType(formats strfmt.Registry) error { + if swag.IsZero(m.Type) { // not required + return nil + } + + // value enum + if err := m.validateTypeEnum("type", "body", m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security group rule remote based on context it is used +func (m *NetworkSecurityGroupRuleRemote) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleRemote) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupRuleRemote) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupRuleRemote + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_group_update.go b/power/models/network_security_group_update.go new file mode 100644 index 00000000..a9d97709 --- /dev/null +++ b/power/models/network_security_group_update.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NetworkSecurityGroupUpdate network security group update +// +// swagger:model NetworkSecurityGroupUpdate +type NetworkSecurityGroupUpdate struct { + + // Replaces the current Network Security Group Name + Name string `json:"name,omitempty"` +} + +// Validate validates this network security group update +func (m *NetworkSecurityGroupUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network security group update based on context it is used +func (m *NetworkSecurityGroupUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupUpdate) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_groups.go b/power/models/network_security_groups.go new file mode 100644 index 00000000..82d72f87 --- /dev/null +++ b/power/models/network_security_groups.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NetworkSecurityGroups network security groups +// +// swagger:model NetworkSecurityGroups +type NetworkSecurityGroups struct { + + // list of Network Security Groups + NetworkSecurityGroups []*NetworkSecurityGroup `json:"networkSecurityGroups"` +} + +// Validate validates this network security groups +func (m *NetworkSecurityGroups) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNetworkSecurityGroups(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroups) validateNetworkSecurityGroups(formats strfmt.Registry) error { + if swag.IsZero(m.NetworkSecurityGroups) { // not required + return nil + } + + for i := 0; i < len(m.NetworkSecurityGroups); i++ { + if swag.IsZero(m.NetworkSecurityGroups[i]) { // not required + continue + } + + if m.NetworkSecurityGroups[i] != nil { + if err := m.NetworkSecurityGroups[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkSecurityGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkSecurityGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network security groups based on the context it is used +func (m *NetworkSecurityGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworkSecurityGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroups) contextValidateNetworkSecurityGroups(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.NetworkSecurityGroups); i++ { + + if m.NetworkSecurityGroups[i] != nil { + + if swag.IsZero(m.NetworkSecurityGroups[i]) { // not required + return nil + } + + if err := m.NetworkSecurityGroups[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkSecurityGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkSecurityGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroups) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroups) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroups + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/network_security_groups_action.go b/power/models/network_security_groups_action.go new file mode 100644 index 00000000..ad9b218a --- /dev/null +++ b/power/models/network_security_groups_action.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NetworkSecurityGroupsAction network security groups action +// +// swagger:model NetworkSecurityGroupsAction +type NetworkSecurityGroupsAction struct { + + // Name of the action to take; can be enable to enable NSGs in a workspace or disable to disable NSGs in a workspace + // Required: true + // Enum: ["enable","disable"] + Action *string `json:"action"` +} + +// Validate validates this network security groups action +func (m *NetworkSecurityGroupsAction) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var networkSecurityGroupsActionTypeActionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["enable","disable"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkSecurityGroupsActionTypeActionPropEnum = append(networkSecurityGroupsActionTypeActionPropEnum, v) + } +} + +const ( + + // NetworkSecurityGroupsActionActionEnable captures enum value "enable" + NetworkSecurityGroupsActionActionEnable string = "enable" + + // NetworkSecurityGroupsActionActionDisable captures enum value "disable" + NetworkSecurityGroupsActionActionDisable string = "disable" +) + +// prop value enum +func (m *NetworkSecurityGroupsAction) validateActionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkSecurityGroupsActionTypeActionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkSecurityGroupsAction) validateAction(formats strfmt.Registry) error { + + if err := validate.Required("action", "body", m.Action); err != nil { + return err + } + + // value enum + if err := m.validateActionEnum("action", "body", *m.Action); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network security groups action based on context it is used +func (m *NetworkSecurityGroupsAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkSecurityGroupsAction) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkSecurityGroupsAction) UnmarshalBinary(b []byte) error { + var res NetworkSecurityGroupsAction + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/power/models/workspace_details.go b/power/models/workspace_details.go index a74e2ebe..a26cc6ea 100644 --- a/power/models/workspace_details.go +++ b/power/models/workspace_details.go @@ -31,6 +31,9 @@ type WorkspaceDetails struct { // Link to Workspace Resource Href string `json:"href,omitempty"` + // The Workspace Network Security Groups information + NetworkSecurityGroups *WorkspaceNetworkSecurityGroupsDetails `json:"networkSecurityGroups,omitempty"` + // The Workspace Power Edge Router information PowerEdgeRouter *WorkspacePowerEdgeRouterDetails `json:"powerEdgeRouter,omitempty"` } @@ -47,6 +50,10 @@ func (m *WorkspaceDetails) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateNetworkSecurityGroups(formats); err != nil { + res = append(res, err) + } + if err := m.validatePowerEdgeRouter(formats); err != nil { res = append(res, err) } @@ -79,6 +86,25 @@ func (m *WorkspaceDetails) validateCrn(formats strfmt.Registry) error { return nil } +func (m *WorkspaceDetails) validateNetworkSecurityGroups(formats strfmt.Registry) error { + if swag.IsZero(m.NetworkSecurityGroups) { // not required + return nil + } + + if m.NetworkSecurityGroups != nil { + if err := m.NetworkSecurityGroups.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkSecurityGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkSecurityGroups") + } + return err + } + } + + return nil +} + func (m *WorkspaceDetails) validatePowerEdgeRouter(formats strfmt.Registry) error { if swag.IsZero(m.PowerEdgeRouter) { // not required return nil @@ -102,6 +128,10 @@ func (m *WorkspaceDetails) validatePowerEdgeRouter(formats strfmt.Registry) erro func (m *WorkspaceDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateNetworkSecurityGroups(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidatePowerEdgeRouter(ctx, formats); err != nil { res = append(res, err) } @@ -112,6 +142,27 @@ func (m *WorkspaceDetails) ContextValidate(ctx context.Context, formats strfmt.R return nil } +func (m *WorkspaceDetails) contextValidateNetworkSecurityGroups(ctx context.Context, formats strfmt.Registry) error { + + if m.NetworkSecurityGroups != nil { + + if swag.IsZero(m.NetworkSecurityGroups) { // not required + return nil + } + + if err := m.NetworkSecurityGroups.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networkSecurityGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networkSecurityGroups") + } + return err + } + } + + return nil +} + func (m *WorkspaceDetails) contextValidatePowerEdgeRouter(ctx context.Context, formats strfmt.Registry) error { if m.PowerEdgeRouter != nil { diff --git a/power/models/workspace_network_security_groups_details.go b/power/models/workspace_network_security_groups_details.go new file mode 100644 index 00000000..b2977339 --- /dev/null +++ b/power/models/workspace_network_security_groups_details.go @@ -0,0 +1,116 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// WorkspaceNetworkSecurityGroupsDetails workspace network security groups details +// +// swagger:model WorkspaceNetworkSecurityGroupsDetails +type WorkspaceNetworkSecurityGroupsDetails struct { + + // The state of a Network Security Groups configuration + // Required: true + // Enum: ["active","error","configuring","removing","inactive"] + State *string `json:"state"` +} + +// Validate validates this workspace network security groups details +func (m *WorkspaceNetworkSecurityGroupsDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var workspaceNetworkSecurityGroupsDetailsTypeStatePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["active","error","configuring","removing","inactive"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + workspaceNetworkSecurityGroupsDetailsTypeStatePropEnum = append(workspaceNetworkSecurityGroupsDetailsTypeStatePropEnum, v) + } +} + +const ( + + // WorkspaceNetworkSecurityGroupsDetailsStateActive captures enum value "active" + WorkspaceNetworkSecurityGroupsDetailsStateActive string = "active" + + // WorkspaceNetworkSecurityGroupsDetailsStateError captures enum value "error" + WorkspaceNetworkSecurityGroupsDetailsStateError string = "error" + + // WorkspaceNetworkSecurityGroupsDetailsStateConfiguring captures enum value "configuring" + WorkspaceNetworkSecurityGroupsDetailsStateConfiguring string = "configuring" + + // WorkspaceNetworkSecurityGroupsDetailsStateRemoving captures enum value "removing" + WorkspaceNetworkSecurityGroupsDetailsStateRemoving string = "removing" + + // WorkspaceNetworkSecurityGroupsDetailsStateInactive captures enum value "inactive" + WorkspaceNetworkSecurityGroupsDetailsStateInactive string = "inactive" +) + +// prop value enum +func (m *WorkspaceNetworkSecurityGroupsDetails) validateStateEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, workspaceNetworkSecurityGroupsDetailsTypeStatePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *WorkspaceNetworkSecurityGroupsDetails) validateState(formats strfmt.Registry) error { + + if err := validate.Required("state", "body", m.State); err != nil { + return err + } + + // value enum + if err := m.validateStateEnum("state", "body", *m.State); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this workspace network security groups details based on context it is used +func (m *WorkspaceNetworkSecurityGroupsDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *WorkspaceNetworkSecurityGroupsDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *WorkspaceNetworkSecurityGroupsDetails) UnmarshalBinary(b []byte) error { + var res WorkspaceNetworkSecurityGroupsDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}